Page 1 of 1
Problems with unpacking
Posted: Sun Feb 22, 2009 6:22 pm
by Zcoretri
I am trying to unpack this packet, but all I get is zeros.
Packet was collected just a few days ago.
Code: Select all
-- OP_UpdateCharacterSheetMsg --
2/20/2009 00:23:19
199.108.13.91 -> 192.168.0.100
0000: 00 3C 6F 00 00 00 7F 15 91 EB EB A0 01 08 81 03 .<o.............
0010: 47 8D 01 BE 53 21 85 F0 50 7F 2C 8F FF C0 15 6B G...S!..P.,....k
0020: 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 5E FF 66 6F ............^.fo
0030: 20 6E 6F 6F 42 FF 68 53 20 65 68 74 20 9F 73 77 nooB.hS eht .sw
0040: 6F 64 61 2C 8F 01 B9 7C E5 86 FF 2F 7F 7F 7F 7F oda,...|.../....
0050: 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F ................
0060: 7F 7F 71 81 75 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F ..q.u...........
0070 7F 7F 7F 7F 5C
Re: Problems with unpacking
Posted: Sun Feb 22, 2009 6:43 pm
by LethalEncounter
That is the charactersheet packet. The struct itself is about 8000 bytes long and mostly contains zeros. You are most likely doing it correctly except that you probably didn't give it a size big enough to properly unpack this monster

Also keep in mind that since this packet is not the first charsheet packet, the values in it need to be xor'd before they are useful. For example:
This is instead the packet:
Name: current_power Index: 0 Type: int32 Data: 235
Name: max_power Index: 0 Type: int32 Data: 235
Name: base_power Index: 0 Type: int32 Data: 00
Name: conc_used Index: 0 Type: int8 Data: 01
Name: conc_max Index: 0 Type: int8 Data: 00
Name: attack Index: 0 Type: int16 Data: 00
Name: attack_base Index: 0 Type: int16 Data: 00
Name: hp_regen Index: 0 Type: int32 Data: 00
Name: power_regen Index: 0 Type: int32 Data: 03
That doesn't mean that the client set your max power to 235. What it did was xor'd the previous value with this new one to get the total.
Re: Problems with unpacking
Posted: Sun Feb 22, 2009 6:45 pm
by Zcoretri
Holy cow, lol....I will increase the size then...i went up to 1500 is all.
EDIT: Light bulb popped over my head a second. Since most of the values are zeroes, does that mean the values I'm gonna find are the ones that actually changed to update the character sheet?
Re: Problems with unpacking
Posted: Sun Feb 22, 2009 6:50 pm
by LethalEncounter
Yup

Re: Problems with unpacking
Posted: Sun Feb 22, 2009 7:41 pm
by Zcoretri
LethalEncounter wrote:That is the charactersheet packet. The struct itself is about 8000 bytes long and mostly contains zeros. You are most likely doing it correctly except that you probably didn't give it a size big enough to properly unpack this monster

Also keep in mind that since this packet is not the first charsheet packet, the values in it need to be xor'd before they are useful. For example:
This is instead the packet:
Name: current_power Index: 0 Type: int32 Data: 235
Name: max_power Index: 0 Type: int32 Data: 235
Name: base_power Index: 0 Type: int32 Data: 00
Name: conc_used Index: 0 Type: int8 Data: 01
Name: conc_max Index: 0 Type: int8 Data: 00
Name: attack Index: 0 Type: int16 Data: 00
Name: attack_base Index: 0 Type: int16 Data: 00
Name: hp_regen Index: 0 Type: int32 Data: 00
Name: power_regen Index: 0 Type: int32 Data: 03
That doesn't mean that the client set your max power to 235. What it did was xor'd the previous value with this new one to get the total.
Ok I think I'm a little lost. So to get a value I need to XOR 235 with 7F(127)?
Re: Problems with unpacking
Posted: Mon Feb 23, 2009 3:26 pm
by LethalEncounter
Nope, you need to XOR it with the previous value. The values are constantly changing, so to properly get a value you need to find the values for that field in all the CharSheet packet for this session. Start with the very first packet to get a baseline and then XOR the field with the field in the next packet to get the new value. Continue on until you get to the packet you wish to review. If the field doesn't change too much a simple XOR from of the original packet and your test packet might be fine, but for fields that change often this wont work.
Re: Problems with unpacking
Posted: Mon Feb 23, 2009 3:38 pm
by Zcoretri
Yeah kinda thought it wasn't that simple, lol.
I did manage to figure it out finally after I read your comments a thousand times
