the Warehouse items is not showing correctly here is the packet structure :-
and am showing it like this ->
problem is items seems like mixed up , I can't see what am doing wrong here!
Code:
public class WarehousePacket : TQPacket
{
int offset = 16;
public WarehousePacket(int count)
: base(PacketType.Warehouse, (ushort)(16 + (count * 20)))
{
// WriteByte(9, 10);
WriteUInt32(12, (uint)count);
}
public uint NPCId
{
get
{
return ReadUInt32(4);
}
set
{
WriteUInt32(4, value);
}
}
public void AppendItem(uint uid, uint type, byte sock1, byte sock2, byte plus, byte bless, byte enchant, byte color)
{
WriteUInt32(offset, uid); offset += 4;
WriteUInt32(offset, type); offset += 5;
WriteByte(offset, sock1); offset++;
WriteByte(offset, sock2); offset += 3;
WriteByte(offset, plus); offset++;
WriteByte(offset, bless); offset++;
offset += 1;
}
}
Code:
void SendWarehouseItems(uint warehousId)
{
IWarehouse ware = hero.Warehouses[warehousId];
WarehousePacket pack = new WarehousePacket(ware.Count);
pack.NPCId = warehousId;
foreach (IItem pitem in ware.Items)
{
pack.AppendItem(pitem.Id, pitem.TypeId, pitem.FirstSocket, pitem.SecondSocket, pitem.Composition, pitem.Bless, 0, 0);
}
Send(pack);
}