From d8fe5124ffe29c018792b3e5aaac9ffcadc79c59 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 29 Aug 2016 19:23:40 -0400 Subject: [PATCH] Fix some spell set loading issues --- common/patches/sod.cpp | 4 +++- common/patches/sof.cpp | 15 +++++++++++++++ common/patches/sof_ops.h | 1 + common/patches/sof_structs.h | 5 +++++ common/patches/titanium.cpp | 15 +++++++++++++++ common/patches/titanium_ops.h | 1 + common/patches/titanium_structs.h | 5 +++++ common/patches/uf_structs.h | 7 +++---- 8 files changed, 48 insertions(+), 5 deletions(-) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index e23c1ca78..c1d573020 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3246,8 +3246,10 @@ namespace SoD DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (uint32 i = 0; i < MAX_PP_MEMSPELL; ++i) + for (int i = 0; i < structs::MAX_PP_MEMSPELL; ++i) emu->spell[i] = eq->spell[i]; + for (int i = structs::MAX_PP_MEMSPELL; i < MAX_PP_MEMSPELL; ++i) + emu->spell[i] = 0xFFFFFFFF; FINISH_DIRECT_DECODE(); } diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 3ab4a7631..bfad8d296 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2623,6 +2623,21 @@ namespace SoF FINISH_DIRECT_DECODE(); } + DECODE(OP_LoadSpellSet) + { + DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); + SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); + + for (int i = 0; i < structs::MAX_PP_MEMSPELL; ++i) + IN(spell[i]); + for (int i = structs::MAX_PP_MEMSPELL; i < MAX_PP_MEMSPELL; ++i) + emu->spell[i] = 0xFFFFFFFF; + + IN(unknown); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_LootItem) { DECODE_LENGTH_EXACT(structs::LootingItem_Struct); diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index 68ff402f1..180857388 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -111,6 +111,7 @@ D(OP_GroupFollow2) D(OP_InspectRequest) D(OP_ItemLinkClick) D(OP_ItemVerifyRequest) +D(OP_LoadSpellSet) D(OP_LootItem) D(OP_MoveItem) D(OP_PetCommands) diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 3c0861f42..0981fd4ee 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -3728,6 +3728,11 @@ struct AnnoyingZoneUnknown_Struct { uint32 value; //always 4 }; +struct LoadSpellSet_Struct { + uint32 spell[MAX_PP_MEMSPELL]; + uint32 unknown; +}; + struct BlockedBuffs_Struct { /*000*/ uint8 unknown000[80]; /*080*/ uint8 unknown081; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 9e93051b1..72b492eeb 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1978,6 +1978,21 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_LoadSpellSet) + { + DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); + SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); + + for (int i = 0; i < structs::MAX_PP_MEMSPELL; ++i) + IN(spell[i]); + for (int i = structs::MAX_PP_MEMSPELL; i < MAX_PP_MEMSPELL; ++i) + emu->spell[i] = 0xFFFFFFFF; + + IN(unknown); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_LootItem) { DECODE_LENGTH_EXACT(structs::LootingItem_Struct); diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index 5e65dd7c0..9f77a7077 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -89,6 +89,7 @@ D(OP_InspectAnswer) D(OP_InspectRequest) D(OP_ItemLinkClick) D(OP_LFGuild) +D(OP_LoadSpellSet) D(OP_LootItem) D(OP_MoveItem) D(OP_PetCommands) diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index c6a5e6a49..c4f6d4959 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -3228,6 +3228,11 @@ struct AnnoyingZoneUnknown_Struct { uint32 value; //always 4 }; +struct LoadSpellSet_Struct { + uint32 spell[MAX_PP_MEMSPELL]; + uint32 unknown; +}; + struct ApplyPoison_Struct { uint32 inventorySlot; uint32 success; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 1ba5616dd..8decaa04a 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -847,7 +847,7 @@ struct BindStruct { */ static const uint32 MAX_PP_LANGUAGE = 25; // static const uint32 MAX_PP_SPELLBOOK = 720; // Confirmed 60 pages on Underfoot now -static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Underfoot +static const uint32 MAX_PP_MEMSPELL = 12; //was 9 now 10 on Underfoot static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 static const uint32 MAX_GROUP_MEMBERS = 6; @@ -917,7 +917,7 @@ struct PlayerProfile_Struct /*00160*/ uint32 deity; // deity /*00164*/ uint32 intoxication; // Alcohol level (in ticks till sober?) /*00168*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; // Refresh time (millis) - 4 Octets Each -/*00208*/ uint8 unknown00208[14]; // Seen 00 00 00 00 00 00 00 00 00 00 00 00 02 01 +/*00208*/ uint8 unknown00208[6]; // Seen 00 00 00 00 00 00 00 00 00 00 00 00 02 01 /*00222*/ uint32 abilitySlotRefresh; /*00226*/ uint8 haircolor; // Player hair color /*00227*/ uint8 beardcolor; // Player beard color @@ -945,7 +945,7 @@ struct PlayerProfile_Struct /*04217*/ uint8 unknown04217[147]; // was [175] /*04364*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 720 = 90 pages [2880] was [1920] /*07244*/ uint32 mem_spells[MAX_PP_MEMSPELL]; // List of spells memorized -/*07284*/ uint8 unknown07284[28]; //#### uint8 unknown04396[32]; in Titanium ####[28] +/*07284*/ uint8 unknown07284[20]; //#### uint8 unknown04396[32]; in Titanium ####[28] /*07312*/ uint32 platinum; // Platinum Pieces on player /*07316*/ uint32 gold; // Gold Pieces on player /*07320*/ uint32 silver; // Silver Pieces on player @@ -3928,7 +3928,6 @@ struct AnnoyingZoneUnknown_Struct { struct LoadSpellSet_Struct { uint8 spell[MAX_PP_MEMSPELL]; // 0 if no action - uint16 unknown2; // is this two more spell gems? uint32 unknown; // there seems to be an extra field in this packet... };