diff --git a/common/patches/laurion.cpp b/common/patches/laurion.cpp index ba9ecb2c9..f51c4f051 100644 --- a/common/patches/laurion.cpp +++ b/common/patches/laurion.cpp @@ -2938,6 +2938,7 @@ namespace Laurion ENCODE(OP_BeginCast) { + ENCODE_LENGTH_EXACT(BeginCast_Struct); SETUP_DIRECT_ENCODE(BeginCast_Struct, structs::BeginCast_Struct); OUT(spell_id); @@ -3034,6 +3035,19 @@ namespace Laurion } } + ENCODE(OP_ManaChange) { + ENCODE_LENGTH_EXACT(ManaChange_Struct); + SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct); + + OUT(new_mana); + OUT(stamina); + OUT(spell_id); + OUT(keepcasting); + OUT(slot); + + FINISH_ENCODE(); + } + // DECODE methods DECODE(OP_EnterWorld) @@ -3238,14 +3252,13 @@ namespace Laurion SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); emu->slot = static_cast(LaurionToServerCastingSlot(static_cast(eq->slot))); - - //We need to figure out the x y z position stuff + IN(spell_id); - emu->inventoryslot = LaurionToServerSlot(eq->inventory_slot); + emu->inventoryslot = -1; IN(target_id); - //IN(y_pos); - //IN(x_pos); - //IN(z_pos); + IN(y_pos); + IN(x_pos); + IN(z_pos); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/laurion_ops.h b/common/patches/laurion_ops.h index 04dbe7ba0..979b8f673 100644 --- a/common/patches/laurion_ops.h +++ b/common/patches/laurion_ops.h @@ -38,6 +38,7 @@ E(OP_ShopRequest) E(OP_BeginCast) E(OP_BuffCreate) E(OP_Buff) +E(OP_ManaChange) //list of packets we need to decode on the way in: D(OP_EnterWorld) D(OP_ZoneEntry) diff --git a/common/patches/laurion_structs.h b/common/patches/laurion_structs.h index 39530e101..0f1d1c00d 100644 --- a/common/patches/laurion_structs.h +++ b/common/patches/laurion_structs.h @@ -631,14 +631,29 @@ namespace Laurion { /*015*/ }; + //I've observed 5 s16 that are all -1. + //Clicky items don't even trigger this as far as i can tell so not sure what this is for now. + //One of these could have changed to a s32 but im not sure. + struct CastSpellInventorySlot_Struct { + /*00*/ int16 type; + /*02*/ int16 slot; + /*04*/ int16 sub_index; + /*06*/ int16 aug_index; + /*08*/ int16 unknown1; + /*10*/ + }; + struct CastSpell_Struct { /*00*/ uint32 slot; /*04*/ uint32 spell_id; - /*08*/ InventorySlot_Struct inventory_slot; // slot for clicky item, Seen unknown of 131 = normal cast - /*20*/ uint32 spell_crc; // this is pinstSpellManager_x->SpellsCrc[spell_id] - /*24*/ uint32 target_id; - /*28*/ uint8 unknown2[11]; + /*08*/ CastSpellInventorySlot_Struct inventory_slot; + /*18*/ uint32 target_id; + /*22*/ uint32 spell_crc; + /*26*/ float y_pos; + /*30*/ float x_pos; + /*34*/ float z_pos; + /*38*/ uint8 unknown; //not sure, might also be before y_pos; only ever seen zero for both but should be easy to figure out later /*39*/ }; @@ -680,6 +695,15 @@ namespace Laurion { /*168*/ }; + struct ManaChange_Struct + { + uint32 new_mana; + uint32 stamina; + uint32 spell_id; + uint32 keepcasting; + int32 slot; + }; + #pragma pack() }; //end namespace structs