Показать сообщение отдельно
Непрочитано 18.12.2011, 22:03   #488
Изгнанные

По умолчанию Re: Работа над Goddess of Destruction (part 4)

Друзья подскажиоте что у меня не так с пакетами!
бай лист
PHP код:
protected final void writeImpl()
    {
        
writeC(0x07);
        
writeQ(_money); // current money
        
writeD(_listId);
        if(
_Buylist == null)
        {
            
writeH(0);
        }
        else
        {
            
writeH(_Buylist.size());
            for(
TradeItem item _Buylist)
            {
                
//writeH(item.getItem().getType1()); // item type1
                
writeD(item.getObjectId());
                
writeD(item.getItemId());
                
writeQ(item.getCurrentValue()); // max amount of items that a player can buy at a time (with this itemid)
                
writeH(item.getItem().getType2ForPackets()); // item type2
                
writeH(0); // getCustomType1?
                
writeD(item.getItem().getBodyPart()); // rev 415  slot    0006-lr.ear  0008-neck  0030-lr.finger  0040-head  0080-??  0100-l.hand  0200-gloves  0400-chest  0800-pants  1000-feet  2000-??  4000-r.hand  8000-r.hand
                
writeH(item.getEnchantLevel()); // enchant level
                
writeH(0); // getCustomType1?
                
writeH(0); // unknown
                
writeQ((long) (item.getOwnersPrice() * (_TaxRate)));
                
writeItemElements(item);
            }
        }
        if(
_SellList == null)
        {
            
writeH(0);
        }
        else
        {
            
writeH(_SellList.size());
            for(
TradeItem item _SellList)
            {
                
//writeH(item.getItem().getType1()); // item type1
                
writeD(item.getObjectId());
                
writeD(item.getItemId());
                
writeQ(item.getCurrentValue()); // max amount of items that a player can buy at a time (with this itemid)
                
writeH(item.getItem().getType2ForPackets()); // item type2
                
writeH(0); // getCustomType1?
                
writeD(item.getItem().getBodyPart()); // rev 415  slot    0006-lr.ear  0008-neck  0030-lr.finger  0040-head  0080-??  0100-l.hand  0200-gloves  0400-chest  0800-pants  1000-feet  2000-??  4000-r.hand  8000-r.hand
                
writeH(item.getEnchantLevel()); // enchant level
                
writeH(0); // getCustomType1?
                
writeH(0); // unknown
                
writeQ((long) (item.getOwnersPrice() * (_TaxRate)));
                
writeItemElements(item);
            }
        }
        if(
_RefundList == null)
        {
            
writeH(0);
        }
        else
        {
            
writeH(_RefundList.size());
            for(
TradeItem item _RefundList)
            {
                
writeD(item.getObjectId());
                
writeD(item.getItemId());
                
writeQ(item.getCurrentValue()); // max amount of items that a player can buy at a time (with this itemid)
                
writeH(item.getItem().getType2ForPackets()); // item type2
                
writeH(0); // getCustomType1?
                
writeH(item.getEnchantLevel()); // enchant level
                
writeH(0); // getCustomType1?
                
writeH(0); // unknown //
                
writeQ((long) (item.getOwnersPrice() * (_TaxRate)));
                
writeItemElements(item);
            }
        }
    } 
селл лист
PHP код:
protected final void writeImpl()
    {
        
writeC(0x06);
        
writeQ(_money); // current money
        
writeD(_listId);
        if(
sellList  == null)
        {
            
writeH(0);
        }
        else
        {
            
writeH(sellList .size());
            for(
L2ItemInstance item sellList )
            {
                
//writeH(item.getItem().getType1()); // item type1
                
writeD(item.getObjectId());
                
writeD(item.getItemId());
                
writeQ(item.getCount()); // max amount of items that a player can buy at a time (with this itemid)
                
writeH(item.getItem().getType2ForPackets()); // item type2
                
writeH(0x00); // getCustomType1?
                
writeD(item.getItem().getBodyPart()); // rev 415  slot    0006-lr.ear  0008-neck  0030-lr.finger  0040-head  0080-??  0100-l.hand  0200-gloves  0400-chest  0800-pants  1000-feet  2000-??  4000-r.hand  8000-r.hand
                
writeH(item.getEnchantLevel()); // enchant level
                
writeH(0x00); // getCustomType1?
                
writeH(item.getCustomType2());
                
writeQ(item.getItem().getReferencePrice()/2);
                
writeItemElements(item);
            }
        }
    } 
ExBuySellList
PHP код:
protected final void writeImpl()
    {
        
writeC(EXTENDED_PACKET);
        
writeH(0xB7);

        
writeD(0x00);
        
writeQ(_money); // current money
        
writeD(_listId);

        if(
_Buylist == null)
            
writeH(0);
        else
        {
            
writeH(_Buylist.size());
            for(
TradeItem item _Buylist)
            {
                
writeD(item.getObjectId());
                
writeD(item.getItemId());
                
writeQ(item.getCurrentValue()); // max amount of items that a player can buy at a time (with this itemid)
                
writeD(0x00);
                
writeH(item.getItem().getType2ForPackets()); // item type2
                
writeH(0x00);
                
writeH(item.getCustomType1()); // getCustomType1?
                
writeD(item.getItem().getBodyPart()); // rev 415  slot    0006-lr.ear  0008-neck  0030-lr.finger  0040-head  0080-??  0100-l.hand  0200-gloves  0400-chest  0800-pants  1000-feet  2000-??  4000-r.hand  8000-r.hand
                
writeH(item.getEnchantLevel()); // enchant level
                
writeH(item.getCustomType2());

                
writeD(0x00);// Augmentation Id
                
writeD(-1);// Mana
                
writeD(0x00);// Shadow Life Time
                
writeItemElements(item);
                
writeEnchantEffect(item);
                
writeQ((long) (item.getOwnersPrice() * (_TaxRate)));
            }
        }

        
getClient().sendPacket(new SellList(done_SellList_RefundList));
    } 
уже всё перепробовал ничё не получаеться!

Добавлено через 3 часа 20 минут
вот разобраный пакет ExBuySellList
PHP код:
package l2open.gameserver.serverpackets;

import l2open.gameserver.TradeController.NpcTradeList;
import l2open.gameserver.model.L2Player;
import l2open.gameserver.model.TradeItem;
import l2open.gameserver.model.items.Inventory;
import l2open.gameserver.model.items.L2ItemInstance;
import l2open.util.GArray;

import java.util.TreeSet;
import java.util.concurrent.ConcurrentLinkedQueue;

public class 
ExBuySellList extends L2GameServerPacket
{
    private 
int _listId;
    private 
byte done;
    private final 
GArray<TradeItem_Buylist;
    private final 
TreeSet<L2ItemInstance_SellList;
    private final 
ConcurrentLinkedQueue<L2ItemInstance_RefundList;
    private 
long _money;
    private 
double _TaxRate 0;

    public 
ExBuySellList(NpcTradeList BuylistL2Player activeChardouble taxRate)
    {
        if(
Buylist != null)
        {
            
_listId Buylist.getListId();
            
_Buylist cloneAndFilter(Buylist.getItems());
            
activeChar.setBuyListId(_listId);
        }
        else
            
_Buylist null;

        
_money activeChar.getAdena();
        
_TaxRate taxRate;
        
_RefundList activeChar.getInventory().getRefundItemsList();

        
_SellList = new TreeSet<L2ItemInstance>(Inventory.OrderComparator);
        for(
L2ItemInstance item activeChar.getInventory().getItemsList())
            if(
item.getItem().isSellable() && item.canBeTraded(activeChar) && item.getReferencePrice() > 0)
                
_SellList.add(item);
    }

    public 
ExBuySellList done()
    {
        
done 1;
        return 
this;
    }

    protected static 
GArray<TradeItemcloneAndFilter(GArray<TradeItem> list)
    {
        if(list == 
null)
            return 
null;

        
GArray<TradeItemret = new GArray<TradeItem>(list.size());

        for(
TradeItem item : list)
        {
            
// Рђ РЅРµ РїРѕСЂР° Р»Рё РѕР±РЅРѕРІРёС‚СЊ РєРѕР»РёС‡РµСЃС‚РІРѕ Р»РёРјРёС‚ированных РїСЂРµРґРјРµС‚РѕРІ РІ С‚рейд Р»РёСЃС‚Рµ?
            
if(item.getCurrentValue() < item.getCount() && item.getLastRechargeTime() + item.getRechargeTime() <= System.currentTimeMillis() / 60000)
            {
                
item.setLastRechargeTime(item.getLastRechargeTime() + item.getRechargeTime());
                
item.setCurrentValue(item.getCount());
            }

            if(
item.getCurrentValue() == && item.getCount() != 0)
                continue;

            
ret.add(item);
        }

        return 
ret;
    }

    @
Override
    
protected final void writeImpl()
    {
        
writeC(EXTENDED_PACKET);
        
writeH(0xB7);
        
writeD(0x00); // BUY LIST TYPE
        
writeQ(_money); // current money
        
writeD(_listId);
        
writeD(0x00);
        
writeH(_Buylist.size());
        for(
TradeItem item _Buylist)
        {
            
writeD(item.getObjectId());
        
writeD(item.getItemId());
        
writeD(item.getEquipSlot());
        
writeQ(count);
        
writeH(item.getItem().getType2ForPackets()); // item type2
        
writeH(item.getCustomType1());
        
writeH(item.isEquipped() ? 0);
        
writeD(item.getBodyPart());
        
writeH(item.getEnchantLevel());
        
writeH(item.getCustomType2());
        
writeD(0x00);//(item.getAugmentationId());
        
writeD(-1);//(item.getShadowLifeTime());
        
writeD(0x00);//(item.getTemporalLifeTime());
        
writeH(0x01);
        
writeH(item.getAttackElement());
        
writeH(item.getAttackElementValue());
        for (
int i 06i++) 
            
writeH(item.getDeffAttr()[i]);
        
writeH(0);
                      
writeH(0);
                       
writeH(0);
            
writeQ((long) (item.getOwnersPrice() * (1. _TaxRate)));
        }

        
getClient().sendPacket(new SellList(done_SellList_RefundList));
    }


Последний раз редактировалось Darvin; 19.12.2011 в 01:24. Причина: Добавлено сообщение
Darvin вне форума Отправить сообщение для Darvin с помощью ICQ Отправить сообщение для Darvin с помощью Skype™
Сказали спасибо: