Sync with L2JServer Jan 28th 2015.

This commit is contained in:
mobius
2015-01-29 05:18:04 +00:00
parent 59e1db4a68
commit 2cb3a52ed2
224 changed files with 4690 additions and 835 deletions

View File

@@ -276,6 +276,7 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
{
return;
}
getConnection().sendPacket(gsp);
gsp.runImpl();
}

View File

@@ -50,6 +50,11 @@ import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeAdd
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList;
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMentorCancel;
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMentorList;
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRProductInfo;
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRProductList;
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
import com.l2jserver.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
import com.l2jserver.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
import com.l2jserver.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
@@ -1276,19 +1281,19 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
msg = new RequestExOlympiadMatchListRefresh(); // RequestOlympiadMatchList
break;
case 0x86:
// msg = new RequestBRGamePoint();
msg = new RequestBRGamePoint();
break;
case 0x87:
// msg = new RequestBRProductList();
msg = new RequestBRProductList();
break;
case 0x88:
// msg = new RequestBRProductInfo();
msg = new RequestBRProductInfo();
break;
case 0x89:
// msg = new RequestBRBuyProduct();
msg = new RequestBRBuyProduct();
break;
case 0x8A:
// msg = new RequestBRRecentProductList();
msg = new RequestBRRecentProductList();
break;
case 0x8B:
// @ msg = new RequestBR_MiniGameLoadScores();

View File

@@ -56,10 +56,6 @@ public final class Logout extends L2GameClientPacket
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
{
if (Config.DEBUG)
{
_log.fine("Player " + player.getName() + " tried to logout while enchanting.");
}
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@@ -86,11 +82,6 @@ public final class Logout extends L2GameClientPacket
return;
}
if (Config.DEBUG)
{
_log.fine("Player " + player.getName() + " tried to logout while fighting.");
}
player.sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT);
player.sendPacket(ActionFailed.STATIC_PACKET);
return;

View File

@@ -60,12 +60,12 @@ public final class RequestGetItemFromPet extends L2GameClientPacket
return;
}
final L2PetInstance pet = (L2PetInstance) player.getPet();
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
{
return;
}
final L2PetInstance pet = (L2PetInstance) player.getPet();
final L2ItemInstance item = pet.getInventory().getItemByObjectId(_objectId);
if (item == null)
{

View File

@@ -18,7 +18,6 @@
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.PartyDistributionType;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2Party;
@@ -179,23 +178,12 @@ public final class RequestJoinParty extends L2GameClientPacket
// in case a leader change has happened, use party's mode
target.sendPacket(new AskJoinParty(requestor.getName(), party.getDistributionType()));
party.setPendingInvitation(true);
if (Config.DEBUG)
{
_log.fine("sent out a party invitation to:" + target.getName());
}
}
else
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
sm.addString(target.getName());
requestor.sendPacket(sm);
if (Config.DEBUG)
{
_log.warning(requestor.getName() + " already received a party invitation");
}
}
}
@@ -218,21 +206,10 @@ public final class RequestJoinParty extends L2GameClientPacket
requestor.onTransactionRequest(target);
target.sendPacket(new AskJoinParty(requestor.getName(), partyDistributionType));
requestor.getParty().setPendingInvitation(true);
if (Config.DEBUG)
{
_log.fine("sent out a party invitation to:" + target.getName());
}
}
else
{
requestor.sendPacket(SystemMessageId.WAITING_FOR_ANOTHER_REPLY);
if (Config.DEBUG)
{
_log.warning(requestor.getName() + " already received a party invitation");
}
}
}

View File

@@ -84,7 +84,7 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
boolean canUse = false;
for (L2ItemInstance item : player.getInventory().getItemsByItemId(itemId))
{
if ((enchantLevel == item.getEnchantLevel()) && (attackAttribute == item.getAttackElementType()) && (attackAttributeValue == item.getAttackElementPower()) && (appearanceId == item.getAppearanceId()) && (item.getElementDefAttr((byte) 0) == defenseAttributes[0]) && (item.getElementDefAttr((byte) 1) == defenseAttributes[1]) && (item.getElementDefAttr((byte) 2) == defenseAttributes[2]) && (item.getElementDefAttr((byte) 3) == defenseAttributes[3]) && (item.getElementDefAttr((byte) 4) == defenseAttributes[4]) && (item.getElementDefAttr((byte) 5) == defenseAttributes[5]))
if ((enchantLevel == item.getEnchantLevel()) && (attackAttribute == item.getAttackElementType()) && (attackAttributeValue == item.getAttackElementPower()) && (appearanceId == item.getVisualId()) && (item.getElementDefAttr((byte) 0) == defenseAttributes[0]) && (item.getElementDefAttr((byte) 1) == defenseAttributes[1]) && (item.getElementDefAttr((byte) 2) == defenseAttributes[2]) && (item.getElementDefAttr((byte) 3) == defenseAttributes[3]) && (item.getElementDefAttr((byte) 4) == defenseAttributes[4]) && (item.getElementDefAttr((byte) 5) == defenseAttributes[5]))
{
canUse = true;
break;

View File

@@ -60,7 +60,7 @@ public final class RequestExTryToPut_Shape_Shifting_TargetItem extends L2GameCli
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));
return;
}
final boolean isSameType = ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.Armor) && item.isArmor()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.Weapon) && item.isWeapon()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.Accessory) && item.isArmor()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.All));
final boolean isSameType = ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.ARMOR) && item.isArmor()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.WEAPON) && item.isWeapon()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.ACCESSORY) && item.isArmor()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.ALL));
if (!isSameType)
{
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));

View File

@@ -49,7 +49,7 @@ public final class RequestShape_Shifting_Item extends L2GameClientPacket
final L2ItemInstance stone = player.getUsingAppearanceStone();
final L2ItemInstance item = player.getAppearanceItem();
final L2ItemInstance targetItem = player.getTargetAppearanceItem();
final boolean needTargetItem = (stone != null) && (stone.getEtcItem().getAppearanceStone() != null) && (stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.Blessed) || stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.Normal)) ? true : false;
final boolean needTargetItem = (stone != null) && (stone.getEtcItem().getAppearanceStone() != null) && (stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.BLESSED) || stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.NORMAL)) ? true : false;
player.setUsingAppearanceStone(null);
player.setAppearanceItem(null);
player.setTargetAppearanceItem(null);
@@ -72,14 +72,14 @@ public final class RequestShape_Shifting_Item extends L2GameClientPacket
int time = -1;
switch (st.getType())
{
case Normal:
case NORMAL:
targetItemId = targetItem.getId();
player.destroyItem("AppearanceStone", targetItem, null, true);
break;
case Blessed:
case BLESSED:
targetItemId = targetItem.getId();
break;
case Fixed:
case FIXED:
targetItemId = st.getTargetItem();
time = (int) st.getTimeForAppearance();
break;

View File

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets.primeshop;
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
/**
* @author Gnacik, UnAfraid
*/
public final class RequestBRBuyProduct extends L2GameClientPacket
{
private int _brId;
private int _count;
@Override
protected void readImpl()
{
_brId = readD();
_count = readD();
}
@Override
protected void runImpl()
{
final L2PcInstance player = getClient().getActiveChar();
if (player != null)
{
PrimeShopData.getInstance().buyItem(player, _brId, _count);
}
}
@Override
public String getType()
{
return getClass().getSimpleName();
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets.primeshop;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRGamePoint;
/**
* @author Gnacik, UnAfraid
*/
public final class RequestBRGamePoint extends L2GameClientPacket
{
@Override
protected void readImpl()
{
// There is nothing to read.
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player != null)
{
player.sendPacket(new ExBRGamePoint(player));
}
}
@Override
public String getType()
{
return getClass().getSimpleName();
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets.primeshop;
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
/**
* @author Gnacik, UnAfraid
*/
public final class RequestBRProductInfo extends L2GameClientPacket
{
private int _brId;
@Override
protected void readImpl()
{
_brId = readD();
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player != null)
{
PrimeShopData.getInstance().showProductInfo(player, _brId);
}
}
@Override
public String getType()
{
return getClass().getSimpleName();
}
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets.primeshop;
import java.util.logging.Level;
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRProductList;
/**
* @author Gnacik, UnAfraid
*/
public final class RequestBRProductList extends L2GameClientPacket
{
private int _type;
@Override
protected void readImpl()
{
_type = readD();
}
@Override
protected void runImpl()
{
final L2PcInstance player = getClient().getActiveChar();
if (player != null)
{
switch (_type)
{
case 0: // Home page
{
player.sendPacket(new ExBRProductList(player, 0, PrimeShopData.getInstance().getPrimeItems().values()));
break;
}
case 1: // History
{
break;
}
case 2: // Favorites
{
break;
}
default:
{
_log.log(Level.WARNING, player + " send unhandled product list type: " + _type);
break;
}
}
}
}
@Override
public String getType()
{
return getClass().getSimpleName();
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets.primeshop;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
/**
* @author Gnacik, UnAfraid
*/
public final class RequestBRRecentProductList extends L2GameClientPacket
{
@Override
protected void readImpl()
{
// Nothing to read
}
@Override
protected void runImpl()
{
// L2PcInstance player = getClient().getActiveChar();
// TODO: Implement it.
}
@Override
public String getType()
{
return getClass().getSimpleName();
}
}

View File

@@ -71,8 +71,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
protected void writeTradeItem(TradeItem item)
{
// final int mask = calculateMask(item);
// writeC(mask);
writeH(item.getItem().getType1());
writeD(item.getObjectId()); // ObjectId
writeD(item.getItem().getDisplayId()); // ItemId
@@ -117,7 +115,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
}
if (containsMask(mask, ItemListType.VISUAL_ID))
{
writeD(item.getAppearanceId()); // Item remodel visual ID
writeD(item.getVisualId()); // Item remodel visual ID
}
}
@@ -179,11 +177,10 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
}
}
if (item.getAppearanceId() > 0)
if (item.getVisualId() > 0)
{
mask |= ItemListType.VISUAL_ID.getMask();
}
return mask;
}

View File

@@ -145,15 +145,10 @@ public class CharInfo extends L2GameServerPacket
writeC(_armorEnchant);
writeD(0x00); // rhand item visual id
writeD(0x00); // lhand item visual id
writeD(0x00); // lrhand item visual id
writeD(0x00); // gloves item visual id
writeD(0x00); // chest item visual id
writeD(0x00); // legs item visual id
writeD(0x00); // feet item visual id
writeD(0x00); // hair item visual id
writeD(0x00); // hair 2 item visual id
for (int slot : getPaperdollOrderVisualId())
{
writeD(_activeChar.getInventory().getPaperdollItemVisualId(slot));
}
writeC(_activeChar.getPvpFlag());
writeD(_activeChar.getKarma());

View File

@@ -83,7 +83,7 @@ public class ExUserInfoEquipSlot extends AbstractMaskPacket<InventorySlot>
writeD(inventory.getPaperdollObjectId(slot.getSlot()));
writeD(inventory.getPaperdollItemId(slot.getSlot()));
writeD(inventory.getPaperdollAugmentationId(slot.getSlot()));
writeD(inventory.getPaperdollVisualId(slot.getSlot()));
writeD(inventory.getPaperdollItemVisualId(slot.getSlot()));
}
}
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets.primeshop;
import com.l2jserver.gameserver.model.interfaces.IIdentifiable;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Gnacik, UnAfraid
*/
public class ExBRBuyProduct extends L2GameServerPacket
{
public enum ExBrProductReplyType implements IIdentifiable
{
SUCCESS(1),
LACK_OF_POINT(-1),
INVALID_PRODUCT(-2),
USER_CANCEL(-3),
INVENTROY_OVERFLOW(-4),
CLOSED_PRODUCT(-5),
SERVER_ERROR(-6),
BEFORE_SALE_DATE(-7),
AFTER_SALE_DATE(-8),
INVALID_USER(-9),
INVALID_ITEM(-10),
INVALID_USER_STATE(-11),
NOT_DAY_OF_WEEK(-12),
NOT_TIME_OF_DAY(-13),
SOLD_OUT(-14);
private final int _id;
private ExBrProductReplyType(int id)
{
_id = id;
}
@Override
public int getId()
{
return _id;
}
}
private final int _reply;
public ExBRBuyProduct(final ExBrProductReplyType type)
{
_reply = type.getId();
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xD9);
writeD(_reply);
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets.primeshop;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Gnacik, UnAfraid
*/
public class ExBRGamePoint extends L2GameServerPacket
{
private final int _charId;
private final int _charPoints;
public ExBRGamePoint(final L2PcInstance player)
{
_charId = player.getObjectId();
_charPoints = player.getPrimePoints();
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xD6);
writeD(_charId);
writeQ(_charPoints);
writeD(0x00);
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets.primeshop;
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Gnacik
*/
public class ExBRProductInfo extends L2GameServerPacket
{
private final PrimeShopGroup _item;
public ExBRProductInfo(PrimeShopGroup item)
{
_item = item;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xD8);
writeD(_item.getBrId());
writeD(_item.getPrice());
writeD(_item.getItems().size());
for (PrimeShopItem item : _item.getItems())
{
writeD(item.getId());
writeD((int) item.getCount());
writeD(item.getWeight());
writeD(item.isTradable());
}
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets.primeshop;
import java.util.Collection;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author UnAfraid
*/
public class ExBRProductList extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
private final int _type;
private final Collection<PrimeShopGroup> _primeList;
public ExBRProductList(L2PcInstance activeChar, int type, Collection<PrimeShopGroup> items)
{
_activeChar = activeChar;
_type = type;
_primeList = items;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xD7);
writeQ(_activeChar.getAdena()); // Adena
writeQ(0x00); // Hero coins
writeC(_type); // Type 0 - Home, 1 - History, 2 - Favorites
writeD(_primeList.size());
for (PrimeShopGroup brItem : _primeList)
{
writeD(brItem.getBrId());
writeC(brItem.getCat());
writeC(brItem.getPaymentType()); // Payment Type: 0 - Prime Points, 1 - Adena, 2 - Hero Coins
writeD(brItem.getPrice());
writeC(brItem.getPanelType()); // Item Panel Type: 0 - None, 1 - Event, 2 - Sale, 3 - New, 4 - Best
writeD(brItem.getRecommended()); // Recommended: (bit flags) 1 - Top, 2 - Left, 4 - Right
writeD(brItem.getStartSale());
writeD(brItem.getEndSale());
writeC(brItem.getDaysOfWeek());
writeC(brItem.getStartHour());
writeC(brItem.getStartMinute());
writeC(brItem.getStopHour());
writeC(brItem.getStopMinute());
writeD(brItem.getStock());
writeD(brItem.getTotal());
writeC(brItem.getSalePercent());
writeC(brItem.getMinLevel());
writeC(brItem.getMaxLevel());
writeD(brItem.getMinBirthday());
writeD(brItem.getMaxBirthday());
writeD(brItem.getRestrictionDay());
writeD(brItem.getAvailableCount());
writeC(brItem.getItems().size());
for (PrimeShopItem item : brItem.getItems())
{
writeD(item.getId());
writeD((int) item.getCount());
writeD(item.getWeight());
writeD(item.isTradable());
}
}
}
}