Structure definition syntax changed to use type instead of length.

This commit is contained in:
lcdr 2015-09-20 14:42:16 +02:00
parent 9419e656b5
commit e2e7ff5183
20 changed files with 381 additions and 439 deletions

View File

@ -1,5 +1,5 @@
Component 60 - BaseCombatAI (tested using LOT 6366) Component 60 - BaseCombatAI (tested using LOT 6366)
Index 1 ($+824290): Index 1 ($+824290):
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:8] - ??? [s64] - ???

View File

@ -1,4 +1,4 @@
Component 6 - Bouncer (tested using LOT 14366) Component 6 - Bouncer (tested using LOT 14366)
Index 1 ($+7D6620): Index 1 ($+7D6620):
[L:BIT1] - flag [bit] - flag
[L:BIT1] - ??? [bit] - ???

View File

@ -1,87 +1,85 @@
Component 4 - Character (tested using LOT 1)
Index 1 ($+7DBCE0):
[bit] - flag
[bit] - flag
[s64] - vehicle object id
[u8] - ???
Index 24: Index 2 ($+863BD0):
[L:BIT1] - flag [bit] - flag
[L:BIT1] - flag [u32] - level
[L:8] - ???
[L:1] - ???
Index 25-26: missing Index 3 ($+7DC480):
[bit] - flag
[bit] - ???
[bit] - ???
Index 27: Index 4 ($+8A3A40):
[L:BIT1] - flag
[L:4] - ???
Index 28:
[L:BIT1] - flag
[L:BIT1] - ???
[L:BIT1] - ???
Index 29:
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag [bit] - flag
[L:8] - ???, could be "co" from xml data [u64] - ???, could be "co" from xml data
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [u64] - ???
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [u64] - ???
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [u64] - ???
[L:4] - hair color ("hc" from xml data), u32 [u32] - hair color ("hc" from xml data)
[L:4] - hair style ("hs" from xml data), u32 [u32] - hair style ("hs" from xml data)
[L:4] - ???, could be "hd" or "hdc" from xml data, u32 [u32] - ???, could be "hd" or "hdc" from xml data
[L:4] - shirt color ("t" from xml data), u32 [u32] - shirt color ("t" from xml data)
[L:4] - pants color ("l" from xml data), u32 [u32] - pants color ("l" from xml data)
[L:4] - ???, could be "cd" from xml data, u32 [u32] - ???, could be "cd" from xml data
[L:4] - ???, could be "hdc" or "hd" from xml data, u32 [u32] - ???, could be "hdc" or "hd" from xml data
[L:4] - eyebrows style ("es" from xml data), u32 [u32] - eyebrows style ("es" from xml data)
[L:4] - eyes style ("ess" from xml data), u32 [u32] - eyes style ("ess" from xml data)
[L:4] - mouth style ("ms" from xml data), u32 [u32] - mouth style ("ms" from xml data)
[L:8] - accountID (in xml data and chardata packet), u64 [u64] - accountID (in xml data and chardata packet)
[L:8] - "llog" from xml data, u64 [u64] - "llog" from xml data
[L:8] - ???, could be a couple of things from the xml data (since its 0 in the packet), u64 [u64] - ???
[L:8] - lego score (from xml data), u64 [u64] - lego score (from xml data)
[L:BIT1] - flag that sets free2play mode for player (1 means player is free2play) [bit] - is player free to play
[L:8] - Total Amount of Currency Collected, u64 [u64] - Total Amount of Currency Collected
[L:8] - Number of Bricks Collected, u64 [u64] - Number of Bricks Collected
[L:8] - Number of smashables smashed, u64 [u64] - Number of smashables smashed
[L:8] - Number of Quick Builds Completed, u64 [u64] - Number of Quick Builds Completed
[L:8] - Number of enemies smashed, u64 [u64] - Number of enemies smashed
[L:8] - Number of Rockets used, u64 [u64] - Number of Rockets used
[L:8] - Number of missions completed, u64 [u64] - Number of missions completed
[L:8] - Number of Pets tamed, u64 [u64] - Number of Pets tamed
[L:8] - Number of Imagination power-ups collected, u64 [u64] - Number of Imagination power-ups collected
[L:8] - Number of Life Power-Ups Collected, u64 [u64] - Number of Life Power-Ups Collected
[L:8] - Number of Armor power-ups collected, u64 [u64] - Number of Armor power-ups collected
[L:8] - Total Distance Traveled (in meters), u64 [u64] - Total Distance Traveled (in meters)
[L:8] - Number of times smashed, u64 [u64] - Number of times smashed
[L:8] - Total damage taken, u64 [u64] - Total damage taken
[L:8] - Total damage Healed, u64 [u64] - Total damage Healed
[L:8] - Total Armor Repaired, u64 [u64] - Total Armor Repaired
[L:8] - Total Imagination Restored, u64 [u64] - Total Imagination Restored
[L:8] - Total Imagination used, u64 [u64] - Total Imagination used
[L:8] - Total Distance Driven (in meters), u64 [u64] - Total Distance Driven (in meters)
[L:8] - Total Time Airborne in a Race Car (in seconds), u64 [u64] - Total Time Airborne in a Race Car (in seconds)
[L:8] - Number of Racing Imagination power-ups collected, u64 [u64] - Number of Racing Imagination power-ups collected
[L:8] - Number of Racing Imagination Crates Smashed, u64 [u64] - Number of Racing Imagination Crates Smashed
[L:8] - Number of Times Race Car Boost Activated, u64 [u64] - Number of Times Race Car Boost Activated
[L:8] - Number of Wrecks in a Race Car, u64 [u64] - Number of Wrecks in a Race Car
[L:8] - Number of Racing Smashables smashed, u64 [u64] - Number of Racing Smashables smashed
[L:8] - Number of Races finished, u64 [u64] - Number of Races finished
[L:8] - Number of 1st Place Race Finishes, u64 [u64] - Number of 1st Place Race Finishes
[L:BIT1] - ???, originally a [L:BIT2], simplified for parsing [bit] - ???
[L:BIT1] - ???, originally a [L:BIT2], simplified for parsing [bit] - ???
[L:2] - count of characters [u16] - count of characters
[L:2] - ???, seems to be a string in text lego data format, sample "1:9746;1:9747;1:9748;", wchar [u16] - some LDF string?
[L:BIT1] - flag, assert == True [bit] - flag
[L:BIT1] - flag?, assert == False [bit] - flag?, assert == False
[L:BIT1] - ???, assert == False [bit] - ???, assert == False
[L:1] - ???, assert == 0 [u8] - ???, assert == 0
[L:BIT1] - ???, assert == False [bit] - ???, assert == False
[L:1] - ???, assert == 0 [u8] - ???, assert == 0
[L:BIT1] - flag, assert == True [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - flag (this and below was in a separate function in the code), assert == True [bit] - flag (this and below was in a separate function in the code)
[L:8] - ??? [s64] - ???
[L:1] - ??? (count for next struct?) [u8] - ??? (count for next struct?)
[L:BIT1] - ??? [bit] - ???
[L:4] - ??? [u32] - ???

View File

@ -1,52 +1,54 @@
Component 1 - ControllablePhysics (tested using LOT 1)
Index 1 ($+845770):
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ???, could be a float, float [float] - ???
[L:4] - ???, could be a float, float [float] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - flag [bit] - flag
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - pos x, float [float] - position x
[L:4] - pos y, float [float] - position y
[L:4] - pos z, float [float] - position z
[L:4] - rotation x, float [float] - rotation x
[L:4] - rotation y, float [float] - rotation y
[L:4] - rotation z, float [float] - rotation z
[L:4] - rotation w, float [float] - rotation w
[L:BIT1] - is on ground, bool [bit] - is on ground
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - velocity x, float [float] - velocity x
[L:4] - velocity y, float [float] - velocity y
[L:4] - velocity z, float [float] - velocity z
[L:BIT1] - flag [bit] - flag
[L:4] - angular velocity x, float [float] - angular velocity x
[L:4] - angular velocity y, float [float] - angular velocity y
[L:4] - angular velocity z, float [float] - angular velocity z
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [s64] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[EVAL:not creation] [EVAL:not creation]
[L:BIT1] - flag? [bit] - flag?

View File

@ -1,77 +1,78 @@
Index 22: Component 7 - Destructible (tested using LOT 1)
Index 1 ($+939820):
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag, expect == False [bit] - flag, expect == False
[L:4] - ??? (seems to be a a count for following?) [u32] - count for following structs
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
trigger=[L:BIT1] - ???, seems to trigger L:8 below? trigger=[bit] - ???, seems to trigger [s64] below?
[L:BIT1] - ??? [bit] - ???
[EVAL:trigger] - seems to trigger this [EVAL:trigger]
[L:8] - ??? [s64] - ???
[L:4] - ??? [u32] - ???
[L:BIT1] - flag, expect == False [bit] - flag, expect == False
[L:4] - ??? (seems to be a a count for following?) [u32] - count for following structs
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???
trigger=[L:BIT1] - ???, seems to trigger L:8 below? trigger=[bit] - ???, seems to trigger [s64] below?
[L:BIT1] - ??? [bit] - ???
[EVAL:trigger] - seems to trigger this [EVAL:trigger]
[L:8] - ??? [s64] - ???
[L:4] - ??? [u32] - ???
Index 23: Index 2 ($+92BBD0):
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag [bit] - flag
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - life [u32] - current health
maxhealth=[L:4] - ???, has same number as max health struct, float, assert % 1 == 0 maxhealth=[float] - ???, has same number as max health struct, assert % 1 == 0
[L:4] - armor [u32] - current armor
maxarmor=[L:4] - ???, has same number as max armor struct, float, assert % 1 == 0 maxarmor=[float] - has same number as max armor struct, assert % 1 == 0
[L:4] - imagination, assert == 0 [u32] - current imagination
maximag=[L:4] - ???, has same number as max imagination, float, assert % 1 == 0 maximag=[float] - ???, has same number as max imagination, assert % 1 == 0
[L:4] - ???, assert == 0 [u32] - ???, assert == 0
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ???, assert == False [bit] - ???, assert == False
[L:BIT1] - ???, assert == False [bit] - ???, assert == False
[L:4] - max health, float, assert == maxhealth [float] - max health, assert == maxhealth
[L:4] - max armor, float, assert == maxarmor [float] - max armor, assert == maxarmor
[L:4] - max imagination, float, assert == maximag [float] - max imagination, assert == maximag
[L:4] - count for next struct [u32] - count
[L:4] - faction id [s32] - faction id
trigger=[L:BIT1] - flag trigger=[bit] - flag
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag, assert == False [bit] - flag, assert == False
[L:BIT1] - flag, assert == False [bit] - flag, assert == False
[EVAL:trigger] [EVAL:trigger]
[L:BIT1] - ???, assert == False [bit] - ???, assert == False
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:BIT1] - ??? [bit] - ???

View File

@ -1,3 +1,4 @@
Index 36: Component 107 - Unknown (tested using LOT 1)
[L:BIT1] - flag, assert == True Index 1 ($+7D6690):
[L:8] - ??? [bit] - flag
[s64] - ???

View File

@ -1,20 +1,20 @@
Component 17 - Inventory (tested using LOT 1)
Index 30: Index 1 ($+952860):
[L:BIT1] - flag [bit] - flag
[L:4] - # of items equipped, u32, assert > -1 and < 9 [u32] - # of items equipped, assert > -1 and < 9
[L:8] - objectID of item, s64 [s64] - objectID of item
[L:4] - LOT of item, s32 [s32] - LOT of item
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [s64] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ???, assert == 1 [u32] - ???, assert == 1
[L:BIT1] - flag [bit] - flag
[L:2] - slot in inventory [u16] - slot in inventory
[L:BIT1] - flag [bit] - flag
[L:4] - ???, expect == 4 [u32] - ???, expect == 4
[L:BIT1] - flag [bit] - flag
[L:4] - length of following structure [u32] - length of following structure
[L:1] - compressed data [u8] - compressed data
[L:BIT1] - ??? (perhaps a flag that specifies if the item gets loaded or if data needs to be retrieved from the cdclient database?), expect == True [bit] - ??? (perhaps a flag that specifies if the item gets loaded or if data needs to be retrieved from the cdclient database?), expect == True
[L:BIT1] - flag, assert == True [bit] - flag
[L:4] - ???, assert == 0 [u32] - ???, assert == 0

View File

@ -1,9 +1,9 @@
Component 11 - Item (tested using LOT 16380) Component 11 - Item (tested using LOT 16380)
Index 1 ($+81B2D0): Index 1 ($+81B2D0):
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [s64] - ???
[L:4] - ??? [u32] - ???
[L:BIT1] - flag, assert == False [bit] - flag, assert == False
not sure about this not sure about this
[L:4] - ??? [u32] - ???
[L:1] - ??? [u8] - ???

View File

@ -1,15 +1,15 @@
Component 26 - Pet (tested using LOT 3995) Component 26 - Pet (tested using LOT 3995)
Index 1 ($+8D1270): Index 1 ($+8D1270):
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [s64] - ???
[L:BIT1] - flag [bit] - flag
[L:8] - ??? [s64] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:1] - length [u8] - length
[L:2] - ??? [u16] - ???
[L:1] - length [u8] - length
[L:2] - ??? [u16] - ???

View File

@ -1,21 +1,21 @@
Component 40 - PhantomPhysics (tested using LOT 4940) Component 40 - PhantomPhysics (tested using LOT 4940)
Index 1 ($+834DB0): Index 1 ($+834DB0):
[L:BIT1] - flag [bit] - flag
[L:4] - position x, float [float] - position x
[L:4] - position y, float [float] - position y
[L:4] - position z, float [float] - position z
[L:4] - rotation x, float [float] - rotation x
[L:4] - rotation y, float [float] - rotation y
[L:4] - rotation z, float [float] - rotation z
[L:4] - rotation w, float [float] - rotation w
[L:BIT1] - flag, assert == True [bit] - flag, assert == True
[L:BIT1] - flag, expect == False [bit] - flag, expect == False
[L:4] - ??? [u32] - ???
[L:4] - ???, float [float] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???

View File

@ -1,10 +1,11 @@
Index 32: Component 2 - Render (tested using LOT 1)
Index 1 ($+840310):
[EVAL:creation] [EVAL:creation]
[L:4] - number of BehaviorEffects? (see BehaviorEffect table in cdclient), if this is -1 the client logs "Bad FX Unserialize", expect != -1 [u32] - number of BehaviorEffects? (see BehaviorEffect table in cdclient), if this is -1 the client logs "Bad FX Unserialize", expect != -1
[L:1] - effectID string length (# of letters), u8 [u8] - length
[L:1] - char, char [u8] - effectID string
[L:4] - effectID, i32 [u32] - effectID
[L:1] - effectType, string length (# of letters), u8 [u8] - length
[L:2] - wchar, wchar [u16] - effectType
[L:4] - ???, float [float] - ???
[L:8] - ??? [s64] - ???

View File

@ -1,6 +1,6 @@
Component 5 - Script (tested using LOT 3495) Component 5 - Script (tested using LOT 3495)
Index 1 ($+87CDF0): Index 1 ($+87CDF0):
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag [bit] - flag
[L:4] - size of following struct [u32] - size of following struct
[L:1] - compressed data, x bytes according to prev struct, u8 [u8] - compressed data, x bytes according to prev struct

View File

@ -1,16 +1,16 @@
Component 39 - ScriptedActivity (tested using LOT 11165) Component 39 - ScriptedActivity (tested using LOT 11165)
Index 1 ($+9002B0): Index 1 ($+9002B0):
[L:BIT1] - flag [bit] - flag
[L:4] - length [u32] - length
[L:8] - ??? [u64] - ???
constant size 10 loop constant size 10 loop
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???

View File

@ -1,22 +1,22 @@
Component 3 - SimplePhysics (tested using LOT 7701) Component 3 - SimplePhysics (tested using LOT 7701)
Index 1 ($+7E4B00): Index 1 ($+7E4B00):
[EVAL:creation] [EVAL:creation]
[L:BIT1] - ??? [bit] - ???
[L:4] - ???, float [float] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:4] - ???, float [float] - ???
[L:BIT1] - flag [bit] - flag
[L:4] - ???, assert == 5 [u32] - ???, assert == 5
[L:BIT1] - flag [bit] - flag
[L:4] - position x, float [float] - position x
[L:4] - position y, float [float] - position y
[L:4] - position z, float [float] - position z
[L:4] - rotation x, float [float] - rotation x
[L:4] - rotation y, float [float] - rotation y
[L:4] - rotation z, float [float] - rotation z
[L:4] - rotation w, float [float] - rotation w

View File

@ -1,22 +1,21 @@
Index 31: Component 9 - Skill (tested using LOT 1)
// component_type 9? Index 1 ($+806270):
// Seems to be related to BehaviorTemplate
[EVAL:creation] [EVAL:creation]
[L:BIT1] - flag [bit] - flag
[L:4] - count for following structs [u32] - count for following structs
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - ??? [u32] - ???
[L:4] - count for following structs [u32] - count for following structs
[L:4] - ??? [u32] - ???
[L:4] - ???, seems to be something in BehaviorTemplate? [u32] - ???, seems to be something in BehaviorTemplate?
[L:4] - ??? [u32] - ???
[L:4] - ???, expect == 18 [u32] - ???, expect == 18
[L:8] - ??? [s64] - ???
[L:8] - ??? [s64] - ???
[L:8] - ???, expect == 0 [s64] - ???, expect == 0
[L:BIT1] - ???, assert == False [bit] - ???, assert == False
[L:4] - ???, expect == 0 [u32] - ???, expect == 0
[L:4] - ???, expect == 0 [u32] - ???, expect == 0
[L:4] - ???, expect == 0 [u32] - ???, expect == 0

View File

@ -1,3 +1,3 @@
Component 49 - Switch (tested using LOT 16143) Component 49 - Switch (tested using LOT 16143)
Index 1 ($+80EBF0): Index 1 ($+80EBF0):
[L:BIT1] - since this is a switch it's likely it's the switch state (on/off) [bit] - since this is a switch it's likely it's the switch state (on/off)

View File

@ -1,5 +1,5 @@
Component 16 - Vendor (tested using LOT 8212) Component 16 - Vendor (tested using LOT 8212)
Index 1 ($+7E1CB0): Index 1 ($+7E1CB0):
[L:BIT1] - flag [bit] - flag
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - ??? [bit] - ???

View File

@ -1,22 +1,22 @@
[L:1] - Replica packet ID, assert == 0x24 [u8] - Replica packet ID, assert == 0x24
[L:BIT1] - Whether NetworkID is there, assert == 1 [bit] - Whether NetworkID is there, assert == 1
[L:2] - NetworkID, u16 [u16] - NetworkID
objectID=[L:8] - objectID, s64 objectID=[s64] - objectID
[L:4] - LOT, s32 [s32] - LOT
[L:1] - length, u8 [u8] - length
[L:2] - name, wchar [u16] - name
[L:4] - time_since_created_on_server? [u32] - time_since_created_on_server?
[L:BIT1] - flag, expect == False [bit] - flag, expect == False
[L:4] - size of following struct [u32] - size of following struct
[L:1] - compressed data, x bytes according to prev struct, u8 [u8] - compressed data, x bytes according to prev struct
[L:BIT1] - trigger_id, expect == False [bit] - trigger_id, expect == False
[L:BIT1] - flag [bit] - flag
[L:8] - SpawnerID, s64 [s64] - spawner object ID
[L:BIT1] - flag [bit] - flag
[L:4] - spawner_node_id, expect == 0 [u32] - spawner_node_id, expect == 0
[L:BIT1] - flag [bit] - flag
[L:4] - ???, float [float] - ???
[L:BIT1] - flag, assert == False [bit] - flag, assert == False
[L:1] - objectWorldState? [u8] - objectWorldState?
[L:BIT1] - flag, assert == False [bit] - flag, assert == False
[L:1] - ??? [u8] - gmlevel?

View File

@ -1,7 +1,7 @@
[L:BIT1] - flag [bit] - flag
[L:BIT1] - flag, expect == False [bit] - flag, expect == False
[L:8] - ??? [s64] - ???
[L:BIT1] - ??? [bit] - ???
[L:BIT1] - flag, expect == False [bit] - flag, expect == False
[L:2] - ??? (if > 0 read next block n times?) [u16] - ??? (if > 0 read next block n times?)
[L:8] - ??? [u64] - ???

View File

@ -8,29 +8,24 @@ from collections import namedtuple
from pyraknet.bitstream import BitStream, c_bit, c_float, c_double, c_int8, c_uint8, c_int16, c_uint16, c_int32, c_uint32, c_int64, c_uint64 from pyraknet.bitstream import BitStream, c_bit, c_float, c_double, c_int8, c_uint8, c_int16, c_uint16, c_int32, c_uint32, c_int64, c_uint64
VAR_CHARS = r"[^ \t\[\]]+" VAR_CHARS = r"[^ \t\[\]]+"
BIT = r"(BIT[0-7])?" BITSTREAM_TYPES = {"bit": c_bit, "float": c_float, "double": c_double, "s8": c_int8, "u8": c_uint8, "s16": c_int16, "u16": c_uint16, "s32": c_int32, "u32": c_uint32, "s64": c_int64, "u64": c_uint64}
BITSTREAM_TYPES = {"bytes": bytes, "string": (str, 1), "wstring": (str, 2), "float": c_float, "double": c_double, "s8": c_int8, "u8": c_uint8, "s16": c_int16, "u16": c_uint16, "s32": c_int32, "u32": c_uint32, "s64": c_int64, "u64": c_uint64}
TYPES_RE = "("+"|".join(BITSTREAM_TYPES.keys())+")" TYPES_RE = "("+"|".join(BITSTREAM_TYPES.keys())+")"
DEFINITION_SYNTAX = re.compile(r"""^ DEFINITION_SYNTAX = re.compile(r"""^
(?P<indent>\t*) # Indentation (?P<indent>\t*) # Indentation
((?P<var_assign>"""+VAR_CHARS+r""")=)? # Assign this struct a variable so the value can be back-referenced later ((?P<var_assign>"""+VAR_CHARS+r""")=)? # Assign this struct a variable so the value can be back-referenced later
\[( # Start of struct information \[(
( # A literal struct definition
(A:(?P<address>0x[0-9a-fA-F]*"""+BIT+r"""),)? # Fixed address information, in hexadecimal. This is unnecessary for structs that directly follow the previous struct and is rarely used.
(L:(?P<length>[0-9]*"""+BIT+r""")) # The length of the struct, in decimal
)
|
(EVAL:(?P<eval>.+)) # Expression to be evaluated, evaluated value acts like struct value, usually used for variables (EVAL:(?P<eval>.+)) # Expression to be evaluated, evaluated value acts like struct value, usually used for variables
)\] # End of struct information |
(?P<type>"""+TYPES_RE+r""") # Struct type
)\]
(\ -\ (?P<description>.*?) # Description for the struct (\ -\ (?P<description>.*?) # Description for the struct
(,\ (?P<type>"""+TYPES_RE+r"""))? # Struct type
(,\ expect\ (?P<expect>(.+?)))? # Expect the value to be like this expression. Struct attribute 'unexpected' will be None if no expects, True if any expects are False, or False if all expects are True. (,\ expect\ (?P<expect>(.+?)))? # Expect the value to be like this expression. Struct attribute 'unexpected' will be None if no expects, True if any expects are False, or False if all expects are True.
(,\ assert\ (?P<assert>(.+?)))? # Assert the value to be like this expression, will raise AssertionError if not True. (,\ assert\ (?P<assert>(.+?)))? # Assert the value to be like this expression, will raise AssertionError if not True.
)?$ )?$
""", re.VERBOSE) """, re.VERBOSE)
Definition = namedtuple("Definition", ("var_assign", "address", "length", "eval", "description", "type", "expects", "asserts")) Definition = namedtuple("Definition", ("var_assign", "eval", "type", "description", "expects", "asserts"))
Structure = namedtuple("Structure", ("level", "description", "value", "unexpected")) Structure = namedtuple("Structure", ("level", "description", "value", "unexpected"))
class StructParser: class StructParser:
@ -100,57 +95,12 @@ class StructParser:
@staticmethod @staticmethod
def _to_def_tuple(def_): def _to_def_tuple(def_):
if def_["address"] is not None:
split = def_["address"].split("BIT")
if split[0] != "":
bytes_ = int(split[0], 16)
else:
bytes_ = 0
if len(split) == 2:
bits = int(split[1])
else:
bits = 0
address_bits = bytes_ * 8 + bits
else:
address_bits = None
if def_["length"] is not None:
split = def_["length"].split("BIT")
if split[0] != "":
bytes_ = int(split[0])
else:
bytes_ = 0
if len(split) == 2:
bits = int(split[1])
else:
bits = 0
length_bits = bytes_ * 8 + bits
else:
length_bits = None
if def_["eval"] is not None: if def_["eval"] is not None:
eval_ = compile(def_["eval"], "<eval>", "eval") eval_ = compile(def_["eval"], "<eval>", "eval")
type_ = None type_ = None
else: else:
eval_ = None eval_ = None
if def_["type"] is not None: type_ = BITSTREAM_TYPES[def_["type"]]
type_ = BITSTREAM_TYPES[def_["type"]]
else:
# try to find a type based on the length
if length_bits == 1:
type_ = c_bit
elif length_bits == 8:
type_ = c_int8
elif length_bits == 16:
type_ = c_int16
elif length_bits == 32:
type_ = c_int32
elif length_bits == 64:
type_ = c_int64
else:
if length_bits % 8 == 0:
type_ = bytes
else:
raise ValueError(def_, length_bits)
if def_["expect"] is not None: if def_["expect"] is not None:
expects = [compile("value "+i, "<expect>", "eval") for i in def_["expect"].split(" and ")] expects = [compile("value "+i, "<expect>", "eval") for i in def_["expect"].split(" and ")]
@ -161,7 +111,7 @@ class StructParser:
else: else:
asserts = () asserts = ()
return Definition(def_["var_assign"], address_bits, length_bits, eval_, def_["description"], type_, expects, asserts) return Definition(def_["var_assign"], eval_, type_, def_["description"], expects, asserts)
def _parse_struct_occurrences(self, stream, defs, stack_level=0, repeat_times=1): def _parse_struct_occurrences(self, stream, defs, stack_level=0, repeat_times=1):
for _ in range(repeat_times): for _ in range(repeat_times):
@ -169,17 +119,7 @@ class StructParser:
if def_.eval is not None: if def_.eval is not None:
value = self._eval(def_.eval) value = self._eval(def_.eval)
else: else:
if def_.address != None: value = stream.read(def_.type)
stream._read_offset = def_.address
if isinstance(def_.type, tuple):
type_ = def_.type[0]
if type_ == str:
value = stream.read(str, char_size=def_.type[1], allocated_length=def_.length // 8)
elif def_.type == bytes:
value = stream.read(bytes, length=def_.length // 8)
else:
value = stream.read(def_.type)
if def_.expects: if def_.expects:
for expression in def_.expects: for expression in def_.expects: