diff --git a/packetdefinitions/replica/components/BaseCombatAI.structs b/packetdefinitions/replica/components/BaseCombatAI.structs index d4b3a07..137ce44 100644 --- a/packetdefinitions/replica/components/BaseCombatAI.structs +++ b/packetdefinitions/replica/components/BaseCombatAI.structs @@ -1,5 +1,5 @@ Component 60 - BaseCombatAI (tested using LOT 6366) Index 1 ($+824290): -[L:BIT1] - flag - [L:4] - ??? - [L:8] - ??? +[bit] - flag + [u32] - ??? + [s64] - ??? diff --git a/packetdefinitions/replica/components/Bouncer.structs b/packetdefinitions/replica/components/Bouncer.structs index 3db3d77..9eabde8 100644 --- a/packetdefinitions/replica/components/Bouncer.structs +++ b/packetdefinitions/replica/components/Bouncer.structs @@ -1,4 +1,4 @@ Component 6 - Bouncer (tested using LOT 14366) Index 1 ($+7D6620): -[L:BIT1] - flag - [L:BIT1] - ??? +[bit] - flag + [bit] - ??? diff --git a/packetdefinitions/replica/components/Character.structs b/packetdefinitions/replica/components/Character.structs index e73d201..d8af624 100644 --- a/packetdefinitions/replica/components/Character.structs +++ b/packetdefinitions/replica/components/Character.structs @@ -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: -[L:BIT1] - flag - [L:BIT1] - flag - [L:8] - ??? - [L:1] - ??? +Index 2 ($+863BD0): +[bit] - flag + [u32] - level -Index 25-26: missing +Index 3 ($+7DC480): +[bit] - flag + [bit] - ??? + [bit] - ??? -Index 27: -[L:BIT1] - flag - [L:4] - ??? - -Index 28: -[L:BIT1] - flag - [L:BIT1] - ??? - [L:BIT1] - ??? - -Index 29: +Index 4 ($+8A3A40): [EVAL:creation] - [L:BIT1] - flag - [L:8] - ???, could be "co" from xml data - [L:BIT1] - flag - [L:8] - ??? - [L:BIT1] - flag - [L:8] - ??? - [L:BIT1] - flag - [L:8] - ??? - [L:4] - hair color ("hc" from xml data), u32 - [L:4] - hair style ("hs" from xml data), u32 - [L:4] - ???, could be "hd" or "hdc" from xml data, u32 - [L:4] - shirt color ("t" from xml data), u32 - [L:4] - pants color ("l" from xml data), u32 - [L:4] - ???, could be "cd" from xml data, u32 - [L:4] - ???, could be "hdc" or "hd" from xml data, u32 - [L:4] - eyebrows style ("es" from xml data), u32 - [L:4] - eyes style ("ess" from xml data), u32 - [L:4] - mouth style ("ms" from xml data), u32 - [L:8] - accountID (in xml data and chardata packet), u64 - [L:8] - "llog" from xml data, u64 - [L:8] - ???, could be a couple of things from the xml data (since its 0 in the packet), u64 - [L:8] - lego score (from xml data), u64 - [L:BIT1] - flag that sets free2play mode for player (1 means player is free2play) - [L:8] - Total Amount of Currency Collected, u64 - [L:8] - Number of Bricks Collected, u64 - [L:8] - Number of smashables smashed, u64 - [L:8] - Number of Quick Builds Completed, u64 - [L:8] - Number of enemies smashed, u64 - [L:8] - Number of Rockets used, u64 - [L:8] - Number of missions completed, u64 - [L:8] - Number of Pets tamed, u64 - [L:8] - Number of Imagination power-ups collected, u64 - [L:8] - Number of Life Power-Ups Collected, u64 - [L:8] - Number of Armor power-ups collected, u64 - [L:8] - Total Distance Traveled (in meters), u64 - [L:8] - Number of times smashed, u64 - [L:8] - Total damage taken, u64 - [L:8] - Total damage Healed, u64 - [L:8] - Total Armor Repaired, u64 - [L:8] - Total Imagination Restored, u64 - [L:8] - Total Imagination used, u64 - [L:8] - Total Distance Driven (in meters), u64 - [L:8] - Total Time Airborne in a Race Car (in seconds), u64 - [L:8] - Number of Racing Imagination power-ups collected, u64 - [L:8] - Number of Racing Imagination Crates Smashed, u64 - [L:8] - Number of Times Race Car Boost Activated, u64 - [L:8] - Number of Wrecks in a Race Car, u64 - [L:8] - Number of Racing Smashables smashed, u64 - [L:8] - Number of Races finished, u64 - [L:8] - Number of 1st Place Race Finishes, u64 - [L:BIT1] - ???, originally a [L:BIT2], simplified for parsing - [L:BIT1] - ???, originally a [L:BIT2], simplified for parsing - [L:2] - count of characters - [L:2] - ???, seems to be a string in text lego data format, sample "1:9746;1:9747;1:9748;", wchar -[L:BIT1] - flag, assert == True - [L:BIT1] - flag?, assert == False - [L:BIT1] - ???, assert == False - [L:1] - ???, assert == 0 - [L:BIT1] - ???, assert == False - [L:1] - ???, assert == 0 -[L:BIT1] - flag, assert == True - [L:4] - ??? -[L:BIT1] - flag (this and below was in a separate function in the code), assert == True - [L:8] - ??? - [L:1] - ??? (count for next struct?) - [L:BIT1] - ??? - [L:4] - ??? + [bit] - flag + [u64] - ???, could be "co" from xml data + [bit] - flag + [u64] - ??? + [bit] - flag + [u64] - ??? + [bit] - flag + [u64] - ??? + [u32] - hair color ("hc" from xml data) + [u32] - hair style ("hs" from xml data) + [u32] - ???, could be "hd" or "hdc" from xml data + [u32] - shirt color ("t" from xml data) + [u32] - pants color ("l" from xml data) + [u32] - ???, could be "cd" from xml data + [u32] - ???, could be "hdc" or "hd" from xml data + [u32] - eyebrows style ("es" from xml data) + [u32] - eyes style ("ess" from xml data) + [u32] - mouth style ("ms" from xml data) + [u64] - accountID (in xml data and chardata packet) + [u64] - "llog" from xml data + [u64] - ??? + [u64] - lego score (from xml data) + [bit] - is player free to play + [u64] - Total Amount of Currency Collected + [u64] - Number of Bricks Collected + [u64] - Number of smashables smashed + [u64] - Number of Quick Builds Completed + [u64] - Number of enemies smashed + [u64] - Number of Rockets used + [u64] - Number of missions completed + [u64] - Number of Pets tamed + [u64] - Number of Imagination power-ups collected + [u64] - Number of Life Power-Ups Collected + [u64] - Number of Armor power-ups collected + [u64] - Total Distance Traveled (in meters) + [u64] - Number of times smashed + [u64] - Total damage taken + [u64] - Total damage Healed + [u64] - Total Armor Repaired + [u64] - Total Imagination Restored + [u64] - Total Imagination used + [u64] - Total Distance Driven (in meters) + [u64] - Total Time Airborne in a Race Car (in seconds) + [u64] - Number of Racing Imagination power-ups collected + [u64] - Number of Racing Imagination Crates Smashed + [u64] - Number of Times Race Car Boost Activated + [u64] - Number of Wrecks in a Race Car + [u64] - Number of Racing Smashables smashed + [u64] - Number of Races finished + [u64] - Number of 1st Place Race Finishes + [bit] - ??? + [bit] - ??? + [u16] - count of characters + [u16] - some LDF string? +[bit] - flag + [bit] - flag?, assert == False + [bit] - ???, assert == False + [u8] - ???, assert == 0 + [bit] - ???, assert == False + [u8] - ???, assert == 0 +[bit] - flag + [u32] - ??? +[bit] - flag (this and below was in a separate function in the code) + [s64] - ??? + [u8] - ??? (count for next struct?) + [bit] - ??? + [u32] - ??? diff --git a/packetdefinitions/replica/components/ControllablePhysics.structs b/packetdefinitions/replica/components/ControllablePhysics.structs index 636299f..8058ee2 100644 --- a/packetdefinitions/replica/components/ControllablePhysics.structs +++ b/packetdefinitions/replica/components/ControllablePhysics.structs @@ -1,52 +1,54 @@ +Component 1 - ControllablePhysics (tested using LOT 1) +Index 1 ($+845770): [EVAL:creation] - [L:BIT1] - flag - [L:4] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - flag - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? -[L:BIT1] - flag - [L:4] - ???, could be a float, float - [L:4] - ???, could be a float, float -[L:BIT1] - flag - [L:4] - ??? - [L:BIT1] - ??? -[L:BIT1] - flag - [L:BIT1] - flag - [L:4] - ??? - [L:BIT1] - ??? -[L:BIT1] - flag - [L:4] - pos x, float - [L:4] - pos y, float - [L:4] - pos z, float - [L:4] - rotation x, float - [L:4] - rotation y, float - [L:4] - rotation z, float - [L:4] - rotation w, float - [L:BIT1] - is on ground, bool - [L:BIT1] - ??? - [L:BIT1] - flag - [L:4] - velocity x, float - [L:4] - velocity y, float - [L:4] - velocity z, float - [L:BIT1] - flag - [L:4] - angular velocity x, float - [L:4] - angular velocity y, float - [L:4] - angular velocity z, float - [L:BIT1] - flag - [L:8] - ??? - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:BIT1] - flag - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float + [bit] - flag + [u32] - ??? + [bit] - ??? + [bit] - ??? + [bit] - flag + [u32] - ??? + [u32] - ??? + [u32] - ??? + [u32] - ??? + [u32] - ??? + [u32] - ??? + [u32] - ??? +[bit] - flag + [float] - ??? + [float] - ??? +[bit] - flag + [u32] - ??? + [bit] - ??? +[bit] - flag + [bit] - flag + [u32] - ??? + [bit] - ??? +[bit] - flag + [float] - position x + [float] - position y + [float] - position z + [float] - rotation x + [float] - rotation y + [float] - rotation z + [float] - rotation w + [bit] - is on ground + [bit] - ??? + [bit] - flag + [float] - velocity x + [float] - velocity y + [float] - velocity z + [bit] - flag + [float] - angular velocity x + [float] - angular velocity y + [float] - angular velocity z + [bit] - flag + [s64] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [bit] - flag + [float] - ??? + [float] - ??? + [float] - ??? [EVAL:not creation] - [L:BIT1] - flag? + [bit] - flag? diff --git a/packetdefinitions/replica/components/Destructible.structs b/packetdefinitions/replica/components/Destructible.structs index 7a442ab..9c482ac 100644 --- a/packetdefinitions/replica/components/Destructible.structs +++ b/packetdefinitions/replica/components/Destructible.structs @@ -1,77 +1,78 @@ -Index 22: +Component 7 - Destructible (tested using LOT 1) +Index 1 ($+939820): [EVAL:creation] - [L:BIT1] - flag, expect == False - [L:4] - ??? (seems to be a a count for following?) - [L:4] - ??? - [L:BIT1] - flag - [L:4] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - trigger=[L:BIT1] - ???, seems to trigger L:8 below? - [L:BIT1] - ??? - [EVAL:trigger] - seems to trigger this - [L:8] - ??? - [L:4] - ??? - [L:BIT1] - flag, expect == False - [L:4] - ??? (seems to be a a count for following?) - [L:4] - ??? - [L:BIT1] - flag - [L:4] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - [L:BIT1] - ??? - trigger=[L:BIT1] - ???, seems to trigger L:8 below? - [L:BIT1] - ??? - [EVAL:trigger] - seems to trigger this - [L:8] - ??? - [L:4] - ??? + [bit] - flag, expect == False + [u32] - count for following structs + [u32] - ??? + [bit] - flag + [u32] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + trigger=[bit] - ???, seems to trigger [s64] below? + [bit] - ??? + [EVAL:trigger] + [s64] - ??? + [u32] - ??? + [bit] - flag, expect == False + [u32] - count for following structs + [u32] - ??? + [bit] - flag + [u32] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + [bit] - ??? + trigger=[bit] - ???, seems to trigger [s64] below? + [bit] - ??? + [EVAL:trigger] + [s64] - ??? + [u32] - ??? -Index 23: +Index 2 ($+92BBD0): [EVAL:creation] - [L:BIT1] - flag - [L:4] - ???, assert == 0 - [L:4] - ???, assert == 0 - [L:4] - ??? - [L:4] - ??? - [L:4] - ???, assert == 0 - [L:4] - ???, assert == 0 - [L:4] - ???, assert == 0 - [L:4] - ???, assert == 0 - [L:4] - ??? -[L:BIT1] - flag - [L:4] - life - maxhealth=[L:4] - ???, has same number as max health struct, float, assert % 1 == 0 - [L:4] - armor - maxarmor=[L:4] - ???, has same number as max armor struct, float, assert % 1 == 0 - [L:4] - imagination, assert == 0 - maximag=[L:4] - ???, has same number as max imagination, float, assert % 1 == 0 - [L:4] - ???, assert == 0 - [L:BIT1] - ??? - [L:BIT1] - ???, assert == False - [L:BIT1] - ???, assert == False - [L:4] - max health, float, assert == maxhealth - [L:4] - max armor, float, assert == maxarmor - [L:4] - max imagination, float, assert == maximag - [L:4] - count for next struct - [L:4] - faction id - trigger=[L:BIT1] - flag + [bit] - flag + [u32] - ???, assert == 0 + [u32] - ???, assert == 0 + [u32] - ??? + [u32] - ??? + [u32] - ???, assert == 0 + [u32] - ???, assert == 0 + [u32] - ???, assert == 0 + [u32] - ???, assert == 0 + [u32] - ??? +[bit] - flag + [u32] - current health + maxhealth=[float] - ???, has same number as max health struct, assert % 1 == 0 + [u32] - current armor + maxarmor=[float] - has same number as max armor struct, assert % 1 == 0 + [u32] - current imagination + maximag=[float] - ???, has same number as max imagination, assert % 1 == 0 + [u32] - ???, assert == 0 + [bit] - ??? + [bit] - ???, assert == False + [bit] - ???, assert == False + [float] - max health, assert == maxhealth + [float] - max armor, assert == maxarmor + [float] - max imagination, assert == maximag + [u32] - count + [s32] - faction id + trigger=[bit] - flag [EVAL:creation] - [L:BIT1] - flag, assert == False - [L:BIT1] - flag, assert == False + [bit] - flag, assert == False + [bit] - flag, assert == False [EVAL:trigger] - [L:BIT1] - ???, assert == False - [L:BIT1] - flag - [L:4] - ??? -[L:BIT1] - flag - [L:BIT1] - ??? + [bit] - ???, assert == False + [bit] - flag + [u32] - ??? +[bit] - flag + [bit] - ??? diff --git a/packetdefinitions/replica/components/Index36.structs b/packetdefinitions/replica/components/Index36.structs index bd78db8..01cebfc 100644 --- a/packetdefinitions/replica/components/Index36.structs +++ b/packetdefinitions/replica/components/Index36.structs @@ -1,3 +1,4 @@ -Index 36: -[L:BIT1] - flag, assert == True - [L:8] - ??? +Component 107 - Unknown (tested using LOT 1) +Index 1 ($+7D6690): +[bit] - flag + [s64] - ??? diff --git a/packetdefinitions/replica/components/Inventory.structs b/packetdefinitions/replica/components/Inventory.structs index 203fb7a..dd07a89 100644 --- a/packetdefinitions/replica/components/Inventory.structs +++ b/packetdefinitions/replica/components/Inventory.structs @@ -1,20 +1,20 @@ - -Index 30: -[L:BIT1] - flag - [L:4] - # of items equipped, u32, assert > -1 and < 9 - [L:8] - objectID of item, s64 - [L:4] - LOT of item, s32 - [L:BIT1] - flag - [L:8] - ??? - [L:BIT1] - flag - [L:4] - ???, assert == 1 - [L:BIT1] - flag - [L:2] - slot in inventory - [L:BIT1] - flag - [L:4] - ???, expect == 4 - [L:BIT1] - flag - [L:4] - length of following structure - [L:1] - 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 -[L:BIT1] - flag, assert == True - [L:4] - ???, assert == 0 +Component 17 - Inventory (tested using LOT 1) +Index 1 ($+952860): +[bit] - flag + [u32] - # of items equipped, assert > -1 and < 9 + [s64] - objectID of item + [s32] - LOT of item + [bit] - flag + [s64] - ??? + [bit] - flag + [u32] - ???, assert == 1 + [bit] - flag + [u16] - slot in inventory + [bit] - flag + [u32] - ???, expect == 4 + [bit] - flag + [u32] - length of following structure + [u8] - compressed data + [bit] - ??? (perhaps a flag that specifies if the item gets loaded or if data needs to be retrieved from the cdclient database?), expect == True +[bit] - flag + [u32] - ???, assert == 0 diff --git a/packetdefinitions/replica/components/Item.structs b/packetdefinitions/replica/components/Item.structs index ecce756..f2b7fc6 100644 --- a/packetdefinitions/replica/components/Item.structs +++ b/packetdefinitions/replica/components/Item.structs @@ -1,9 +1,9 @@ Component 11 - Item (tested using LOT 16380) Index 1 ($+81B2D0): -[L:BIT1] - flag - [L:8] - ??? - [L:4] - ??? - [L:BIT1] - flag, assert == False +[bit] - flag + [s64] - ??? + [u32] - ??? + [bit] - flag, assert == False not sure about this - [L:4] - ??? - [L:1] - ??? + [u32] - ??? + [u8] - ??? diff --git a/packetdefinitions/replica/components/Pet.structs b/packetdefinitions/replica/components/Pet.structs index 6cfd74c..478fb4e 100644 --- a/packetdefinitions/replica/components/Pet.structs +++ b/packetdefinitions/replica/components/Pet.structs @@ -1,15 +1,15 @@ Component 26 - Pet (tested using LOT 3995) Index 1 ($+8D1270): -[L:BIT1] - flag - [L:4] - ??? - [L:4] - ??? - [L:BIT1] - flag - [L:8] - ??? - [L:BIT1] - flag - [L:8] - ??? - [L:BIT1] - flag - [L:4] - ??? - [L:1] - length - [L:2] - ??? - [L:1] - length - [L:2] - ??? +[bit] - flag + [u32] - ??? + [u32] - ??? + [bit] - flag + [s64] - ??? + [bit] - flag + [s64] - ??? + [bit] - flag + [u32] - ??? + [u8] - length + [u16] - ??? + [u8] - length + [u16] - ??? diff --git a/packetdefinitions/replica/components/PhantomPhysics.structs b/packetdefinitions/replica/components/PhantomPhysics.structs index 20a11d9..d039b35 100644 --- a/packetdefinitions/replica/components/PhantomPhysics.structs +++ b/packetdefinitions/replica/components/PhantomPhysics.structs @@ -1,21 +1,21 @@ Component 40 - PhantomPhysics (tested using LOT 4940) Index 1 ($+834DB0): -[L:BIT1] - flag - [L:4] - position x, float - [L:4] - position y, float - [L:4] - position z, float - [L:4] - rotation x, float - [L:4] - rotation y, float - [L:4] - rotation z, float - [L:4] - rotation w, float -[L:BIT1] - flag, assert == True - [L:BIT1] - flag, expect == False - [L:4] - ??? - [L:4] - ???, float - [L:BIT1] - flag - [L:4] - ??? - [L:4] - ??? - [L:BIT1] - flag - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float +[bit] - flag + [float] - position x + [float] - position y + [float] - position z + [float] - rotation x + [float] - rotation y + [float] - rotation z + [float] - rotation w +[bit] - flag, assert == True + [bit] - flag, expect == False + [u32] - ??? + [float] - ??? + [bit] - flag + [u32] - ??? + [u32] - ??? + [bit] - flag + [float] - ??? + [float] - ??? + [float] - ??? diff --git a/packetdefinitions/replica/components/Render.structs b/packetdefinitions/replica/components/Render.structs index 5e4e081..ee41cac 100644 --- a/packetdefinitions/replica/components/Render.structs +++ b/packetdefinitions/replica/components/Render.structs @@ -1,10 +1,11 @@ -Index 32: +Component 2 - Render (tested using LOT 1) +Index 1 ($+840310): [EVAL:creation] - [L:4] - 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 - [L:1] - char, char - [L:4] - effectID, i32 - [L:1] - effectType, string length (# of letters), u8 - [L:2] - wchar, wchar - [L:4] - ???, float - [L:8] - ??? + [u32] - number of BehaviorEffects? (see BehaviorEffect table in cdclient), if this is -1 the client logs "Bad FX Unserialize", expect != -1 + [u8] - length + [u8] - effectID string + [u32] - effectID + [u8] - length + [u16] - effectType + [float] - ??? + [s64] - ??? diff --git a/packetdefinitions/replica/components/Script.structs b/packetdefinitions/replica/components/Script.structs index f0e8385..bc4d7b4 100644 --- a/packetdefinitions/replica/components/Script.structs +++ b/packetdefinitions/replica/components/Script.structs @@ -1,6 +1,6 @@ Component 5 - Script (tested using LOT 3495) Index 1 ($+87CDF0): [EVAL:creation] - [L:BIT1] - flag - [L:4] - size of following struct - [L:1] - compressed data, x bytes according to prev struct, u8 + [bit] - flag + [u32] - size of following struct + [u8] - compressed data, x bytes according to prev struct diff --git a/packetdefinitions/replica/components/ScriptedActivity.structs b/packetdefinitions/replica/components/ScriptedActivity.structs index 0e5f60b..da42b1d 100644 --- a/packetdefinitions/replica/components/ScriptedActivity.structs +++ b/packetdefinitions/replica/components/ScriptedActivity.structs @@ -1,16 +1,16 @@ Component 39 - ScriptedActivity (tested using LOT 11165) Index 1 ($+9002B0): -[L:BIT1] - flag - [L:4] - length - [L:8] - ??? - constant size 10 loop - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float +[bit] - flag + [u32] - length + [u64] - ??? + constant size 10 loop + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? diff --git a/packetdefinitions/replica/components/SimplePhysics.structs b/packetdefinitions/replica/components/SimplePhysics.structs index fc3b3a5..cc722df 100644 --- a/packetdefinitions/replica/components/SimplePhysics.structs +++ b/packetdefinitions/replica/components/SimplePhysics.structs @@ -1,22 +1,22 @@ Component 3 - SimplePhysics (tested using LOT 7701) Index 1 ($+7E4B00): [EVAL:creation] - [L:BIT1] - ??? - [L:4] - ???, float -[L:BIT1] - flag - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float - [L:4] - ???, float -[L:BIT1] - flag - [L:4] - ???, assert == 5 -[L:BIT1] - flag - [L:4] - position x, float - [L:4] - position y, float - [L:4] - position z, float - [L:4] - rotation x, float - [L:4] - rotation y, float - [L:4] - rotation z, float - [L:4] - rotation w, float + [bit] - ??? + [float] - ??? +[bit] - flag + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? + [float] - ??? +[bit] - flag + [u32] - ???, assert == 5 +[bit] - flag + [float] - position x + [float] - position y + [float] - position z + [float] - rotation x + [float] - rotation y + [float] - rotation z + [float] - rotation w diff --git a/packetdefinitions/replica/components/Skill.structs b/packetdefinitions/replica/components/Skill.structs index 9efe2e0..f8ef838 100644 --- a/packetdefinitions/replica/components/Skill.structs +++ b/packetdefinitions/replica/components/Skill.structs @@ -1,22 +1,21 @@ -Index 31: -// component_type 9? -// Seems to be related to BehaviorTemplate +Component 9 - Skill (tested using LOT 1) +Index 1 ($+806270): [EVAL:creation] - [L:BIT1] - flag - [L:4] - count for following structs - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? - [L:4] - ??? - [L:4] - count for following structs - [L:4] - ??? - [L:4] - ???, seems to be something in BehaviorTemplate? - [L:4] - ??? - [L:4] - ???, expect == 18 - [L:8] - ??? - [L:8] - ??? - [L:8] - ???, expect == 0 - [L:BIT1] - ???, assert == False - [L:4] - ???, expect == 0 - [L:4] - ???, expect == 0 - [L:4] - ???, expect == 0 + [bit] - flag + [u32] - count for following structs + [u32] - ??? + [u32] - ??? + [u32] - ??? + [u32] - ??? + [u32] - count for following structs + [u32] - ??? + [u32] - ???, seems to be something in BehaviorTemplate? + [u32] - ??? + [u32] - ???, expect == 18 + [s64] - ??? + [s64] - ??? + [s64] - ???, expect == 0 + [bit] - ???, assert == False + [u32] - ???, expect == 0 + [u32] - ???, expect == 0 + [u32] - ???, expect == 0 diff --git a/packetdefinitions/replica/components/Switch.structs b/packetdefinitions/replica/components/Switch.structs index dcb12be..362f5f4 100644 --- a/packetdefinitions/replica/components/Switch.structs +++ b/packetdefinitions/replica/components/Switch.structs @@ -1,3 +1,3 @@ Component 49 - Switch (tested using LOT 16143) 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) diff --git a/packetdefinitions/replica/components/Vendor.structs b/packetdefinitions/replica/components/Vendor.structs index fc8dd7e..a395d52 100644 --- a/packetdefinitions/replica/components/Vendor.structs +++ b/packetdefinitions/replica/components/Vendor.structs @@ -1,5 +1,5 @@ Component 16 - Vendor (tested using LOT 8212) Index 1 ($+7E1CB0): -[L:BIT1] - flag - [L:BIT1] - ??? - [L:BIT1] - ??? +[bit] - flag + [bit] - ??? + [bit] - ??? diff --git a/packetdefinitions/replica/creation_header.structs b/packetdefinitions/replica/creation_header.structs index 71664e1..7fb30d2 100644 --- a/packetdefinitions/replica/creation_header.structs +++ b/packetdefinitions/replica/creation_header.structs @@ -1,22 +1,22 @@ -[L:1] - Replica packet ID, assert == 0x24 -[L:BIT1] - Whether NetworkID is there, assert == 1 - [L:2] - NetworkID, u16 -objectID=[L:8] - objectID, s64 -[L:4] - LOT, s32 -[L:1] - length, u8 - [L:2] - name, wchar -[L:4] - time_since_created_on_server? -[L:BIT1] - flag, expect == False - [L:4] - size of following struct - [L:1] - compressed data, x bytes according to prev struct, u8 -[L:BIT1] - trigger_id, expect == False -[L:BIT1] - flag - [L:8] - SpawnerID, s64 -[L:BIT1] - flag - [L:4] - spawner_node_id, expect == 0 -[L:BIT1] - flag - [L:4] - ???, float -[L:BIT1] - flag, assert == False - [L:1] - objectWorldState? -[L:BIT1] - flag, assert == False - [L:1] - ??? +[u8] - Replica packet ID, assert == 0x24 +[bit] - Whether NetworkID is there, assert == 1 + [u16] - NetworkID +objectID=[s64] - objectID +[s32] - LOT +[u8] - length + [u16] - name +[u32] - time_since_created_on_server? +[bit] - flag, expect == False + [u32] - size of following struct + [u8] - compressed data, x bytes according to prev struct +[bit] - trigger_id, expect == False +[bit] - flag + [s64] - spawner object ID +[bit] - flag + [u32] - spawner_node_id, expect == 0 +[bit] - flag + [float] - ??? +[bit] - flag, assert == False + [u8] - objectWorldState? +[bit] - flag, assert == False + [u8] - gmlevel? diff --git a/packetdefinitions/replica/serialization_header.structs b/packetdefinitions/replica/serialization_header.structs index 3041702..561cad8 100644 --- a/packetdefinitions/replica/serialization_header.structs +++ b/packetdefinitions/replica/serialization_header.structs @@ -1,7 +1,7 @@ -[L:BIT1] - flag - [L:BIT1] - flag, expect == False - [L:8] - ??? - [L:BIT1] - ??? - [L:BIT1] - flag, expect == False - [L:2] - ??? (if > 0 read next block n times?) - [L:8] - ??? +[bit] - flag + [bit] - flag, expect == False + [s64] - ??? + [bit] - ??? + [bit] - flag, expect == False + [u16] - ??? (if > 0 read next block n times?) + [u64] - ??? diff --git a/structparser.py b/structparser.py index bdc48e0..b5abaf0 100644 --- a/structparser.py +++ b/structparser.py @@ -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 VAR_CHARS = r"[^ \t\[\]]+" -BIT = r"(BIT[0-7])?" -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} +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} TYPES_RE = "("+"|".join(BITSTREAM_TYPES.keys())+")" DEFINITION_SYNTAX = re.compile(r"""^ (?P\t*) # Indentation ((?P"""+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
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[0-9]*"""+BIT+r""")) # The length of the struct, in decimal - ) - | + \[( (EVAL:(?P.+)) # Expression to be evaluated, evaluated value acts like struct value, usually used for variables - )\] # End of struct information + | + (?P"""+TYPES_RE+r""") # Struct type + )\] (\ -\ (?P.*?) # Description for the struct - (,\ (?P"""+TYPES_RE+r"""))? # Struct type (,\ expect\ (?P(.+?)))? # 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 the value to be like this expression, will raise AssertionError if not True. )?$ """, 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")) class StructParser: @@ -100,57 +95,12 @@ class StructParser: @staticmethod 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: eval_ = compile(def_["eval"], "", "eval") type_ = None else: eval_ = None - if def_["type"] is not None: - 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) + type_ = BITSTREAM_TYPES[def_["type"]] if def_["expect"] is not None: expects = [compile("value "+i, "", "eval") for i in def_["expect"].split(" and ")] @@ -161,7 +111,7 @@ class StructParser: else: 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): for _ in range(repeat_times): @@ -169,17 +119,7 @@ class StructParser: if def_.eval is not None: value = self._eval(def_.eval) else: - if def_.address != None: - 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) + value = stream.read(def_.type) if def_.expects: for expression in def_.expects: