Долгожданная покупка/продажа/возврат
BuyList
BuyList
PHP код:
<?php
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xB7);
writeD(0x00);
writeQ(_money); // current money
writeD(_listId);
writeD(0x00); // 0 = 250 количество слотов
writeH(_list.size());
for (L2TradeItem item : _list)
{
if (item.getCurrentCount() > 0 || !item.hasLimitedStock())
{
writeD(item.getItemId());
writeD(item.getItemId());
writeD(0);
writeQ(item.getCurrentCount() < 0 ? 0 : item.getCurrentCount());
writeH(item.getTemplate().getType2());
writeH(item.getTemplate().getType1()); // Custom Type 1
writeH(0x00); // isEquipped
writeD(item.getTemplate().getBodyPart()); // Body Part
writeH(0x00); // Enchant
writeH(0x00); // Custom Type
writeD(0x00); // Augment
writeD(-1); // Mana
writeD(-9999); // Time
writeH(1); // при 0 итем красный
writeH(0x00); // Element Type
writeH(0x00); // Element Power
for (byte i = 0; i < 6; i++)
{
writeH(0x00);
}
// Enchant Effects
writeH(0x00);
writeH(0x00);
writeH(0x00);
if (item.getItemId() >= 3960 && item.getItemId() <= 4026)// Config.RATE_SIEGE_GUARDS_PRICE-//'
writeQ((long) (item.getPrice() * Config.RATE_SIEGE_GUARDS_PRICE * (1 + _taxRate)));
else
writeQ((long) (item.getPrice() * (1 + _taxRate)));
}
}
}
ExBuySellListPacket
PHP код:
<?php
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xB7);
writeD(0x01);
writeD(0x00); // 0 = 250 количество слотов
if (_sellList != null && _sellList.length > 0)
{
writeH(_sellList.length);
for (L2ItemInstance item : _sellList)
{
writeD(item.getObjectId());
writeD(item.getItemId());
writeD(item.getLocationSlot());
writeQ(item.getCount());
writeH(item.getItem().getType2());
writeH(item.getCustomType1());
writeH(0x00);
writeD(item.getItem().getBodyPart());
writeH(item.getEnchantLevel());
writeH(item.getCustomType2());
// Augment, Mana, Time - hardcode for now
writeD(0x00);
writeD(-1);
writeD(-9999);
writeH(1); // при 0 итем красный
writeH(item.getAttackElementType());
writeH(item.getAttackElementPower());
for (byte i = 0; i < 6; i++)
{
writeH(item.getElementDefAttr(i));
}
// Enchant Effects
writeH(0x00);
writeH(0x00);
writeH(0x00);
writeQ(item.getItem().getReferencePrice() / 2);
}
}
else
writeH(0x00);
if (_refundList != null && _refundList.length > 0)
{
writeH(_refundList.length);
int idx = 0;
for (L2ItemInstance item : _refundList)
{
writeD(item.getObjectId());
writeD(item.getItemId());
writeD(0x00);
writeQ(item.getCount());
writeH(item.getItem().getType2());
writeH(item.getCustomType1());
writeH(0x00);
writeD(item.getItem().getBodyPart());
writeH(item.getEnchantLevel());
writeH(item.getCustomType2());
// Augment, Mana, Time - hardcode for now
writeD(0x00);
writeD(-1);
writeD(-9999);
writeH(1);
writeH(item.getAttackElementType());
writeH(item.getAttackElementPower());
for (byte i = 0; i < 6; i++)
{
writeH(item.getElementDefAttr(i));
}
// Enchant Effects
writeH(0x00);
writeH(0x00);
writeH(0x00);
writeD(idx++);
writeQ(item.getItem().getReferencePrice() / 2 * item.getCount());
}
}
else
writeH(0x00);
writeC(_done ? 0x01 : 0x00);
_buyList.clear();
}