Classic[4267] Warehouse items

10/02/2013 20:26 Mr_PoP#1
the Warehouse items is not showing correctly here is the packet structure :-
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;
        }
}
and am showing it like this ->

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);
        }
problem is items seems like mixed up , I can't see what am doing wrong here!
10/02/2013 20:52 Mr_PoP#2
Quote:
Originally Posted by Y u k i View Post
what do you mean with mixed up?
it's Icons becomes one , so like if I put Arrow,club,sword , they look like arrow,arrow,arrow lol
10/03/2013 11:24 Mr_PoP#3
Quote:
Originally Posted by Y u k i View Post
pitem.Id, pitem.TypeId probably a stupid question but are you sure one of those is acctually the UID?
pitem.Id = UID
pitem.TypeId = SataticId(itemtype)
10/03/2013 11:33 Korvacs#4
I have no idea where you got that structure from but, its definitely not correct.

[Only registered and activated users can see links. Click Here To Register...]
10/03/2013 13:32 Mr_PoP#5
Quote:
Originally Posted by Korvacs View Post
I have no idea where you got that structure from but, its definitely not correct.

[Only registered and activated users can see links. Click Here To Register...]
Code:
       WriteUInt32(offset, uid);
            WriteUInt32(offset + 4, type);
            WriteByte(offset + 9, sock1);
            WriteByte(offset + 10, sock2);
            WriteByte(offset + 13, plus);
            offset += 16;
I did follow your structure and same issue!
10/03/2013 13:34 Korvacs#6
Are you still allocating 20 bytes per item instead of 16 in the Length?
10/03/2013 13:35 Mr_PoP#7
Quote:
Originally Posted by Korvacs View Post
Are you still allocating 20 bytes per item instead of 16 in the Length?
nope

Code:
public WarehousePacket(int count)
            : base(PacketType.Warehouse, (ushort)(16 + (count * 16)))
        {
            WriteUInt32(12, (uint)count);
        }
10/03/2013 13:37 Korvacs#8
Is your Itemtype the 4267 version? Or is it a more modern one, basing this off the fact that this is obviously a conversion or a hack/slashed together source.
10/03/2013 13:48 Mr_PoP#9
Quote:
Originally Posted by Korvacs View Post
Is your Itemtype the 4267 version? Or is it a more modern one, basing this off the fact that this is obviously a conversion or a hack/slashed together source.
well the source is 4283 , but all the packets seems same as 4267 , not sure tho! maybe this causing this issue :confused:!
10/03/2013 13:50 Korvacs#10
If your packet structure is exactly how it is on the wiki then it must be an issue somewhere else, I use that structure in the 4267 source I'm working on. Its definitely the correct structure.

I would change the itemtypes over.
10/03/2013 13:53 Mr_PoP#11
Quote:
Originally Posted by Korvacs View Post
If your packet structure is exactly how it is on the wiki then it must be an issue somewhere else, I use that structure in the 4267 source I'm working on. Its definitely the correct structure.

I would change the itemtypes over.
the itemtypes is exactly the same as 4267, they just introduced a new UI , all the packets seems the same as 4267!
10/03/2013 13:54 Korvacs#12
Well, then you know that its something else, socket system perhaps, who knows. This is the problem with conversions.
04/18/2014 15:58 Mr_PoP#13
Quote:
Originally Posted by Korvacs View Post
Well, then you know that its something else, socket system perhaps, who knows. This is the problem with conversions.
in that version there was no damage/enchant yeah?
04/18/2014 16:02 Korvacs#14
Correct.
04/18/2014 16:49 Mr_PoP#15
Quote:
Originally Posted by Korvacs View Post
Correct.
Ight here is the right structure for 4283... if you wanna update your wiki :)

Code:
packet length = 16 + ( count * 20 )
appending items start on offset = 16;

UId->(offset,uint) 
ItemType->(offset + 4 , uint)
Ident(not sure)->(offset + 1 , byte)
Socket1->(offset + 1 , byte)
Socket2->(offset + 1 , byte)
UnKown->(offset + 1, byte)
Effect(not sure)->(offset + 1 , byte)
Compostion->(offset + 1 , byte)
Damage->(offset + 1 , byte)
UnKown2->(offset + 1 , byte)
Enchant->(offset + 1 , byte)
UnKnownBytes->(offset + 3 , byte)
if I figured what those unkown bytes for, will tell you.