diff --git a/changelog.txt b/changelog.txt index 52e6b59de..60330e137 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 1/20/2019 == +Uleat: Added 'spells' entry to EQDictionary + == 1/15/2019 == Uleat: Activated per-expansion support for active inventory slot addressing - Server honors expansions that alter bank size and power source, general9 and general10 slots diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index 0e6c40a6f..9850dfac1 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -217,7 +217,7 @@ namespace Convert { /*0245*/ uint8 guildbanker; /*0246*/ uint8 unknown0246[6]; // /*0252*/ uint32 intoxication; - /*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms + /*0256*/ uint32 spellSlotRefresh[9]; //in ms /*0292*/ uint32 abilitySlotRefresh; /*0296*/ uint8 haircolor; // Player hair color /*0297*/ uint8 beardcolor; // Player beard color @@ -256,9 +256,9 @@ namespace Convert { /*2505*/ uint8 unknown2541[47]; // ? /*2552*/ uint8 languages[MAX_PP_LANGUAGE]; /*2580*/ uint8 unknown2616[4]; - /*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK]; + /*2584*/ uint32 spell_book[480]; /*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff - /*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL]; + /*4632*/ uint32 mem_spells[9]; /*4668*/ uint8 unknown4704[32]; // /*4700*/ float y; // Player y position /*4704*/ float x; // Player x position @@ -1360,7 +1360,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Spell Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){ + for (i = 0; i < 480; i++){ if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){ if (first_entry != 1){ rquery = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->spell_book[i]); @@ -1372,7 +1372,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Max Memmed Spell Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){ + for (i = 0; i < 9; i++){ if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535 && pp->mem_spells[i] != 4294967295){ if (first_entry != 1){ rquery = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->mem_spells[i]); diff --git a/common/emu_constants.h b/common/emu_constants.h index 805bc6516..9e265753a 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -228,6 +228,34 @@ namespace EQEmu } // namespace behavior + namespace spells { + enum class CastingSlot : uint32 { // hybrid declaration + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + Gem10 = 9, + Gem11 = 10, + Gem12 = 11, + MaxGems = 12, + Ability = 20, // HT/LoH for Tit + PotionBelt = 21, // Tit uses a different slot for PB + Item = 22, + Discipline = 23, + AltAbility = 0xFF + }; + + using RoF2::spells::SPELL_ID_MAX; + using SoD::spells::SPELLBOOK_SIZE; + using UF::spells::SPELL_GEM_COUNT; // RoF+ clients define more than UF client..but, they are not valid beyond UF + + } // namespace spells + namespace bug { enum CategoryID : uint32 { catOther = 0, @@ -259,27 +287,6 @@ namespace EQEmu } // namespace bug - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Gem10 = 9, - Gem11 = 10, - Gem12 = 11, - MaxGems = 12, - Ability = 20, // HT/LoH for Tit - PotionBelt = 21, // Tit uses a different slot for PB - Item = 22, - Discipline = 23, - AltAbility = 0xFF - }; - } /*EQEmu*/ #endif /*COMMON_EMU_CONSTANTS_H*/ diff --git a/common/eq_limits.cpp b/common/eq_limits.cpp index d7863fcb9..09ba6712a 100644 --- a/common/eq_limits.cpp +++ b/common/eq_limits.cpp @@ -32,6 +32,7 @@ void EQEmu::InitializeDynamicLookups() { constants::InitializeDynamicLookups(); inventory::InitializeDynamicLookups(); behavior::InitializeDynamicLookups(); + spells::InitializeDynamicLookups(); global_dictionary_init = true; } @@ -1125,3 +1126,92 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::StaticLookup(versions::MobV { return &behavior_static_lookup_entries[static_cast(versions::ValidateMobVersion(mob_version))]; } + +static std::unique_ptr spells_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount]; +static std::unique_ptr spells_dynamic_lookup_entries[EQEmu::versions::ClientVersionCount]; +static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::versions::ClientVersionCount] = +{ + /*[ClientVersion::Unknown] =*/ + EQEmu::spells::LookupEntry( + ClientUnknown::INULL, + ClientUnknown::INULL, + ClientUnknown::INULL + ), + /*[ClientVersion::Client62] =*/ + EQEmu::spells::LookupEntry( + Client62::INULL, + Client62::INULL, + Client62::INULL + ), + /*[ClientVersion::Titanium] =*/ + EQEmu::spells::LookupEntry( + Titanium::spells::SPELL_ID_MAX, + Titanium::spells::SPELLBOOK_SIZE, + Titanium::spells::SPELL_GEM_COUNT + ), + /*[ClientVersion::SoF] =*/ + EQEmu::spells::LookupEntry( + SoF::spells::SPELL_ID_MAX, + SoF::spells::SPELLBOOK_SIZE, + SoF::spells::SPELL_GEM_COUNT + ), + /*[ClientVersion::SoD] =*/ + EQEmu::spells::LookupEntry( + SoD::spells::SPELL_ID_MAX, + SoD::spells::SPELLBOOK_SIZE, + SoD::spells::SPELL_GEM_COUNT + ), + /*[ClientVersion::UF] =*/ + EQEmu::spells::LookupEntry( + UF::spells::SPELL_ID_MAX, + SoD::spells::SPELLBOOK_SIZE, + UF::spells::SPELL_GEM_COUNT + ), + /*[ClientVersion::RoF] =*/ + EQEmu::spells::LookupEntry( + RoF::spells::SPELL_ID_MAX, + SoD::spells::SPELLBOOK_SIZE, + UF::spells::SPELL_GEM_COUNT // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case + ), + /*[ClientVersion::RoF2] =*/ + EQEmu::spells::LookupEntry( + RoF2::spells::SPELL_ID_MAX, + SoD::spells::SPELLBOOK_SIZE, + UF::spells::SPELL_GEM_COUNT // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case + ) +}; + +static bool spells_dictionary_init = false; +void EQEmu::spells::InitializeDynamicLookups() { + if (spells_dictionary_init == true) + return; + spells_dictionary_init = true; + + if (RuleB(World, UseClientBasedExpansionSettings)) + return; + + // use static references for now +} + +const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicGMLookup(versions::ClientVersion client_version) +{ + client_version = versions::ValidateClientVersion(client_version); + if (spells_dynamic_gm_lookup_entries[static_cast(client_version)]) + return spells_dynamic_gm_lookup_entries[static_cast(client_version)].get(); + + return &spells_static_lookup_entries[static_cast(client_version)]; +} + +const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicLookup(versions::ClientVersion client_version) +{ + client_version = versions::ValidateClientVersion(client_version); + if (spells_dynamic_lookup_entries[static_cast(client_version)]) + return spells_dynamic_lookup_entries[static_cast(client_version)].get(); + + return &spells_static_lookup_entries[static_cast(client_version)]; +} + +const EQEmu::spells::LookupEntry* EQEmu::spells::StaticLookup(versions::ClientVersion client_version) +{ + return &spells_static_lookup_entries[static_cast(versions::ValidateClientVersion(client_version))]; +} diff --git a/common/eq_limits.h b/common/eq_limits.h index 5a37917cc..c27bc1eb8 100644 --- a/common/eq_limits.h +++ b/common/eq_limits.h @@ -93,7 +93,7 @@ namespace EQEmu // note: 'PossessionsBitmask' needs to be attuned to the client version with the highest number // of possessions slots and 'InventoryTypeSize[typePossessions]' should reflect the same count // with translators adjusting for valid slot indices. Server-side validations will be performed - // against 'PossessionsBitmask' (note: the same applies to Corpse type size and bitmask) + // against 'PossessionsBitmask' (note: the same applies to CorpseBitmask..size is not dependent) struct InventoryTypeSize_Struct { // should reflect count and naming conventions referenced in emu_constants.h int16 Possessions, Bank, SharedBank; @@ -205,6 +205,32 @@ namespace EQEmu } /*behavior*/ + namespace spells { + struct LookupEntry { + int SpellIdMax; + int SpellbookSize; + int SpellGemCount; + + LookupEntry(const LookupEntry *lookup_entry) { } + LookupEntry( + int SpellIdMax, + int SpellbookSize, + int SpellGemCount + ) : + SpellIdMax(SpellIdMax), + SpellbookSize(SpellbookSize), + SpellGemCount(SpellGemCount) + { } + }; + + void InitializeDynamicLookups(); + + const LookupEntry* DynamicGMLookup(versions::ClientVersion client_version); + const LookupEntry* DynamicLookup(versions::ClientVersion client_version); + const LookupEntry* StaticLookup(versions::ClientVersion client_version); + + } /*spells*/ + } /*EQEmu*/ namespace ClientUnknown diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 5ae2c1a93..8e0d4d0d1 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -852,10 +852,6 @@ struct SuspendedMinion_Struct ** OpCode: 0x006a */ static const uint32 MAX_PP_LANGUAGE = 28; -static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions -static const uint32 MAX_PP_MEMSPELL = static_cast(EQEmu::CastingSlot::MaxGems); // Set to latest client so functions can work right -- 12 -static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain -static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_INNATE_SKILL = 25; @@ -935,7 +931,7 @@ struct PlayerProfile_Struct /*0245*/ uint8 guildbanker; /*0246*/ uint8 unknown0246[6]; // /*0252*/ uint32 intoxication; -/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms +/*0256*/ uint32 spellSlotRefresh[EQEmu::spells::SPELL_GEM_COUNT]; //in ms /*0292*/ uint32 abilitySlotRefresh; /*0296*/ uint8 haircolor; // Player hair color /*0297*/ uint8 beardcolor; // Player beard color @@ -974,9 +970,9 @@ struct PlayerProfile_Struct /*2505*/ uint8 unknown2541[47]; // ? /*2552*/ uint8 languages[MAX_PP_LANGUAGE]; /*2580*/ uint8 unknown2616[4]; -/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK]; +/*2584*/ uint32 spell_book[EQEmu::spells::SPELLBOOK_SIZE]; /*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff -/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL]; +/*4632*/ uint32 mem_spells[EQEmu::spells::SPELL_GEM_COUNT]; /*4668*/ uint8 unknown4704[32]; // /*4700*/ float y; // Player y position /*4704*/ float x; // Player x position @@ -4373,7 +4369,7 @@ struct AnnoyingZoneUnknown_Struct { }; struct LoadSpellSet_Struct { - uint32 spell[MAX_PP_MEMSPELL]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 + uint32 spell[EQEmu::spells::SPELL_GEM_COUNT]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 uint32 unknown; //there seems to be an extra field in this packet... }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 8d9f5f641..a539282bf 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -65,8 +65,8 @@ namespace RoF // client to server say link converter static inline void RoFToServerSayLink(std::string& serverSayLink, const std::string& rofSayLink); - static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot); - static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot); + static inline spells::CastingSlot ServerToRoFCastingSlot(EQEmu::spells::CastingSlot slot); + static inline EQEmu::spells::CastingSlot RoFToServerCastingSlot(spells::CastingSlot slot); static inline int ServerToRoFBuffSlot(int index); static inline int RoFToServerBuffSlot(int index); @@ -502,7 +502,7 @@ namespace RoF ENCODE_LENGTH_EXACT(CastSpell_Struct); SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct); - eq->slot = static_cast(ServerToRoFCastingSlot(static_cast(emu->slot))); + eq->slot = static_cast(ServerToRoFCastingSlot(static_cast(emu->slot))); OUT(spell_id); eq->inventory_slot = ServerToRoFSlot(emu->inventoryslot); @@ -2124,33 +2124,33 @@ namespace RoF outapp->WriteUInt32(0); } - outapp->WriteUInt32(structs::MAX_PP_SPELLBOOK); // Spellbook slots + outapp->WriteUInt32(spells::SPELLBOOK_SIZE); // Spellbook slots - for (uint32 r = 0; r < MAX_PP_SPELLBOOK; r++) + for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) { outapp->WriteUInt32(emu->spell_book[r]); } // zeroes for the rest of the spellbook slots - for (uint32 r = 0; r < structs::MAX_PP_SPELLBOOK - MAX_PP_SPELLBOOK; r++) + for (uint32 r = 0; r < spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE; r++) { outapp->WriteUInt32(0xFFFFFFFFU); } - outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots + outapp->WriteUInt32(spells::SPELL_GEM_COUNT); // Memorised spell slots - for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) // first 12 + for (uint32 r = 0; r < EQEmu::spells::SPELL_GEM_COUNT; r++) // first 12 { outapp->WriteUInt32(emu->mem_spells[r]); } // zeroes for the rest of the slots -- the other 4 which don't work at all! - for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++) + for (uint32 r = 0; r < spells::SPELL_GEM_COUNT - EQEmu::spells::SPELL_GEM_COUNT; r++) { outapp->WriteUInt32(0xFFFFFFFFU); } outapp->WriteUInt32(13); // gem refresh count - for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) + for (uint32 r = 0; r < EQEmu::spells::SPELL_GEM_COUNT; r++) { outapp->WriteUInt32(emu->spellSlotRefresh[r]); // spell gem refresh } @@ -4221,7 +4221,7 @@ namespace RoF DECODE_LENGTH_EXACT(structs::CastSpell_Struct); SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - emu->slot = static_cast(RoFToServerCastingSlot(static_cast(eq->slot))); + emu->slot = static_cast(RoFToServerCastingSlot(static_cast(eq->slot))); IN(spell_id); emu->inventoryslot = RoFToServerSlot(eq->inventory_slot); @@ -4738,7 +4738,7 @@ namespace RoF DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (unsigned int i = 0; i < MAX_PP_MEMSPELL; ++i) + for (unsigned int i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) { if (eq->spell[i] == 0) emu->spell[i] = 0xFFFFFFFF; @@ -6087,80 +6087,80 @@ namespace RoF } } - static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot) + static inline spells::CastingSlot ServerToRoFCastingSlot(EQEmu::spells::CastingSlot slot) { switch (slot) { - case EQEmu::CastingSlot::Gem1: - return CastingSlot::Gem1; - case EQEmu::CastingSlot::Gem2: - return CastingSlot::Gem2; - case EQEmu::CastingSlot::Gem3: - return CastingSlot::Gem3; - case EQEmu::CastingSlot::Gem4: - return CastingSlot::Gem4; - case EQEmu::CastingSlot::Gem5: - return CastingSlot::Gem5; - case EQEmu::CastingSlot::Gem6: - return CastingSlot::Gem6; - case EQEmu::CastingSlot::Gem7: - return CastingSlot::Gem7; - case EQEmu::CastingSlot::Gem8: - return CastingSlot::Gem8; - case EQEmu::CastingSlot::Gem9: - return CastingSlot::Gem9; - case EQEmu::CastingSlot::Gem10: - return CastingSlot::Gem10; - case EQEmu::CastingSlot::Gem11: - return CastingSlot::Gem11; - case EQEmu::CastingSlot::Gem12: - return CastingSlot::Gem12; - case EQEmu::CastingSlot::Item: - case EQEmu::CastingSlot::PotionBelt: - return CastingSlot::Item; - case EQEmu::CastingSlot::Discipline: - return CastingSlot::Discipline; - case EQEmu::CastingSlot::AltAbility: - return CastingSlot::AltAbility; + case EQEmu::spells::CastingSlot::Gem1: + return spells::CastingSlot::Gem1; + case EQEmu::spells::CastingSlot::Gem2: + return spells::CastingSlot::Gem2; + case EQEmu::spells::CastingSlot::Gem3: + return spells::CastingSlot::Gem3; + case EQEmu::spells::CastingSlot::Gem4: + return spells::CastingSlot::Gem4; + case EQEmu::spells::CastingSlot::Gem5: + return spells::CastingSlot::Gem5; + case EQEmu::spells::CastingSlot::Gem6: + return spells::CastingSlot::Gem6; + case EQEmu::spells::CastingSlot::Gem7: + return spells::CastingSlot::Gem7; + case EQEmu::spells::CastingSlot::Gem8: + return spells::CastingSlot::Gem8; + case EQEmu::spells::CastingSlot::Gem9: + return spells::CastingSlot::Gem9; + case EQEmu::spells::CastingSlot::Gem10: + return spells::CastingSlot::Gem10; + case EQEmu::spells::CastingSlot::Gem11: + return spells::CastingSlot::Gem11; + case EQEmu::spells::CastingSlot::Gem12: + return spells::CastingSlot::Gem12; + case EQEmu::spells::CastingSlot::Item: + case EQEmu::spells::CastingSlot::PotionBelt: + return spells::CastingSlot::Item; + case EQEmu::spells::CastingSlot::Discipline: + return spells::CastingSlot::Discipline; + case EQEmu::spells::CastingSlot::AltAbility: + return spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return CastingSlot::Discipline; + return spells::CastingSlot::Discipline; } } - static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot) + static inline EQEmu::spells::CastingSlot RoFToServerCastingSlot(spells::CastingSlot slot) { switch (slot) { - case CastingSlot::Gem1: - return EQEmu::CastingSlot::Gem1; - case CastingSlot::Gem2: - return EQEmu::CastingSlot::Gem2; - case CastingSlot::Gem3: - return EQEmu::CastingSlot::Gem3; - case CastingSlot::Gem4: - return EQEmu::CastingSlot::Gem4; - case CastingSlot::Gem5: - return EQEmu::CastingSlot::Gem5; - case CastingSlot::Gem6: - return EQEmu::CastingSlot::Gem6; - case CastingSlot::Gem7: - return EQEmu::CastingSlot::Gem7; - case CastingSlot::Gem8: - return EQEmu::CastingSlot::Gem8; - case CastingSlot::Gem9: - return EQEmu::CastingSlot::Gem9; - case CastingSlot::Gem10: - return EQEmu::CastingSlot::Gem10; - case CastingSlot::Gem11: - return EQEmu::CastingSlot::Gem11; - case CastingSlot::Gem12: - return EQEmu::CastingSlot::Gem12; - case CastingSlot::Discipline: - return EQEmu::CastingSlot::Discipline; - case CastingSlot::Item: - return EQEmu::CastingSlot::Item; - case CastingSlot::AltAbility: - return EQEmu::CastingSlot::AltAbility; + case spells::CastingSlot::Gem1: + return EQEmu::spells::CastingSlot::Gem1; + case spells::CastingSlot::Gem2: + return EQEmu::spells::CastingSlot::Gem2; + case spells::CastingSlot::Gem3: + return EQEmu::spells::CastingSlot::Gem3; + case spells::CastingSlot::Gem4: + return EQEmu::spells::CastingSlot::Gem4; + case spells::CastingSlot::Gem5: + return EQEmu::spells::CastingSlot::Gem5; + case spells::CastingSlot::Gem6: + return EQEmu::spells::CastingSlot::Gem6; + case spells::CastingSlot::Gem7: + return EQEmu::spells::CastingSlot::Gem7; + case spells::CastingSlot::Gem8: + return EQEmu::spells::CastingSlot::Gem8; + case spells::CastingSlot::Gem9: + return EQEmu::spells::CastingSlot::Gem9; + case spells::CastingSlot::Gem10: + return EQEmu::spells::CastingSlot::Gem10; + case spells::CastingSlot::Gem11: + return EQEmu::spells::CastingSlot::Gem11; + case spells::CastingSlot::Gem12: + return EQEmu::spells::CastingSlot::Gem12; + case spells::CastingSlot::Discipline: + return EQEmu::spells::CastingSlot::Discipline; + case spells::CastingSlot::Item: + return EQEmu::spells::CastingSlot::Item; + case spells::CastingSlot::AltAbility: + return EQEmu::spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; } } diff --git a/common/patches/rof.h b/common/patches/rof.h index 146b34f1f..205998b32 100644 --- a/common/patches/rof.h +++ b/common/patches/rof.h @@ -50,24 +50,6 @@ namespace RoF #include "rof_ops.h" }; - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Gem10 = 9, - Gem11 = 10, - Gem12 = 11, - Item = 12, - Discipline = 13, - AltAbility = 0xFF - }; - }; /*RoF*/ #endif /*COMMON_ROF_H*/ diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index a062033fc..7aa1411b6 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -65,8 +65,8 @@ namespace RoF2 // client to server say link converter static inline void RoF2ToServerSayLink(std::string &server_saylink, const std::string &rof2_saylink); - static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot); - static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot); + static inline spells::CastingSlot ServerToRoF2CastingSlot(EQEmu::spells::CastingSlot slot); + static inline EQEmu::spells::CastingSlot RoF2ToServerCastingSlot(spells::CastingSlot slot); static inline int ServerToRoF2BuffSlot(int index); static inline int RoF2ToServerBuffSlot(int index); @@ -570,7 +570,7 @@ namespace RoF2 ENCODE_LENGTH_EXACT(CastSpell_Struct); SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct); - eq->slot = static_cast(ServerToRoF2CastingSlot(static_cast(emu->slot))); + eq->slot = static_cast(ServerToRoF2CastingSlot(static_cast(emu->slot))); OUT(spell_id); eq->inventory_slot = ServerToRoF2Slot(emu->inventoryslot); @@ -2200,33 +2200,33 @@ namespace RoF2 outapp->WriteUInt32(0); } - outapp->WriteUInt32(structs::MAX_PP_SPELLBOOK); // Spellbook slots + outapp->WriteUInt32(spells::SPELLBOOK_SIZE); // Spellbook slots - for (uint32 r = 0; r < MAX_PP_SPELLBOOK; r++) + for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) { outapp->WriteUInt32(emu->spell_book[r]); } // zeroes for the rest of the spellbook slots - for (uint32 r = 0; r < structs::MAX_PP_SPELLBOOK - MAX_PP_SPELLBOOK; r++) + for (uint32 r = 0; r < spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE; r++) { outapp->WriteUInt32(0xFFFFFFFFU); } - outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots + outapp->WriteUInt32(spells::SPELL_GEM_COUNT); // Memorised spell slots - for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) // write first 12 + for (uint32 r = 0; r < EQEmu::spells::SPELL_GEM_COUNT; r++) // write first 12 { outapp->WriteUInt32(emu->mem_spells[r]); } // zeroes for the rest of the slots the other 4, which actually don't work on the client at all :D - for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++) + for (uint32 r = 0; r < spells::SPELL_GEM_COUNT - EQEmu::spells::SPELL_GEM_COUNT; r++) { outapp->WriteUInt32(0xFFFFFFFFU); } outapp->WriteUInt32(13); // gem refresh counts - for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) + for (uint32 r = 0; r < EQEmu::spells::SPELL_GEM_COUNT; r++) { outapp->WriteUInt32(emu->spellSlotRefresh[r]); // spell gem refresh } @@ -4460,7 +4460,7 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::CastSpell_Struct); SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - emu->slot = static_cast(RoF2ToServerCastingSlot(static_cast(eq->slot))); + emu->slot = static_cast(RoF2ToServerCastingSlot(static_cast(eq->slot))); IN(spell_id); emu->inventoryslot = RoF2ToServerSlot(eq->inventory_slot); @@ -4976,7 +4976,7 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (unsigned int i = 0; i < MAX_PP_MEMSPELL; ++i) + for (unsigned int i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) { if (eq->spell[i] == 0) emu->spell[i] = 0xFFFFFFFF; @@ -6342,80 +6342,80 @@ namespace RoF2 } } - static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot) + static inline spells::CastingSlot ServerToRoF2CastingSlot(EQEmu::spells::CastingSlot slot) { switch (slot) { - case EQEmu::CastingSlot::Gem1: - return CastingSlot::Gem1; - case EQEmu::CastingSlot::Gem2: - return CastingSlot::Gem2; - case EQEmu::CastingSlot::Gem3: - return CastingSlot::Gem3; - case EQEmu::CastingSlot::Gem4: - return CastingSlot::Gem4; - case EQEmu::CastingSlot::Gem5: - return CastingSlot::Gem5; - case EQEmu::CastingSlot::Gem6: - return CastingSlot::Gem6; - case EQEmu::CastingSlot::Gem7: - return CastingSlot::Gem7; - case EQEmu::CastingSlot::Gem8: - return CastingSlot::Gem8; - case EQEmu::CastingSlot::Gem9: - return CastingSlot::Gem9; - case EQEmu::CastingSlot::Gem10: - return CastingSlot::Gem10; - case EQEmu::CastingSlot::Gem11: - return CastingSlot::Gem11; - case EQEmu::CastingSlot::Gem12: - return CastingSlot::Gem12; - case EQEmu::CastingSlot::Item: - case EQEmu::CastingSlot::PotionBelt: - return CastingSlot::Item; - case EQEmu::CastingSlot::Discipline: - return CastingSlot::Discipline; - case EQEmu::CastingSlot::AltAbility: - return CastingSlot::AltAbility; + case EQEmu::spells::CastingSlot::Gem1: + return spells::CastingSlot::Gem1; + case EQEmu::spells::CastingSlot::Gem2: + return spells::CastingSlot::Gem2; + case EQEmu::spells::CastingSlot::Gem3: + return spells::CastingSlot::Gem3; + case EQEmu::spells::CastingSlot::Gem4: + return spells::CastingSlot::Gem4; + case EQEmu::spells::CastingSlot::Gem5: + return spells::CastingSlot::Gem5; + case EQEmu::spells::CastingSlot::Gem6: + return spells::CastingSlot::Gem6; + case EQEmu::spells::CastingSlot::Gem7: + return spells::CastingSlot::Gem7; + case EQEmu::spells::CastingSlot::Gem8: + return spells::CastingSlot::Gem8; + case EQEmu::spells::CastingSlot::Gem9: + return spells::CastingSlot::Gem9; + case EQEmu::spells::CastingSlot::Gem10: + return spells::CastingSlot::Gem10; + case EQEmu::spells::CastingSlot::Gem11: + return spells::CastingSlot::Gem11; + case EQEmu::spells::CastingSlot::Gem12: + return spells::CastingSlot::Gem12; + case EQEmu::spells::CastingSlot::Item: + case EQEmu::spells::CastingSlot::PotionBelt: + return spells::CastingSlot::Item; + case EQEmu::spells::CastingSlot::Discipline: + return spells::CastingSlot::Discipline; + case EQEmu::spells::CastingSlot::AltAbility: + return spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return CastingSlot::Discipline; + return spells::CastingSlot::Discipline; } } - static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot) + static inline EQEmu::spells::CastingSlot RoF2ToServerCastingSlot(spells::CastingSlot slot) { switch (slot) { - case CastingSlot::Gem1: - return EQEmu::CastingSlot::Gem1; - case CastingSlot::Gem2: - return EQEmu::CastingSlot::Gem2; - case CastingSlot::Gem3: - return EQEmu::CastingSlot::Gem3; - case CastingSlot::Gem4: - return EQEmu::CastingSlot::Gem4; - case CastingSlot::Gem5: - return EQEmu::CastingSlot::Gem5; - case CastingSlot::Gem6: - return EQEmu::CastingSlot::Gem6; - case CastingSlot::Gem7: - return EQEmu::CastingSlot::Gem7; - case CastingSlot::Gem8: - return EQEmu::CastingSlot::Gem8; - case CastingSlot::Gem9: - return EQEmu::CastingSlot::Gem9; - case CastingSlot::Gem10: - return EQEmu::CastingSlot::Gem10; - case CastingSlot::Gem11: - return EQEmu::CastingSlot::Gem11; - case CastingSlot::Gem12: - return EQEmu::CastingSlot::Gem12; - case CastingSlot::Discipline: - return EQEmu::CastingSlot::Discipline; - case CastingSlot::Item: - return EQEmu::CastingSlot::Item; - case CastingSlot::AltAbility: - return EQEmu::CastingSlot::AltAbility; + case spells::CastingSlot::Gem1: + return EQEmu::spells::CastingSlot::Gem1; + case spells::CastingSlot::Gem2: + return EQEmu::spells::CastingSlot::Gem2; + case spells::CastingSlot::Gem3: + return EQEmu::spells::CastingSlot::Gem3; + case spells::CastingSlot::Gem4: + return EQEmu::spells::CastingSlot::Gem4; + case spells::CastingSlot::Gem5: + return EQEmu::spells::CastingSlot::Gem5; + case spells::CastingSlot::Gem6: + return EQEmu::spells::CastingSlot::Gem6; + case spells::CastingSlot::Gem7: + return EQEmu::spells::CastingSlot::Gem7; + case spells::CastingSlot::Gem8: + return EQEmu::spells::CastingSlot::Gem8; + case spells::CastingSlot::Gem9: + return EQEmu::spells::CastingSlot::Gem9; + case spells::CastingSlot::Gem10: + return EQEmu::spells::CastingSlot::Gem10; + case spells::CastingSlot::Gem11: + return EQEmu::spells::CastingSlot::Gem11; + case spells::CastingSlot::Gem12: + return EQEmu::spells::CastingSlot::Gem12; + case spells::CastingSlot::Discipline: + return EQEmu::spells::CastingSlot::Discipline; + case spells::CastingSlot::Item: + return EQEmu::spells::CastingSlot::Item; + case spells::CastingSlot::AltAbility: + return EQEmu::spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; } } diff --git a/common/patches/rof2.h b/common/patches/rof2.h index 4fb94a1d4..9eef8e596 100644 --- a/common/patches/rof2.h +++ b/common/patches/rof2.h @@ -50,24 +50,6 @@ namespace RoF2 #include "rof2_ops.h" }; - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Gem10 = 9, - Gem11 = 10, - Gem12 = 11, - Item = 12, - Discipline = 13, - AltAbility = 0xFF - }; - }; /*RoF2*/ #endif /*COMMON_ROF2_H*/ diff --git a/common/patches/rof2_limits.h b/common/patches/rof2_limits.h index 3316c01c5..6f741a9bc 100644 --- a/common/patches/rof2_limits.h +++ b/common/patches/rof2_limits.h @@ -295,6 +295,34 @@ namespace RoF2 } /*skills*/ + namespace spells { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF2; } + + enum class CastingSlot : uint32 { + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + Gem10 = 9, + Gem11 = 10, + Gem12 = 11, + MaxGems = 16, // fallacy..only 12 slot are useable... + Item = 12, + Discipline = 13, + AltAbility = 0xFF + }; + + const int SPELL_ID_MAX = 45000; + const int SPELLBOOK_SIZE = 720; + const int SPELL_GEM_COUNT = static_cast(CastingSlot::MaxGems); + + } /*spells*/ + }; /*RoF2*/ #endif /*COMMON_ROF2_LIMITS_H*/ diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index f53675f83..f36906df0 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -128,8 +128,7 @@ static const uint32 MAX_NUMBER_GUILDS = 1500; // Used primarily in the Player Profile: static const uint32 MAX_PP_LANGUAGE = 32; // was 25 -static const uint32 MAX_PP_SPELLBOOK = 720; // was 480 -static const uint32 MAX_PP_MEMSPELL = 16; // was 12 + static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_INNATE_SKILL = 25; static const uint32 MAX_PP_AA_ARRAY = 300; @@ -1167,9 +1166,9 @@ union /*06092*/ uint32 timestamp2_count; // Seen 100 /*06096*/ uint32 timestamps2[100]; // Unknown Unix Timestamps - maybe Skill related? /*06496*/ uint32 spell_book_count; // Seen 720 -/*06500*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 720 = 90 pages [2880 bytes] +/*06500*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook 720 = 90 pages [2880 bytes] /*09380*/ uint32 mem_spell_count; // Seen 16 -/*09384*/ int32 mem_spells[MAX_PP_MEMSPELL]; // [16] List of spells memorized - First 12 are set or -1 and last 4 are 0s +/*09384*/ int32 mem_spells[spells::SPELL_GEM_COUNT]; // [16] List of spells memorized - First 12 are set or -1 and last 4 are 0s /*09448*/ uint32 unknown16_count; // Seen 13 /*09452*/ uint32 unknown_rof16[13]; // Possibly spell or buff related /*09504*/ uint8 unknown_rof17; // Seen 0 or 8 diff --git a/common/patches/rof_limits.h b/common/patches/rof_limits.h index f82e86408..739c19898 100644 --- a/common/patches/rof_limits.h +++ b/common/patches/rof_limits.h @@ -286,6 +286,34 @@ namespace RoF } /*skills*/ + namespace spells { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF; } + + enum class CastingSlot : uint32 { + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + Gem10 = 9, + Gem11 = 10, + Gem12 = 11, + MaxGems = 16, // fallacy..only 12 slots are useable + Item = 12, + Discipline = 13, + AltAbility = 0xFF + }; + + const int SPELL_ID_MAX = 45000; + const int SPELLBOOK_SIZE = 720; + const int SPELL_GEM_COUNT = static_cast(CastingSlot::MaxGems); + + } /*spells*/ + }; /*RoF*/ #endif /*COMMON_ROF_LIMITS_H*/ diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 885a9aa80..e9122a156 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -128,8 +128,7 @@ static const uint32 MAX_NUMBER_GUILDS = 1500; // Used primarily in the Player Profile: static const uint32 MAX_PP_LANGUAGE = 32; // was 25 -static const uint32 MAX_PP_SPELLBOOK = 720; // was 480 -static const uint32 MAX_PP_MEMSPELL = 16; // was 12 + static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_INNATE_SKILL = 25; static const uint32 MAX_PP_AA_ARRAY = 300; @@ -1108,9 +1107,9 @@ union /*06092*/ uint32 timestamp2_count; // Seen 100 /*06096*/ uint32 timestamps2[100]; // Unknown Unix Timestamps - maybe Skill related? /*06496*/ uint32 spell_book_count; // Seen 720 -/*06500*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 720 = 90 pages [2880 bytes] +/*06500*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook 720 = 90 pages [2880 bytes] /*09380*/ uint32 mem_spell_count; // Seen 16 -/*09384*/ int32 mem_spells[MAX_PP_MEMSPELL]; // [16] List of spells memorized - First 12 are set or -1 and last 4 are 0s +/*09384*/ int32 mem_spells[spells::SPELL_GEM_COUNT]; // [16] List of spells memorized - First 12 are set or -1 and last 4 are 0s /*09448*/ uint32 unknown16_count; // Seen 13 /*09452*/ uint32 unknown_rof16[13]; // Possibly spell or buff related /*09504*/ uint8 unknown_rof17; // Seen 0 or 8 diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 112312afd..34e724960 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -59,8 +59,8 @@ namespace SoD // client to server say link converter static inline void SoDToServerSayLink(std::string &server_saylink, const std::string &sod_saylink); - static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot); - static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot); + static inline spells::CastingSlot ServerToSoDCastingSlot(EQEmu::spells::CastingSlot slot); + static inline EQEmu::spells::CastingSlot SoDToServerCastingSlot(spells::CastingSlot slot); static inline int ServerToSoDBuffSlot(int index); static inline int SoDToServerBuffSlot(int index); @@ -1452,7 +1452,7 @@ namespace SoD } OUT(deity); OUT(intoxication); - OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); + OUT_array(spellSlotRefresh, spells::SPELL_GEM_COUNT); OUT(abilitySlotRefresh); OUT(points); // Relocation Test // OUT(unknown0166[4]); @@ -1492,9 +1492,9 @@ namespace SoD OUT(WIS); OUT(face); // OUT(unknown02264[47]); - OUT_array(spell_book, structs::MAX_PP_SPELLBOOK); + OUT_array(spell_book, spells::SPELLBOOK_SIZE); // OUT(unknown4184[128]); - OUT_array(mem_spells, structs::MAX_PP_MEMSPELL); + OUT_array(mem_spells, spells::SPELL_GEM_COUNT); // OUT(unknown04396[32]); OUT(platinum); OUT(gold); @@ -2842,7 +2842,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::CastSpell_Struct); SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - emu->slot = static_cast(SoDToServerCastingSlot(static_cast(eq->slot))); + emu->slot = static_cast(SoDToServerCastingSlot(static_cast(eq->slot))); IN(slot); IN(spell_id); emu->inventoryslot = SoDToServerSlot(eq->inventoryslot); @@ -3136,9 +3136,9 @@ namespace SoD DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (int i = 0; i < structs::MAX_PP_MEMSPELL; ++i) + for (int i = 0; i < spells::SPELL_GEM_COUNT; ++i) emu->spell[i] = eq->spell[i]; - for (int i = structs::MAX_PP_MEMSPELL; i < MAX_PP_MEMSPELL; ++i) + for (int i = spells::SPELL_GEM_COUNT; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) emu->spell[i] = 0xFFFFFFFF; FINISH_DIRECT_DECODE(); @@ -4021,72 +4021,72 @@ namespace SoD } } - static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot) + static inline spells::CastingSlot ServerToSoDCastingSlot(EQEmu::spells::CastingSlot slot) { switch (slot) { - case EQEmu::CastingSlot::Gem1: - return CastingSlot::Gem1; - case EQEmu::CastingSlot::Gem2: - return CastingSlot::Gem2; - case EQEmu::CastingSlot::Gem3: - return CastingSlot::Gem3; - case EQEmu::CastingSlot::Gem4: - return CastingSlot::Gem4; - case EQEmu::CastingSlot::Gem5: - return CastingSlot::Gem5; - case EQEmu::CastingSlot::Gem6: - return CastingSlot::Gem6; - case EQEmu::CastingSlot::Gem7: - return CastingSlot::Gem7; - case EQEmu::CastingSlot::Gem8: - return CastingSlot::Gem8; - case EQEmu::CastingSlot::Gem9: - return CastingSlot::Gem9; - case EQEmu::CastingSlot::Gem10: - return CastingSlot::Gem10; - case EQEmu::CastingSlot::Item: - case EQEmu::CastingSlot::PotionBelt: - return CastingSlot::Item; - case EQEmu::CastingSlot::Discipline: - return CastingSlot::Discipline; - case EQEmu::CastingSlot::AltAbility: - return CastingSlot::AltAbility; + case EQEmu::spells::CastingSlot::Gem1: + return spells::CastingSlot::Gem1; + case EQEmu::spells::CastingSlot::Gem2: + return spells::CastingSlot::Gem2; + case EQEmu::spells::CastingSlot::Gem3: + return spells::CastingSlot::Gem3; + case EQEmu::spells::CastingSlot::Gem4: + return spells::CastingSlot::Gem4; + case EQEmu::spells::CastingSlot::Gem5: + return spells::CastingSlot::Gem5; + case EQEmu::spells::CastingSlot::Gem6: + return spells::CastingSlot::Gem6; + case EQEmu::spells::CastingSlot::Gem7: + return spells::CastingSlot::Gem7; + case EQEmu::spells::CastingSlot::Gem8: + return spells::CastingSlot::Gem8; + case EQEmu::spells::CastingSlot::Gem9: + return spells::CastingSlot::Gem9; + case EQEmu::spells::CastingSlot::Gem10: + return spells::CastingSlot::Gem10; + case EQEmu::spells::CastingSlot::Item: + case EQEmu::spells::CastingSlot::PotionBelt: + return spells::CastingSlot::Item; + case EQEmu::spells::CastingSlot::Discipline: + return spells::CastingSlot::Discipline; + case EQEmu::spells::CastingSlot::AltAbility: + return spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return CastingSlot::Discipline; + return spells::CastingSlot::Discipline; } } - static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot) + static inline EQEmu::spells::CastingSlot SoDToServerCastingSlot(spells::CastingSlot slot) { switch (slot) { - case CastingSlot::Gem1: - return EQEmu::CastingSlot::Gem1; - case CastingSlot::Gem2: - return EQEmu::CastingSlot::Gem2; - case CastingSlot::Gem3: - return EQEmu::CastingSlot::Gem3; - case CastingSlot::Gem4: - return EQEmu::CastingSlot::Gem4; - case CastingSlot::Gem5: - return EQEmu::CastingSlot::Gem5; - case CastingSlot::Gem6: - return EQEmu::CastingSlot::Gem6; - case CastingSlot::Gem7: - return EQEmu::CastingSlot::Gem7; - case CastingSlot::Gem8: - return EQEmu::CastingSlot::Gem8; - case CastingSlot::Gem9: - return EQEmu::CastingSlot::Gem9; - case CastingSlot::Gem10: - return EQEmu::CastingSlot::Gem10; - case CastingSlot::Discipline: - return EQEmu::CastingSlot::Discipline; - case CastingSlot::Item: - return EQEmu::CastingSlot::Item; - case CastingSlot::AltAbility: - return EQEmu::CastingSlot::AltAbility; + case spells::CastingSlot::Gem1: + return EQEmu::spells::CastingSlot::Gem1; + case spells::CastingSlot::Gem2: + return EQEmu::spells::CastingSlot::Gem2; + case spells::CastingSlot::Gem3: + return EQEmu::spells::CastingSlot::Gem3; + case spells::CastingSlot::Gem4: + return EQEmu::spells::CastingSlot::Gem4; + case spells::CastingSlot::Gem5: + return EQEmu::spells::CastingSlot::Gem5; + case spells::CastingSlot::Gem6: + return EQEmu::spells::CastingSlot::Gem6; + case spells::CastingSlot::Gem7: + return EQEmu::spells::CastingSlot::Gem7; + case spells::CastingSlot::Gem8: + return EQEmu::spells::CastingSlot::Gem8; + case spells::CastingSlot::Gem9: + return EQEmu::spells::CastingSlot::Gem9; + case spells::CastingSlot::Gem10: + return EQEmu::spells::CastingSlot::Gem10; + case spells::CastingSlot::Discipline: + return EQEmu::spells::CastingSlot::Discipline; + case spells::CastingSlot::Item: + return EQEmu::spells::CastingSlot::Item; + case spells::CastingSlot::AltAbility: + return EQEmu::spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; } } diff --git a/common/patches/sod.h b/common/patches/sod.h index 5c29e36c0..977645231 100644 --- a/common/patches/sod.h +++ b/common/patches/sod.h @@ -50,22 +50,6 @@ namespace SoD #include "sod_ops.h" }; - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Gem10 = 9, - Item = 10, - Discipline = 11, - AltAbility = 0xFF - }; - }; /*SoD*/ #endif /*COMMON_SOD_H*/ diff --git a/common/patches/sod_limits.h b/common/patches/sod_limits.h index c883524e7..a26075cdb 100644 --- a/common/patches/sod_limits.h +++ b/common/patches/sod_limits.h @@ -313,6 +313,32 @@ namespace SoD } /*skills*/ + namespace spells { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoD; } + + enum class CastingSlot : uint32 { + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + Gem10 = 9, + MaxGems = 10, + Item = 10, + Discipline = 11, + AltAbility = 0xFF + }; + + const int SPELL_ID_MAX = 23000; + const int SPELLBOOK_SIZE = 480; + const int SPELL_GEM_COUNT = static_cast(CastingSlot::MaxGems); + + } /*spells*/ + }; /*SoD*/ #endif /*COMMON_SOD_LIMITS_H*/ diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 57e37c957..0d201e13a 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -815,8 +815,7 @@ struct BindStruct { ** OpCode: 0x006a */ static const uint32 MAX_PP_LANGUAGE = 25; // -static const uint32 MAX_PP_SPELLBOOK = 480; // Confirmed 60 pages on Live now -static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Live + static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_INNATE_SKILL = 25; static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 @@ -885,7 +884,7 @@ struct PlayerProfile_Struct /*00060*/ BindStruct binds[5]; // Bind points (primary is first) /*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 +/*00168*/ uint32 spellSlotRefresh[spells::SPELL_GEM_COUNT]; // Refresh time (millis) - 4 Octets Each /*00208*/ uint32 abilitySlotRefresh; /*00212*/ uint8 haircolor; // Player hair color /*00213*/ uint8 beardcolor; // Player beard color @@ -911,9 +910,9 @@ struct PlayerProfile_Struct /*04172*/ uint8 unknown04172[28]; // /*04200*/ uint8 face; // Player face /*04201*/ uint8 unknown02264[147]; // was [175] -/*04348*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 480 = 60 pages [1920] +/*04348*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook 480 = 60 pages [1920] /*06268*/ uint8 unknown4184[128]; // was [164] Seen -1 -/*06396*/ uint32 mem_spells[MAX_PP_MEMSPELL]; // List of spells memorized +/*06396*/ uint32 mem_spells[spells::SPELL_GEM_COUNT]; // List of spells memorized /*06436*/ uint8 unknown04396[28]; //#### uint8 unknown04396[32]; in Titanium ####[28] /*06464*/ uint32 platinum; // Platinum Pieces on player /*06468*/ uint32 gold; // Gold Pieces on player @@ -3846,7 +3845,7 @@ struct AnnoyingZoneUnknown_Struct { }; struct LoadSpellSet_Struct { - uint32 spell[MAX_PP_MEMSPELL]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 + uint32 spell[spells::SPELL_GEM_COUNT]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 uint32 unknown; //there seems to be an extra field in this packet... }; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 52af1244f..1b1d9dc28 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -59,8 +59,8 @@ namespace SoF // client to server say link converter static inline void SoFToServerSayLink(std::string &server_saylink, const std::string &sof_saylink); - static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot); - static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 item_location); + static inline spells::CastingSlot ServerToSoFCastingSlot(EQEmu::spells::CastingSlot slot); + static inline EQEmu::spells::CastingSlot SoFToServerCastingSlot(spells::CastingSlot slot, uint32 item_location); static inline int ServerToSoFBuffSlot(int index); static inline int SoFToServerBuffSlot(int index); @@ -956,7 +956,7 @@ namespace SoF // Since HT/LoH are translated up, we need to translate down only for memSpellSpellbar case if (emu->scribing == 3) - eq->slot = static_cast(ServerToSoFCastingSlot(static_cast(emu->slot))); + eq->slot = static_cast(ServerToSoFCastingSlot(static_cast(emu->slot))); else OUT(slot); OUT(spell_id); @@ -1116,7 +1116,7 @@ namespace SoF } OUT(deity); OUT(intoxication); - OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); + OUT_array(spellSlotRefresh, spells::SPELL_GEM_COUNT); OUT(abilitySlotRefresh); OUT(points); // Relocation Test // OUT(unknown0166[4]); @@ -1156,9 +1156,9 @@ namespace SoF OUT(WIS); OUT(face); // OUT(unknown02264[47]); - OUT_array(spell_book, structs::MAX_PP_SPELLBOOK); + OUT_array(spell_book, spells::SPELLBOOK_SIZE); // OUT(unknown4184[128]); - OUT_array(mem_spells, structs::MAX_PP_MEMSPELL); + OUT_array(mem_spells, spells::SPELL_GEM_COUNT); // OUT(unknown04396[32]); OUT(platinum); OUT(gold); @@ -2298,7 +2298,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::CastSpell_Struct); SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - emu->slot = static_cast(SoFToServerCastingSlot(static_cast(eq->slot), eq->inventoryslot)); + emu->slot = static_cast(SoFToServerCastingSlot(static_cast(eq->slot), eq->inventoryslot)); IN(spell_id); emu->inventoryslot = SoFToServerSlot(eq->inventoryslot); IN(target_id); @@ -2540,9 +2540,9 @@ namespace SoF DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (int i = 0; i < structs::MAX_PP_MEMSPELL; ++i) + for (int i = 0; i < spells::SPELL_GEM_COUNT; ++i) IN(spell[i]); - for (int i = structs::MAX_PP_MEMSPELL; i < MAX_PP_MEMSPELL; ++i) + for (int i = spells::SPELL_GEM_COUNT; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) emu->spell[i] = 0xFFFFFFFF; IN(unknown); @@ -3419,73 +3419,73 @@ namespace SoF } } - static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot) { + static inline spells::CastingSlot ServerToSoFCastingSlot(EQEmu::spells::CastingSlot slot) { switch (slot) { - case EQEmu::CastingSlot::Gem1: - return CastingSlot::Gem1; - case EQEmu::CastingSlot::Gem2: - return CastingSlot::Gem2; - case EQEmu::CastingSlot::Gem3: - return CastingSlot::Gem3; - case EQEmu::CastingSlot::Gem4: - return CastingSlot::Gem4; - case EQEmu::CastingSlot::Gem5: - return CastingSlot::Gem5; - case EQEmu::CastingSlot::Gem6: - return CastingSlot::Gem6; - case EQEmu::CastingSlot::Gem7: - return CastingSlot::Gem7; - case EQEmu::CastingSlot::Gem8: - return CastingSlot::Gem8; - case EQEmu::CastingSlot::Gem9: - return CastingSlot::Gem9; - case EQEmu::CastingSlot::Item: - return CastingSlot::Item; - case EQEmu::CastingSlot::PotionBelt: - return CastingSlot::PotionBelt; - case EQEmu::CastingSlot::Discipline: - return CastingSlot::Discipline; - case EQEmu::CastingSlot::AltAbility: - return CastingSlot::AltAbility; + case EQEmu::spells::CastingSlot::Gem1: + return spells::CastingSlot::Gem1; + case EQEmu::spells::CastingSlot::Gem2: + return spells::CastingSlot::Gem2; + case EQEmu::spells::CastingSlot::Gem3: + return spells::CastingSlot::Gem3; + case EQEmu::spells::CastingSlot::Gem4: + return spells::CastingSlot::Gem4; + case EQEmu::spells::CastingSlot::Gem5: + return spells::CastingSlot::Gem5; + case EQEmu::spells::CastingSlot::Gem6: + return spells::CastingSlot::Gem6; + case EQEmu::spells::CastingSlot::Gem7: + return spells::CastingSlot::Gem7; + case EQEmu::spells::CastingSlot::Gem8: + return spells::CastingSlot::Gem8; + case EQEmu::spells::CastingSlot::Gem9: + return spells::CastingSlot::Gem9; + case EQEmu::spells::CastingSlot::Item: + return spells::CastingSlot::Item; + case EQEmu::spells::CastingSlot::PotionBelt: + return spells::CastingSlot::PotionBelt; + case EQEmu::spells::CastingSlot::Discipline: + return spells::CastingSlot::Discipline; + case EQEmu::spells::CastingSlot::AltAbility: + return spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return CastingSlot::Discipline; + return spells::CastingSlot::Discipline; } } - static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 item_location) { + static inline EQEmu::spells::CastingSlot SoFToServerCastingSlot(spells::CastingSlot slot, uint32 item_location) { switch (slot) { - case CastingSlot::Gem1: - return EQEmu::CastingSlot::Gem1; - case CastingSlot::Gem2: - return EQEmu::CastingSlot::Gem2; - case CastingSlot::Gem3: - return EQEmu::CastingSlot::Gem3; - case CastingSlot::Gem4: - return EQEmu::CastingSlot::Gem4; - case CastingSlot::Gem5: - return EQEmu::CastingSlot::Gem5; - case CastingSlot::Gem6: - return EQEmu::CastingSlot::Gem6; - case CastingSlot::Gem7: - return EQEmu::CastingSlot::Gem7; - case CastingSlot::Gem8: - return EQEmu::CastingSlot::Gem8; - case CastingSlot::Gem9: - return EQEmu::CastingSlot::Gem9; - case CastingSlot::Ability: - return EQEmu::CastingSlot::Ability; + case spells::CastingSlot::Gem1: + return EQEmu::spells::CastingSlot::Gem1; + case spells::CastingSlot::Gem2: + return EQEmu::spells::CastingSlot::Gem2; + case spells::CastingSlot::Gem3: + return EQEmu::spells::CastingSlot::Gem3; + case spells::CastingSlot::Gem4: + return EQEmu::spells::CastingSlot::Gem4; + case spells::CastingSlot::Gem5: + return EQEmu::spells::CastingSlot::Gem5; + case spells::CastingSlot::Gem6: + return EQEmu::spells::CastingSlot::Gem6; + case spells::CastingSlot::Gem7: + return EQEmu::spells::CastingSlot::Gem7; + case spells::CastingSlot::Gem8: + return EQEmu::spells::CastingSlot::Gem8; + case spells::CastingSlot::Gem9: + return EQEmu::spells::CastingSlot::Gem9; + case spells::CastingSlot::Ability: + return EQEmu::spells::CastingSlot::Ability; // Tit uses 10 for item and discipline casting, but items have a valid location - case CastingSlot::Item: + case spells::CastingSlot::Item: if (item_location == INVALID_INDEX) - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; else - return EQEmu::CastingSlot::Item; - case CastingSlot::PotionBelt: - return EQEmu::CastingSlot::PotionBelt; - case CastingSlot::AltAbility: - return EQEmu::CastingSlot::AltAbility; + return EQEmu::spells::CastingSlot::Item; + case spells::CastingSlot::PotionBelt: + return EQEmu::spells::CastingSlot::PotionBelt; + case spells::CastingSlot::AltAbility: + return EQEmu::spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; } } diff --git a/common/patches/sof.h b/common/patches/sof.h index 47c023471..dde55f9a3 100644 --- a/common/patches/sof.h +++ b/common/patches/sof.h @@ -50,23 +50,6 @@ namespace SoF #include "sof_ops.h" }; - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Ability = 9, - Item = 10, - Discipline = 10, - PotionBelt = 11, - AltAbility = 0xFF - }; - }; /*SoF*/ #endif /*COMMON_SOF_H*/ diff --git a/common/patches/sof_limits.h b/common/patches/sof_limits.h index 5f8922148..8f682c8c1 100644 --- a/common/patches/sof_limits.h +++ b/common/patches/sof_limits.h @@ -313,6 +313,33 @@ namespace SoF } /*skills*/ + namespace spells { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoF; } + + enum class CastingSlot : uint32 { + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + MaxGems = 9, + Ability = 9, + Item = 10, + Discipline = 10, + PotionBelt = 11, + AltAbility = 0xFF + }; + + const int SPELL_ID_MAX = 15999; + const int SPELLBOOK_SIZE = 480; + const int SPELL_GEM_COUNT = static_cast(CastingSlot::MaxGems); + + } /*spells*/ + }; /*SoF*/ #endif /*COMMON_SOF_LIMITS_H*/ diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 527341c93..93b185e23 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -816,8 +816,7 @@ struct BindStruct { ** OpCode: 0x006a */ static const uint32 MAX_PP_LANGUAGE = 25; // -static const uint32 MAX_PP_SPELLBOOK = 480; // Confirmed 60 pages on Live now -static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Live + static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_INNATE_SKILL = 25; static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 @@ -886,7 +885,7 @@ struct PlayerProfile_Struct //23576 Octets /*00060*/ BindStruct binds[5]; // Bind points (primary is first) /*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 +/*00168*/ uint32 spellSlotRefresh[spells::SPELL_GEM_COUNT]; // Refresh time (millis) - 4 Octets Each /*00208*/ uint32 abilitySlotRefresh; /*00212*/ uint8 haircolor; // Player hair color /*00213*/ uint8 beardcolor; // Player beard color @@ -911,9 +910,9 @@ struct PlayerProfile_Struct //23576 Octets /*04168*/ uint32 WIS; // Wisdom - 46 00 00 00 - 70 /*04172*/ uint8 face; // Player face /*04173*/ uint8 unknown02264[147]; // was [139] -/*04312*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 480 = 60 pages +/*04312*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook 480 = 60 pages /*06232*/ uint8 unknown4184[128]; // was [136] -/*06396*/ uint32 mem_spells[MAX_PP_MEMSPELL]; // List of spells memorized +/*06396*/ uint32 mem_spells[spells::SPELL_GEM_COUNT]; // List of spells memorized /*06436*/ uint8 unknown04396[28]; //#### uint8 unknown04396[32]; in Titanium ####[28] /*06464*/ uint32 platinum; // Platinum Pieces on player /*06468*/ uint32 gold; // Gold Pieces on player @@ -3769,7 +3768,7 @@ struct AnnoyingZoneUnknown_Struct { }; struct LoadSpellSet_Struct { - uint32 spell[MAX_PP_MEMSPELL]; + uint32 spell[spells::SPELL_GEM_COUNT]; uint32 unknown; }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 2a1345ad0..05357e3af 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -58,8 +58,8 @@ namespace Titanium // client to server say link converter static inline void TitaniumToServerSayLink(std::string &server_saylink, const std::string &titanium_saylink); - static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot); - static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 item_location); + static inline spells::CastingSlot ServerToTitaniumCastingSlot(EQEmu::spells::CastingSlot slot); + static inline EQEmu::spells::CastingSlot TitaniumToServerCastingSlot(spells::CastingSlot slot, uint32 item_location); static inline int ServerToTitaniumBuffSlot(int index); static inline int TitaniumToServerBuffSlot(int index); @@ -890,7 +890,7 @@ namespace Titanium // Since HT/LoH are translated up, we need to translate down only for memSpellSpellbar case if (emu->scribing == 3) - eq->slot = static_cast(ServerToTitaniumCastingSlot(static_cast(emu->slot))); + eq->slot = static_cast(ServerToTitaniumCastingSlot(static_cast(emu->slot))); else OUT(slot); OUT(spell_id); @@ -981,7 +981,7 @@ namespace Titanium } OUT(deity); OUT(intoxication); - OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); + OUT_array(spellSlotRefresh, spells::SPELL_GEM_COUNT); OUT(abilitySlotRefresh); OUT(haircolor); OUT(beardcolor); @@ -1012,9 +1012,9 @@ namespace Titanium OUT(WIS); OUT(face); // OUT(unknown02264[47]); - OUT_array(spell_book, structs::MAX_PP_SPELLBOOK); + OUT_array(spell_book, spells::SPELLBOOK_SIZE); // OUT(unknown4184[448]); - OUT_array(mem_spells, structs::MAX_PP_MEMSPELL); + OUT_array(mem_spells, spells::SPELL_GEM_COUNT); // OUT(unknown04396[32]); OUT(platinum); OUT(gold); @@ -1815,7 +1815,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::CastSpell_Struct); SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - emu->slot = static_cast(TitaniumToServerCastingSlot(static_cast(eq->slot), eq->inventoryslot)); + emu->slot = static_cast(TitaniumToServerCastingSlot(static_cast(eq->slot), eq->inventoryslot)); IN(spell_id); emu->inventoryslot = TitaniumToServerSlot(eq->inventoryslot); IN(target_id); @@ -2003,9 +2003,9 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (int i = 0; i < structs::MAX_PP_MEMSPELL; ++i) + for (int i = 0; i < spells::SPELL_GEM_COUNT; ++i) IN(spell[i]); - for (int i = structs::MAX_PP_MEMSPELL; i < MAX_PP_MEMSPELL; ++i) + for (int i = spells::SPELL_GEM_COUNT; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) emu->spell[i] = 0xFFFFFFFF; IN(unknown); @@ -2721,73 +2721,73 @@ namespace Titanium } } - static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot) { + static inline spells::CastingSlot ServerToTitaniumCastingSlot(EQEmu::spells::CastingSlot slot) { switch (slot) { - case EQEmu::CastingSlot::Gem1: - return CastingSlot::Gem1; - case EQEmu::CastingSlot::Gem2: - return CastingSlot::Gem2; - case EQEmu::CastingSlot::Gem3: - return CastingSlot::Gem3; - case EQEmu::CastingSlot::Gem4: - return CastingSlot::Gem4; - case EQEmu::CastingSlot::Gem5: - return CastingSlot::Gem5; - case EQEmu::CastingSlot::Gem6: - return CastingSlot::Gem6; - case EQEmu::CastingSlot::Gem7: - return CastingSlot::Gem7; - case EQEmu::CastingSlot::Gem8: - return CastingSlot::Gem8; - case EQEmu::CastingSlot::Gem9: - return CastingSlot::Gem9; - case EQEmu::CastingSlot::Item: - return CastingSlot::Item; - case EQEmu::CastingSlot::PotionBelt: - return CastingSlot::PotionBelt; - case EQEmu::CastingSlot::Discipline: - return CastingSlot::Discipline; - case EQEmu::CastingSlot::AltAbility: - return CastingSlot::AltAbility; + case EQEmu::spells::CastingSlot::Gem1: + return spells::CastingSlot::Gem1; + case EQEmu::spells::CastingSlot::Gem2: + return spells::CastingSlot::Gem2; + case EQEmu::spells::CastingSlot::Gem3: + return spells::CastingSlot::Gem3; + case EQEmu::spells::CastingSlot::Gem4: + return spells::CastingSlot::Gem4; + case EQEmu::spells::CastingSlot::Gem5: + return spells::CastingSlot::Gem5; + case EQEmu::spells::CastingSlot::Gem6: + return spells::CastingSlot::Gem6; + case EQEmu::spells::CastingSlot::Gem7: + return spells::CastingSlot::Gem7; + case EQEmu::spells::CastingSlot::Gem8: + return spells::CastingSlot::Gem8; + case EQEmu::spells::CastingSlot::Gem9: + return spells::CastingSlot::Gem9; + case EQEmu::spells::CastingSlot::Item: + return spells::CastingSlot::Item; + case EQEmu::spells::CastingSlot::PotionBelt: + return spells::CastingSlot::PotionBelt; + case EQEmu::spells::CastingSlot::Discipline: + return spells::CastingSlot::Discipline; + case EQEmu::spells::CastingSlot::AltAbility: + return spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return CastingSlot::Discipline; + return spells::CastingSlot::Discipline; } } - static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 item_location) { + static inline EQEmu::spells::CastingSlot TitaniumToServerCastingSlot(spells::CastingSlot slot, uint32 item_location) { switch (slot) { - case CastingSlot::Gem1: - return EQEmu::CastingSlot::Gem1; - case CastingSlot::Gem2: - return EQEmu::CastingSlot::Gem2; - case CastingSlot::Gem3: - return EQEmu::CastingSlot::Gem3; - case CastingSlot::Gem4: - return EQEmu::CastingSlot::Gem4; - case CastingSlot::Gem5: - return EQEmu::CastingSlot::Gem5; - case CastingSlot::Gem6: - return EQEmu::CastingSlot::Gem6; - case CastingSlot::Gem7: - return EQEmu::CastingSlot::Gem7; - case CastingSlot::Gem8: - return EQEmu::CastingSlot::Gem8; - case CastingSlot::Gem9: - return EQEmu::CastingSlot::Gem9; - case CastingSlot::Ability: - return EQEmu::CastingSlot::Ability; + case spells::CastingSlot::Gem1: + return EQEmu::spells::CastingSlot::Gem1; + case spells::CastingSlot::Gem2: + return EQEmu::spells::CastingSlot::Gem2; + case spells::CastingSlot::Gem3: + return EQEmu::spells::CastingSlot::Gem3; + case spells::CastingSlot::Gem4: + return EQEmu::spells::CastingSlot::Gem4; + case spells::CastingSlot::Gem5: + return EQEmu::spells::CastingSlot::Gem5; + case spells::CastingSlot::Gem6: + return EQEmu::spells::CastingSlot::Gem6; + case spells::CastingSlot::Gem7: + return EQEmu::spells::CastingSlot::Gem7; + case spells::CastingSlot::Gem8: + return EQEmu::spells::CastingSlot::Gem8; + case spells::CastingSlot::Gem9: + return EQEmu::spells::CastingSlot::Gem9; + case spells::CastingSlot::Ability: + return EQEmu::spells::CastingSlot::Ability; // Tit uses 10 for item and discipline casting, but items have a valid location - case CastingSlot::Item: + case spells::CastingSlot::Item: if (item_location == INVALID_INDEX) - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; else - return EQEmu::CastingSlot::Item; - case CastingSlot::PotionBelt: - return EQEmu::CastingSlot::PotionBelt; - case CastingSlot::AltAbility: - return EQEmu::CastingSlot::AltAbility; + return EQEmu::spells::CastingSlot::Item; + case spells::CastingSlot::PotionBelt: + return EQEmu::spells::CastingSlot::PotionBelt; + case spells::CastingSlot::AltAbility: + return EQEmu::spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; } } diff --git a/common/patches/titanium.h b/common/patches/titanium.h index ea68dd59a..2f063c9ad 100644 --- a/common/patches/titanium.h +++ b/common/patches/titanium.h @@ -50,23 +50,6 @@ namespace Titanium #include "titanium_ops.h" }; - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Ability = 9, - Item = 10, - Discipline = 10, - PotionBelt = 11, - AltAbility = 0xFF - }; - }; /*Titanium*/ #endif /*COMMON_TITANIUM_H*/ diff --git a/common/patches/titanium_limits.h b/common/patches/titanium_limits.h index 77aab1c49..28eb414e3 100644 --- a/common/patches/titanium_limits.h +++ b/common/patches/titanium_limits.h @@ -312,6 +312,33 @@ namespace Titanium } /*skills*/ + namespace spells { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::Titanium; } + + enum class CastingSlot : uint32 { + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + MaxGems = 9, + Ability = 9, + Item = 10, + Discipline = 10, + PotionBelt = 11, + AltAbility = 0xFF + }; + + const int SPELL_ID_MAX = 9999; + const int SPELLBOOK_SIZE = 400; + const int SPELL_GEM_COUNT = static_cast(CastingSlot::MaxGems); + + } /*spells*/ + }; /*Titanium*/ #endif /*COMMON_TITANIUM_LIMITS_H*/ diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 8cf202e31..6ffee7ddf 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -754,8 +754,7 @@ struct BindStruct { ** OpCode: 0x006a */ static const uint32 MAX_PP_LANGUAGE = 28; -static const uint32 MAX_PP_SPELLBOOK = 400; -static const uint32 MAX_PP_MEMSPELL = 9; + static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_INNATE_SKILL = 25; static const uint32 MAX_PP_AA_ARRAY = 240; @@ -824,7 +823,7 @@ struct PlayerProfile_Struct /*00024*/ BindStruct binds[5]; // Bind points (primary is first) /*00124*/ uint32 deity; // deity /*00128*/ uint32 intoxication; // Alcohol level (in ticks till sober?) -/*00132*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; // Refresh time (millis) +/*00132*/ uint32 spellSlotRefresh[spells::SPELL_GEM_COUNT]; // Refresh time (millis) /*00168*/ uint32 abilitySlotRefresh; /*00172*/ uint8 haircolor; // Player hair color /*00173*/ uint8 beardcolor; // Player beard color @@ -849,9 +848,9 @@ struct PlayerProfile_Struct /*02260*/ uint32 WIS; // Wisdom /*02264*/ uint8 face; // Player face /*02265*/ uint8 unknown02264[47]; -/*02312*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook +/*02312*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook /*03912*/ uint8 unknown4184[448]; // all 0xff after last spell -/*04360*/ uint32 mem_spells[MAX_PP_MEMSPELL]; // List of spells memorized +/*04360*/ uint32 mem_spells[spells::SPELL_GEM_COUNT]; // List of spells memorized /*04396*/ uint8 unknown04396[32]; /*04428*/ uint32 platinum; // Platinum Pieces on player /*04432*/ uint32 gold; // Gold Pieces on player @@ -3271,7 +3270,7 @@ struct AnnoyingZoneUnknown_Struct { }; struct LoadSpellSet_Struct { - uint32 spell[MAX_PP_MEMSPELL]; + uint32 spell[spells::SPELL_GEM_COUNT]; uint32 unknown; }; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index b199197a2..47d6bb4ff 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -59,8 +59,8 @@ namespace UF // client to server say link converter static inline void UFToServerSayLink(std::string& serverSayLink, const std::string& ufSayLink); - static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot); - static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot); + static inline spells::CastingSlot ServerToUFCastingSlot(EQEmu::spells::CastingSlot slot); + static inline EQEmu::spells::CastingSlot UFToServerCastingSlot(spells::CastingSlot slot); static inline int ServerToUFBuffSlot(int index); static inline int UFToServerBuffSlot(int index); @@ -1682,7 +1682,7 @@ namespace UF } OUT(deity); OUT(intoxication); - OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); + OUT_array(spellSlotRefresh, spells::SPELL_GEM_COUNT); OUT(abilitySlotRefresh); OUT(points); // Relocation Test // OUT(unknown0166[4]); @@ -1724,10 +1724,10 @@ namespace UF OUT(WIS); OUT(face); // OUT(unknown02264[47]); - memset(eq->spell_book, 0xFF, sizeof(uint32)* structs::MAX_PP_SPELLBOOK); + memset(eq->spell_book, 0xFF, sizeof(uint32)* spells::SPELLBOOK_SIZE); OUT_array(spell_book, 480U); // OUT(unknown4184[128]); - OUT_array(mem_spells, structs::MAX_PP_MEMSPELL); + OUT_array(mem_spells, spells::SPELL_GEM_COUNT); // OUT(unknown04396[32]); OUT(platinum); OUT(gold); @@ -3142,7 +3142,7 @@ namespace UF DECODE_LENGTH_EXACT(structs::CastSpell_Struct); SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - emu->slot = static_cast(UFToServerCastingSlot(static_cast(eq->slot))); + emu->slot = static_cast(UFToServerCastingSlot(static_cast(eq->slot))); IN(spell_id); emu->inventoryslot = UFToServerSlot(eq->inventoryslot); @@ -3491,7 +3491,7 @@ namespace UF DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); - for (unsigned int i = 0; i < MAX_PP_MEMSPELL; ++i) + for (unsigned int i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) if (eq->spell[i] == 0) emu->spell[i] = 0xFFFFFFFF; else @@ -4380,80 +4380,80 @@ namespace UF } } - static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot) + static inline spells::CastingSlot ServerToUFCastingSlot(EQEmu::spells::CastingSlot slot) { switch (slot) { - case EQEmu::CastingSlot::Gem1: - return CastingSlot::Gem1; - case EQEmu::CastingSlot::Gem2: - return CastingSlot::Gem2; - case EQEmu::CastingSlot::Gem3: - return CastingSlot::Gem3; - case EQEmu::CastingSlot::Gem4: - return CastingSlot::Gem4; - case EQEmu::CastingSlot::Gem5: - return CastingSlot::Gem5; - case EQEmu::CastingSlot::Gem6: - return CastingSlot::Gem6; - case EQEmu::CastingSlot::Gem7: - return CastingSlot::Gem7; - case EQEmu::CastingSlot::Gem8: - return CastingSlot::Gem8; - case EQEmu::CastingSlot::Gem9: - return CastingSlot::Gem9; - case EQEmu::CastingSlot::Gem10: - return CastingSlot::Gem10; - case EQEmu::CastingSlot::Gem11: - return CastingSlot::Gem11; - case EQEmu::CastingSlot::Gem12: - return CastingSlot::Gem12; - case EQEmu::CastingSlot::Item: - case EQEmu::CastingSlot::PotionBelt: - return CastingSlot::Item; - case EQEmu::CastingSlot::Discipline: - return CastingSlot::Discipline; - case EQEmu::CastingSlot::AltAbility: - return CastingSlot::AltAbility; + case EQEmu::spells::CastingSlot::Gem1: + return spells::CastingSlot::Gem1; + case EQEmu::spells::CastingSlot::Gem2: + return spells::CastingSlot::Gem2; + case EQEmu::spells::CastingSlot::Gem3: + return spells::CastingSlot::Gem3; + case EQEmu::spells::CastingSlot::Gem4: + return spells::CastingSlot::Gem4; + case EQEmu::spells::CastingSlot::Gem5: + return spells::CastingSlot::Gem5; + case EQEmu::spells::CastingSlot::Gem6: + return spells::CastingSlot::Gem6; + case EQEmu::spells::CastingSlot::Gem7: + return spells::CastingSlot::Gem7; + case EQEmu::spells::CastingSlot::Gem8: + return spells::CastingSlot::Gem8; + case EQEmu::spells::CastingSlot::Gem9: + return spells::CastingSlot::Gem9; + case EQEmu::spells::CastingSlot::Gem10: + return spells::CastingSlot::Gem10; + case EQEmu::spells::CastingSlot::Gem11: + return spells::CastingSlot::Gem11; + case EQEmu::spells::CastingSlot::Gem12: + return spells::CastingSlot::Gem12; + case EQEmu::spells::CastingSlot::Item: + case EQEmu::spells::CastingSlot::PotionBelt: + return spells::CastingSlot::Item; + case EQEmu::spells::CastingSlot::Discipline: + return spells::CastingSlot::Discipline; + case EQEmu::spells::CastingSlot::AltAbility: + return spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return CastingSlot::Discipline; + return spells::CastingSlot::Discipline; } } - static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot) + static inline EQEmu::spells::CastingSlot UFToServerCastingSlot(spells::CastingSlot slot) { switch (slot) { - case CastingSlot::Gem1: - return EQEmu::CastingSlot::Gem1; - case CastingSlot::Gem2: - return EQEmu::CastingSlot::Gem2; - case CastingSlot::Gem3: - return EQEmu::CastingSlot::Gem3; - case CastingSlot::Gem4: - return EQEmu::CastingSlot::Gem4; - case CastingSlot::Gem5: - return EQEmu::CastingSlot::Gem5; - case CastingSlot::Gem6: - return EQEmu::CastingSlot::Gem6; - case CastingSlot::Gem7: - return EQEmu::CastingSlot::Gem7; - case CastingSlot::Gem8: - return EQEmu::CastingSlot::Gem8; - case CastingSlot::Gem9: - return EQEmu::CastingSlot::Gem9; - case CastingSlot::Gem10: - return EQEmu::CastingSlot::Gem10; - case CastingSlot::Gem11: - return EQEmu::CastingSlot::Gem11; - case CastingSlot::Gem12: - return EQEmu::CastingSlot::Gem12; - case CastingSlot::Discipline: - return EQEmu::CastingSlot::Discipline; - case CastingSlot::Item: - return EQEmu::CastingSlot::Item; - case CastingSlot::AltAbility: - return EQEmu::CastingSlot::AltAbility; + case spells::CastingSlot::Gem1: + return EQEmu::spells::CastingSlot::Gem1; + case spells::CastingSlot::Gem2: + return EQEmu::spells::CastingSlot::Gem2; + case spells::CastingSlot::Gem3: + return EQEmu::spells::CastingSlot::Gem3; + case spells::CastingSlot::Gem4: + return EQEmu::spells::CastingSlot::Gem4; + case spells::CastingSlot::Gem5: + return EQEmu::spells::CastingSlot::Gem5; + case spells::CastingSlot::Gem6: + return EQEmu::spells::CastingSlot::Gem6; + case spells::CastingSlot::Gem7: + return EQEmu::spells::CastingSlot::Gem7; + case spells::CastingSlot::Gem8: + return EQEmu::spells::CastingSlot::Gem8; + case spells::CastingSlot::Gem9: + return EQEmu::spells::CastingSlot::Gem9; + case spells::CastingSlot::Gem10: + return EQEmu::spells::CastingSlot::Gem10; + case spells::CastingSlot::Gem11: + return EQEmu::spells::CastingSlot::Gem11; + case spells::CastingSlot::Gem12: + return EQEmu::spells::CastingSlot::Gem12; + case spells::CastingSlot::Discipline: + return EQEmu::spells::CastingSlot::Discipline; + case spells::CastingSlot::Item: + return EQEmu::spells::CastingSlot::Item; + case spells::CastingSlot::AltAbility: + return EQEmu::spells::CastingSlot::AltAbility; default: // we shouldn't have any issues with other slots ... just return something - return EQEmu::CastingSlot::Discipline; + return EQEmu::spells::CastingSlot::Discipline; } } diff --git a/common/patches/uf.h b/common/patches/uf.h index 1dc5046c3..c36d9e851 100644 --- a/common/patches/uf.h +++ b/common/patches/uf.h @@ -50,24 +50,6 @@ namespace UF #include "uf_ops.h" }; - enum class CastingSlot : uint32 { - Gem1 = 0, - Gem2 = 1, - Gem3 = 2, - Gem4 = 3, - Gem5 = 4, - Gem6 = 5, - Gem7 = 6, - Gem8 = 7, - Gem9 = 8, - Gem10 = 9, - Gem11 = 10, - Gem12 = 11, - Item = 12, - Discipline = 13, - AltAbility = 0xFF - }; - }; /*UF*/ #endif /*COMMON_UF_H*/ diff --git a/common/patches/uf_limits.h b/common/patches/uf_limits.h index 87752a91e..5f5d5e199 100644 --- a/common/patches/uf_limits.h +++ b/common/patches/uf_limits.h @@ -314,6 +314,34 @@ namespace UF } /*skills*/ + namespace spells { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::UF; } + + enum class CastingSlot : uint32 { + Gem1 = 0, + Gem2 = 1, + Gem3 = 2, + Gem4 = 3, + Gem5 = 4, + Gem6 = 5, + Gem7 = 6, + Gem8 = 7, + Gem9 = 8, + Gem10 = 9, + Gem11 = 10, + Gem12 = 11, + MaxGems = 12, + Item = 12, + Discipline = 13, + AltAbility = 0xFF + }; + + const int SPELL_ID_MAX = 28000; + const int SPELLBOOK_SIZE = 720; + const int SPELL_GEM_COUNT = static_cast(CastingSlot::MaxGems); + + } /*spells*/ + }; /*UF*/ #endif /*COMMON_UF_LIMITS_H*/ diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index fe58b73b2..8e3309734 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -845,8 +845,7 @@ struct BindStruct { ** OpCode: 0x006a */ 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 = 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_INNATE_SKILL = 25; static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 @@ -916,7 +915,7 @@ struct PlayerProfile_Struct /*00060*/ BindStruct binds[5]; // Bind points (primary is first) /*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 +/*00168*/ uint32 spellSlotRefresh[spells::SPELL_GEM_COUNT]; // Refresh time (millis) - 4 Octets Each /*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 @@ -943,8 +942,8 @@ struct PlayerProfile_Struct /*04188*/ uint8 unknown04188[28]; // /*04216*/ uint8 face; // Player face - Actually uint32? /*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 +/*04364*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook 720 = 90 pages [2880] was [1920] +/*07244*/ uint32 mem_spells[spells::SPELL_GEM_COUNT]; // List of spells memorized /*07284*/ uint8 unknown07284[20]; //#### uint8 unknown04396[32]; in Titanium ####[28] /*07312*/ uint32 platinum; // Platinum Pieces on player /*07316*/ uint32 gold; // Gold Pieces on player @@ -3907,7 +3906,7 @@ struct AnnoyingZoneUnknown_Struct { }; struct LoadSpellSet_Struct { - uint8 spell[MAX_PP_MEMSPELL]; // 0 if no action + uint8 spell[spells::SPELL_GEM_COUNT]; // 0 if no action uint32 unknown; // there seems to be an extra field in this packet... }; diff --git a/world/client.cpp b/world/client.cpp index 30c57db5d..822b648b6 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1529,10 +1529,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) // strcpy(pp.servername, WorldConfig::get()->ShortName.c_str()); - for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++) + for (i = 0; i < EQEmu::spells::SPELLBOOK_SIZE; i++) pp.spell_book[i] = 0xFFFFFFFF; - for(i = 0; i < MAX_PP_MEMSPELL; i++) + for(i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; i++) pp.mem_spells[i] = 0xFFFFFFFF; for(i = 0; i < BUFF_COUNT; i++) diff --git a/zone/aa.cpp b/zone/aa.cpp index dfbf9de12..48ee715f7 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1221,12 +1221,12 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) { // Bards can cast instant cast AAs while they are casting another song if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) { - if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), EQEmu::CastingSlot::AltAbility, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) { + if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), EQEmu::spells::CastingSlot::AltAbility, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) { return; } ExpendAlternateAdvancementCharge(ability->id); } else { - if(!CastSpell(rank->spell, target_id, EQEmu::CastingSlot::AltAbility, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) { + if(!CastSpell(rank->spell, target_id, EQEmu::spells::CastingSlot::AltAbility, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) { return; } } diff --git a/zone/attack.cpp b/zone/attack.cpp index 4c13f6362..483cce368 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1526,7 +1526,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b IsValidSpell(aabonuses.SkillAttackProc[2])) { float chance = aabonuses.SkillAttackProc[0] / 1000.0f; if (zone->random.Roll(chance)) - SpellFinished(aabonuses.SkillAttackProc[2], other, EQEmu::CastingSlot::Item, 0, -1, + SpellFinished(aabonuses.SkillAttackProc[2], other, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[2]].ResistDiff); } other->Damage(this, my_hit.damage_done, SPELL_UNKNOWN, my_hit.skill, true, -1, false, m_specialattacks); @@ -2130,7 +2130,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill if (IsLDoNTrapped()) { Message_StringID(13, LDON_ACCIDENT_SETOFF2); - SpellFinished(GetLDoNTrapSpellID(), other, EQEmu::CastingSlot::Item, 0, -1, spells[GetLDoNTrapSpellID()].ResistDiff, false); + SpellFinished(GetLDoNTrapSpellID(), other, EQEmu::spells::CastingSlot::Item, 0, -1, spells[GetLDoNTrapSpellID()].ResistDiff, false); SetLDoNTrapSpellID(0); SetLDoNTrapped(false); SetLDoNTrapDetected(false); diff --git a/zone/bot.cpp b/zone/bot.cpp index 125d933b1..4076eafef 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -6263,7 +6263,7 @@ void Bot::DoBuffTic(const Buffs_Struct &buff, int slot, Mob* caster) { Mob::DoBuffTic(buff, slot, caster); } -bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot, int32 cast_time, int32 mana_cost, +bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlot slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, int16 *resist_adjust, uint32 aa_id) { bool Result = false; if(zone && !zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) { @@ -6303,7 +6303,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot, return false; } - if(slot < EQEmu::CastingSlot::MaxGems && !CheckFizzle(spell_id)) { + if(slot < EQEmu::spells::CastingSlot::MaxGems && !CheckFizzle(spell_id)) { int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE; InterruptSpell(fizzle_msg, 0x121, spell_id); @@ -6317,7 +6317,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot, Log(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); bardsong = 0; bardsong_target_id = 0; - bardsong_slot = EQEmu::CastingSlot::Gem1; + bardsong_slot = EQEmu::spells::CastingSlot::Gem1; bardsong_timer.Disable(); } @@ -6447,7 +6447,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { return Result; } -bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQEmu::CastingSlot slot) { +bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQEmu::spells::CastingSlot slot) { bool Result = false; SpellTargetType targetType = spells[spell_id].targettype; if(targetType == ST_GroupClientAndPet) { @@ -6460,7 +6460,7 @@ bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce return Result; } -bool Bot::DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 aa_id) { +bool Bot::DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlot slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 aa_id) { bool Result = false; if(GetClass() == BARD) cast_time = 0; @@ -6564,7 +6564,7 @@ void Bot::GenerateSpecialAttacks() { SetSpecialAbility(SPECATK_TRIPLE, 1); } -bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool& stopLogic) { +bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::spells::CastingSlot slot, bool& stopLogic) { if(GetClass() == BARD) { if(!ApplyNextBardPulse(bardsong, this, bardsong_slot)) InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong); @@ -6574,7 +6574,7 @@ bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::Cast return true; } -bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool& stopLogic) { +bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::spells::CastingSlot slot, bool& stopLogic) { if(spellTarget) { if(IsGrouped() && (spellTarget->IsBot() || spellTarget->IsClient()) && RuleB(Bots, GroupBuffing)) { bool noGroupSpell = false; @@ -6586,7 +6586,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu:: bool spelltypeequal = ((spelltype == 2) || (spelltype == 16) || (spelltype == 32)); bool spelltypetargetequal = ((spelltype == 8) && (spells[thespell].targettype == ST_Self)); bool spelltypeclassequal = ((spelltype == 1024) && (GetClass() == SHAMAN)); - bool slotequal = (slot == EQEmu::CastingSlot::Item); + bool slotequal = (slot == EQEmu::spells::CastingSlot::Item); if(spellequal || slotequal) { if((spelltypeequal || spelltypetargetequal) || spelltypeclassequal || slotequal) { if(((spells[thespell].effectid[0] == 0) && (spells[thespell].base[0] < 0)) && @@ -6625,7 +6625,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu:: return true; } -bool Bot::DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool& stopLogic) { +bool Bot::DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQEmu::spells::CastingSlot slot, bool& stopLogic) { bool isMainGroupMGB = false; if(isMainGroupMGB && (GetClass() != BARD)) { BotGroupSay(this, "MGB %s", spells[spell_id].name); @@ -8708,7 +8708,7 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) { if(IsCasting()) InterruptSpell(); - CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline); + CastSpell(spell_id, target, EQEmu::spells::CastingSlot::Discipline); return true; } diff --git a/zone/bot.h b/zone/bot.h index d80ac5ad6..6a528a4e7 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -322,9 +322,9 @@ public: virtual void SetAttackTimer(); uint32 GetClassHPFactor(); virtual int32 CalcMaxHP(); - bool DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool &stopLogic); - bool DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool &stopLogic); - bool DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool &stopLogic); + bool DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::spells::CastingSlot slot, bool &stopLogic); + bool DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::spells::CastingSlot slot, bool &stopLogic); + bool DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQEmu::spells::CastingSlot slot, bool &stopLogic); void SendBotArcheryWearChange(uint8 material_slot, uint32 material, uint32 color); void Camp(bool databaseSave = true); virtual void AddToHateList(Mob* other, uint32 hate = 0, int32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false, bool pet_command = false); @@ -425,12 +425,12 @@ public: virtual float GetAOERange(uint16 spell_id); virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100); virtual void DoBuffTic(const Buffs_Struct &buff, int slot, Mob* caster = nullptr); - virtual bool CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, + virtual bool CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlot slot = EQEmu::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, int16 *resist_adjust = nullptr, uint32 aa_id = 0); virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar); virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster); - virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQEmu::CastingSlot slot); - virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0); + virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQEmu::spells::CastingSlot slot); + virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlot slot = EQEmu::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0); // Bot Equipment & Inventory Class Methods void BotTradeSwapItem(Client* client, int16 lootSlot, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap = true); diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index fe5dcd69f..b44681341 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -7774,7 +7774,7 @@ bool helper_cast_standard_spell(Bot* casting_bot, Mob* target_mob, int spell_id, if (annouce_cast) Bot::BotGroupSay(casting_bot, "Attempting to cast '%s' on %s", spells[spell_id].name, target_mob->GetCleanName()); - return casting_bot->CastSpell(spell_id, target_mob->GetID(), EQEmu::CastingSlot::Gem2, -1, -1, dont_root_before); + return casting_bot->CastSpell(spell_id, target_mob->GetID(), EQEmu::spells::CastingSlot::Gem2, -1, -1, dont_root_before); } bool helper_command_alias_fail(Client *bot_owner, const char* command_handler, const char *alias, const char *command) diff --git a/zone/client.cpp b/zone/client.cpp index da5430ff7..b625210ee 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4950,7 +4950,7 @@ void Client::HandleLDoNOpen(NPC *target) if(target->GetLDoNTrapSpellID() != 0) { Message_StringID(13, LDON_ACCIDENT_SETOFF2); - target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff); + target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff); target->SetLDoNTrapSpellID(0); target->SetLDoNTrapped(false); target->SetLDoNTrapDetected(false); @@ -5072,7 +5072,7 @@ void Client::HandleLDoNDisarm(NPC *target, uint16 skill, uint8 type) break; case -1: Message_StringID(13, LDON_ACCIDENT_SETOFF2); - target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff); + target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff); target->SetLDoNTrapSpellID(0); target->SetLDoNTrapped(false); target->SetLDoNTrapDetected(false); @@ -5091,7 +5091,7 @@ void Client::HandleLDoNPickLock(NPC *target, uint16 skill, uint8 type) if(target->IsLDoNTrapped()) { Message_StringID(13, LDON_ACCIDENT_SETOFF2); - target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff); + target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff); target->SetLDoNTrapSpellID(0); target->SetLDoNTrapped(false); target->SetLDoNTrapDetected(false); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 541eb2e81..797075108 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -530,7 +530,7 @@ void Client::CompleteConnect() SendAppearancePacket(AT_GuildID, GuildID(), false); SendAppearancePacket(AT_GuildRank, rank, false); } - for (uint32 spellInt = 0; spellInt < MAX_PP_REF_SPELLBOOK; spellInt++) { + for (uint32 spellInt = 0; spellInt < EQEmu::spells::SPELLBOOK_SIZE; spellInt++) { if (m_pp.spell_book[spellInt] < 3 || m_pp.spell_book[spellInt] > 50000) m_pp.spell_book[spellInt] = 0xFFFFFFFF; } @@ -1412,7 +1412,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) } if (SPDAT_RECORDS > 0) { - for (uint32 z = 0; z= (uint32)SPDAT_RECORDS) UnmemSpell(z, false); } @@ -1544,7 +1544,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) } /* Load Spell Slot Refresh from Currently Memoried Spells */ - for (unsigned int i = 0; i < MAX_PP_MEMSPELL; ++i) + for (unsigned int i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) if (IsValidSpell(m_pp.mem_spells[i])) m_pp.spellSlotRefresh[i] = p_timers.GetRemainingTime(pTimerSpellStart + m_pp.mem_spells[i]) * 1000; @@ -4006,7 +4006,7 @@ void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) { - using EQEmu::CastingSlot; + using EQEmu::spells::CastingSlot; if (app->size != sizeof(CastSpell_Struct)) { std::cout << "Wrong size: OP_CastSpell, size=" << app->size << ", expected " << sizeof(CastSpell_Struct) << std::endl; return; @@ -4027,14 +4027,14 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) /* Memorized Spell */ if (m_pp.mem_spells[castspell->slot] && m_pp.mem_spells[castspell->slot] == castspell->spell_id) { uint16 spell_to_cast = 0; - if (castspell->slot < MAX_PP_MEMSPELL) { + if (castspell->slot < EQEmu::spells::SPELL_GEM_COUNT) { spell_to_cast = m_pp.mem_spells[castspell->slot]; if (spell_to_cast != castspell->spell_id) { InterruptSpell(castspell->spell_id); //CHEATER!!! return; } } - else if (castspell->slot >= MAX_PP_MEMSPELL) { + else if (castspell->slot >= EQEmu::spells::SPELL_GEM_COUNT) { InterruptSpell(); return; } @@ -5253,7 +5253,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app) EQApplicationPacket* outapp = app->Copy(); DeleteSpell_Struct* dss = (DeleteSpell_Struct*)outapp->pBuffer; - if (dss->spell_slot < 0 || dss->spell_slot > int(MAX_PP_SPELLBOOK)) + if (dss->spell_slot < 0 || dss->spell_slot > int(EQEmu::spells::SPELLBOOK_SIZE)) return; if (m_pp.spell_book[dss->spell_slot] != SPELLBOOK_UNKNOWN) { @@ -8451,7 +8451,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { - using EQEmu::CastingSlot; + using EQEmu::spells::CastingSlot; if (app->size != sizeof(ItemVerifyRequest_Struct)) { Log(Logs::General, Logs::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); @@ -9177,7 +9177,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) } int i; LoadSpellSet_Struct* ss = (LoadSpellSet_Struct*)app->pBuffer; - for (i = 0; ispell[i] != 0xFFFFFFFF) UnmemSpell(i, true); } @@ -13327,7 +13327,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) const SwapSpell_Struct* swapspell = (const SwapSpell_Struct*)app->pBuffer; int swapspelltemp; - if (swapspell->from_slot < 0 || swapspell->from_slot > MAX_PP_SPELLBOOK || swapspell->to_slot < 0 || swapspell->to_slot > MAX_PP_SPELLBOOK) + if (swapspell->from_slot < 0 || swapspell->from_slot > EQEmu::spells::SPELLBOOK_SIZE || swapspell->to_slot < 0 || swapspell->to_slot > EQEmu::spells::SPELLBOOK_SIZE) return; swapspelltemp = m_pp.spell_book[swapspell->from_slot]; diff --git a/zone/command.cpp b/zone/command.cpp index f65a4cd11..c2b36c6e6 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2609,14 +2609,14 @@ void command_castspell(Client *c, const Seperator *sep) else if (c->GetTarget() == 0) if(c->Admin() >= commandInstacast) - c->SpellFinished(spellid, 0, EQEmu::CastingSlot::Item, 0, -1, spells[spellid].ResistDiff); + c->SpellFinished(spellid, 0, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spellid].ResistDiff); else - c->CastSpell(spellid, 0, EQEmu::CastingSlot::Item, 0); + c->CastSpell(spellid, 0, EQEmu::spells::CastingSlot::Item, 0); else if(c->Admin() >= commandInstacast) - c->SpellFinished(spellid, c->GetTarget(), EQEmu::CastingSlot::Item, 0, -1, spells[spellid].ResistDiff); + c->SpellFinished(spellid, c->GetTarget(), EQEmu::spells::CastingSlot::Item, 0, -1, spells[spellid].ResistDiff); else - c->CastSpell(spellid, c->GetTarget()->GetID(), EQEmu::CastingSlot::Item, 0); + c->CastSpell(spellid, c->GetTarget()->GetID(), EQEmu::spells::CastingSlot::Item, 0); } } @@ -4620,7 +4620,7 @@ void command_memspell(Client *c, const Seperator *sep) { slot = atoi(sep->arg[1]) - 1; spell_id = atoi(sep->arg[2]); - if (slot > MAX_PP_MEMSPELL || spell_id >= SPDAT_RECORDS) + if (slot > EQEmu::spells::SPELL_GEM_COUNT || spell_id >= SPDAT_RECORDS) { c->Message(0, "Error: #MemSpell: Arguement out of range"); } @@ -6301,7 +6301,7 @@ void command_scribespells(Client *c, const Seperator *sep) c->Message(0, "Scribing spells for %s.", t->GetName()); Log(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); - for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) + for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < EQEmu::spells::SPELLBOOK_SIZE; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { if ( diff --git a/zone/effects.cpp b/zone/effects.cpp index 6b0c2a2ad..7887eb652 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -643,9 +643,9 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { } if (reduced_recast > 0) - CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); + CastSpell(spell_id, target, EQEmu::spells::CastingSlot::Discipline, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); else{ - CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline); + CastSpell(spell_id, target, EQEmu::spells::CastingSlot::Discipline); return true; } @@ -653,7 +653,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { } else { - CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline); + CastSpell(spell_id, target, EQEmu::spells::CastingSlot::Discipline); } return(true); } diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 33d786b11..59d50508e 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -770,28 +770,28 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id) { bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, static_cast(slot)); + return self->CastSpell(spell_id, target_id, static_cast(slot)); } bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time); + return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time); } bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost); + return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost); } bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, static_cast(item_slot)); + return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, static_cast(item_slot)); } bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, int timer_duration) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, static_cast(item_slot), + return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, static_cast(item_slot), static_cast(timer), static_cast(timer_duration)); } @@ -800,7 +800,7 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, in Lua_Safe_Call_Bool(); int16 res = resist_adjust; - return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, static_cast(item_slot), + return self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, static_cast(item_slot), static_cast(timer), static_cast(timer_duration), &res); } @@ -811,27 +811,27 @@ bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target) { bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot) { Lua_Safe_Call_Bool(); - return self->SpellFinished(spell_id, target, static_cast(slot)); + return self->SpellFinished(spell_id, target, static_cast(slot)); } bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used) { Lua_Safe_Call_Bool(); - return self->SpellFinished(spell_id, target, static_cast(slot), mana_used); + return self->SpellFinished(spell_id, target, static_cast(slot), mana_used); } bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot) { Lua_Safe_Call_Bool(); - return self->SpellFinished(spell_id, target, static_cast(slot), mana_used, inventory_slot); + return self->SpellFinished(spell_id, target, static_cast(slot), mana_used, inventory_slot); } bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust) { Lua_Safe_Call_Bool(); - return self->SpellFinished(spell_id, target, static_cast(slot), mana_used, inventory_slot, resist_adjust); + return self->SpellFinished(spell_id, target, static_cast(slot), mana_used, inventory_slot, resist_adjust); } bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust, bool proc) { Lua_Safe_Call_Bool(); - return self->SpellFinished(spell_id, target, static_cast(slot), mana_used, inventory_slot, resist_adjust, proc); + return self->SpellFinished(spell_id, target, static_cast(slot), mana_used, inventory_slot, resist_adjust, proc); } void Lua_Mob::SendBeginCast(int spell_id, int cast_time) { diff --git a/zone/merc.cpp b/zone/merc.cpp index b33cade34..1825a23eb 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1993,7 +1993,7 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0); SetMoving(false); - result = CastSpell(spellid, tar->GetID(), EQEmu::CastingSlot::Gem2, -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, 0); + result = CastSpell(spellid, tar->GetID(), EQEmu::spells::CastingSlot::Gem2, -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, 0); if(IsCasting() && IsSitting()) Stand(); @@ -4045,7 +4045,7 @@ bool Merc::UseDiscipline(int32 spell_id, int32 target) { if(IsCasting()) InterruptSpell(); - CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline); + CastSpell(spell_id, target, EQEmu::spells::CastingSlot::Discipline); return(true); } diff --git a/zone/mob.cpp b/zone/mob.cpp index b193e8bcb..773c53767 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3123,12 +3123,12 @@ void Mob::ExecWeaponProc(const EQEmu::ItemInstance *inst, uint16 spell_id, Mob * twinproc = true; if (IsBeneficialSpell(spell_id) && (!IsNPC() || (IsNPC() && CastToNPC()->GetInnateProcSpellID() != spell_id))) { // NPC innate procs don't take this path ever - SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff, true, level_override); + SpellFinished(spell_id, this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff, true, level_override); if(twinproc) SpellOnTarget(spell_id, this, false, false, 0, true, level_override); } else if(!(on->IsClient() && on->CastToClient()->dead)) { //dont proc on dead clients - SpellFinished(spell_id, on, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff, true, level_override); + SpellFinished(spell_id, on, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff, true, level_override); if(twinproc) SpellOnTarget(spell_id, on, false, false, 0, true, level_override); } @@ -3465,7 +3465,7 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger) trigger_spell_id = CastToClient()->CalcAAFocus(focusTriggerOnCast, *rank, spell_id); if (IsValidSpell(trigger_spell_id) && GetTarget()) - SpellFinished(trigger_spell_id, GetTarget(), EQEmu::CastingSlot::Item, 0, -1, + SpellFinished(trigger_spell_id, GetTarget(), EQEmu::spells::CastingSlot::Item, 0, -1, spells[trigger_spell_id].ResistDiff); } @@ -3473,7 +3473,7 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger) trigger_spell_id = CalcFocusEffect(focusTriggerOnCast, focus_spell, spell_id); if (IsValidSpell(trigger_spell_id) && GetTarget()) { - SpellFinished(trigger_spell_id, GetTarget(), EQEmu::CastingSlot::Item, 0, -1, + SpellFinished(trigger_spell_id, GetTarget(), EQEmu::spells::CastingSlot::Item, 0, -1, spells[trigger_spell_id].ResistDiff); CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); } @@ -3504,7 +3504,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) { // If we trigger an effect then its over. if (IsValidSpell(spells[spell_id].base2[i])){ - SpellFinished(spells[spell_id].base2[i], target, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); + SpellFinished(spells[spell_id].base2[i], target, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); return true; } } @@ -3523,7 +3523,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) if(zone->random.Int(0, 100) <= spells[spell_id].base[effect]) { if (IsValidSpell(spells[spell_id].base2[effect])){ - SpellFinished(spells[spell_id].base2[effect], target, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[effect]].ResistDiff); + SpellFinished(spells[spell_id].base2[effect], target, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[effect]].ResistDiff); return true; //Only trigger once of these per spell effect. } } @@ -3600,7 +3600,7 @@ void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsP } if (use_spell){ - SpellFinished(spells[spell_id].base[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spells[spell_id].base[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); if(!TryFadeEffect(e)) BuffFadeBySlot(e); @@ -3628,7 +3628,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id) if(zone->random.Roll(focus)) { Message(MT_Spells,"You twincast %s!",spells[spell_id].name); - SpellFinished(spell_id, target, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spell_id, target, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } } } @@ -3646,7 +3646,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id) { if(zone->random.Roll(focus)) { - SpellFinished(spell_id, target, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spell_id, target, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } } } @@ -3774,10 +3774,10 @@ bool Mob::TryFadeEffect(int slot) if(IsValidSpell(spell_id)) { if (IsBeneficialSpell(spell_id)) { - SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spell_id, this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } else if(!(IsClient() && CastToClient()->dead)) { - SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spell_id, this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } return true; } @@ -3811,7 +3811,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) SpellFinished(focus_trigger, target); else - SpellFinished(focus_trigger, this, EQEmu::CastingSlot::Item, 0, -1, spells[focus_trigger].ResistDiff); + SpellFinished(focus_trigger, this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[focus_trigger].ResistDiff); } // For detrimental spells, if the triggered spell is beneficial, then it will land on the caster // if the triggered spell is also detrimental, then it will land on the target @@ -3821,7 +3821,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) SpellFinished(focus_trigger, this); else - SpellFinished(focus_trigger, target, EQEmu::CastingSlot::Item, 0, -1, spells[focus_trigger].ResistDiff); + SpellFinished(focus_trigger, target, EQEmu::spells::CastingSlot::Item, 0, -1, spells[focus_trigger].ResistDiff); } CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); @@ -4470,7 +4470,7 @@ void Mob::TrySpellOnKill(uint8 level, uint16 spell_id) if (IsValidSpell(spells[spell_id].base2[i]) && spells[spell_id].max[i] <= level) { if(zone->random.Roll(spells[spell_id].base[i])) - SpellFinished(spells[spell_id].base2[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); + SpellFinished(spells[spell_id].base2[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); } } } @@ -4485,17 +4485,17 @@ void Mob::TrySpellOnKill(uint8 level, uint16 spell_id) if(aabonuses.SpellOnKill[i] && IsValidSpell(aabonuses.SpellOnKill[i]) && (level >= aabonuses.SpellOnKill[i + 2])) { if(zone->random.Roll(static_cast(aabonuses.SpellOnKill[i + 1]))) - SpellFinished(aabonuses.SpellOnKill[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); + SpellFinished(aabonuses.SpellOnKill[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); } if(itembonuses.SpellOnKill[i] && IsValidSpell(itembonuses.SpellOnKill[i]) && (level >= itembonuses.SpellOnKill[i + 2])){ if(zone->random.Roll(static_cast(itembonuses.SpellOnKill[i + 1]))) - SpellFinished(itembonuses.SpellOnKill[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); + SpellFinished(itembonuses.SpellOnKill[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); } if(spellbonuses.SpellOnKill[i] && IsValidSpell(spellbonuses.SpellOnKill[i]) && (level >= spellbonuses.SpellOnKill[i + 2])) { if(zone->random.Roll(static_cast(spellbonuses.SpellOnKill[i + 1]))) - SpellFinished(spellbonuses.SpellOnKill[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); + SpellFinished(spellbonuses.SpellOnKill[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); } } @@ -4512,19 +4512,19 @@ bool Mob::TrySpellOnDeath() for(int i = 0; i < MAX_SPELL_TRIGGER*2; i+=2) { if(IsClient() && aabonuses.SpellOnDeath[i] && IsValidSpell(aabonuses.SpellOnDeath[i])) { if(zone->random.Roll(static_cast(aabonuses.SpellOnDeath[i + 1]))) { - SpellFinished(aabonuses.SpellOnDeath[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnDeath[i]].ResistDiff); + SpellFinished(aabonuses.SpellOnDeath[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnDeath[i]].ResistDiff); } } if(itembonuses.SpellOnDeath[i] && IsValidSpell(itembonuses.SpellOnDeath[i])) { if(zone->random.Roll(static_cast(itembonuses.SpellOnDeath[i + 1]))) { - SpellFinished(itembonuses.SpellOnDeath[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[itembonuses.SpellOnDeath[i]].ResistDiff); + SpellFinished(itembonuses.SpellOnDeath[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[itembonuses.SpellOnDeath[i]].ResistDiff); } } if(spellbonuses.SpellOnDeath[i] && IsValidSpell(spellbonuses.SpellOnDeath[i])) { if(zone->random.Roll(static_cast(spellbonuses.SpellOnDeath[i + 1]))) { - SpellFinished(spellbonuses.SpellOnDeath[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spellbonuses.SpellOnDeath[i]].ResistDiff); + SpellFinished(spellbonuses.SpellOnDeath[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spellbonuses.SpellOnDeath[i]].ResistDiff); } } } diff --git a/zone/mob.h b/zone/mob.h index 56d6e5e4f..40e1a0dfd 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -278,7 +278,7 @@ public: //Song bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); - bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, EQEmu::CastingSlot slot); + bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, EQEmu::spells::CastingSlot slot); void BardPulse(uint16 spell_id, Mob *caster); //Spell @@ -309,24 +309,24 @@ public: void SendSpellBarEnable(uint16 spellid); void ZeroCastingVars(); virtual void SpellProcess(); - virtual bool CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, + virtual bool CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlot slot = EQEmu::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, int16 *resist_adjust = nullptr, uint32 aa_id = 0); - virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, + virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlot slot = EQEmu::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, int16 resist_adjust = 0, uint32 aa_id = 0); - void CastedSpellFinished(uint16 spell_id, uint32 target_id, EQEmu::CastingSlot slot, uint16 mana_used, + void CastedSpellFinished(uint16 spell_id, uint32 target_id, EQEmu::spells::CastingSlot slot, uint16 mana_used, uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0); - bool SpellFinished(uint16 spell_id, Mob *target, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, uint16 mana_used = 0, + bool SpellFinished(uint16 spell_id, Mob *target, EQEmu::spells::CastingSlot slot = EQEmu::spells::CastingSlot::Item, uint16 mana_used = 0, uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false, int level_override = -1); void SendBeginCast(uint16 spell_id, uint32 casttime); virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false, bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false, int level_override = -1); virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100, int level_override = -1); virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, - CastAction_type &CastAction, EQEmu::CastingSlot slot, bool isproc = false); + CastAction_type &CastAction, EQEmu::spells::CastingSlot slot, bool isproc = false); virtual bool CheckFizzle(uint16 spell_id); virtual bool CheckSpellLevelRestriction(uint16 spell_id); virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster); @@ -1375,7 +1375,7 @@ protected: int attacked_count; bool delaytimer; uint16 casting_spell_targetid; - EQEmu::CastingSlot casting_spell_slot; + EQEmu::spells::CastingSlot casting_spell_slot; uint16 casting_spell_mana; uint32 casting_spell_inventory_slot; uint32 casting_spell_timer; @@ -1385,7 +1385,7 @@ protected: uint32 casting_spell_aa_id; bool casting_spell_checks; uint16 bardsong; - EQEmu::CastingSlot bardsong_slot; + EQEmu::spells::CastingSlot bardsong_slot; uint32 bardsong_target_id; bool ActiveProjectileATK; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e44a1246c..37fbb7814 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -375,7 +375,7 @@ bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain #endif casting_spell_AIindex = i; - return CastSpell(AIspells[i].spellid, tar->GetID(), EQEmu::CastingSlot::Gem2, AIspells[i].manacost == -2 ? 0 : -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, &(AIspells[i].resist_adjust)); + return CastSpell(AIspells[i].spellid, tar->GetID(), EQEmu::spells::CastingSlot::Gem2, AIspells[i].manacost == -2 ? 0 : -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, &(AIspells[i].resist_adjust)); } bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float iRange, uint32 iSpellTypes) { @@ -688,11 +688,11 @@ void Client::AI_SpellCast() } uint32 spell_to_cast = 0xFFFFFFFF; - EQEmu::CastingSlot slot_to_use = EQEmu::CastingSlot::Item; + EQEmu::spells::CastingSlot slot_to_use = EQEmu::spells::CastingSlot::Item; if(valid_spells.size() == 1) { spell_to_cast = valid_spells[0]; - slot_to_use = static_cast(slots[0]); + slot_to_use = static_cast(slots[0]); } else if(valid_spells.empty()) { @@ -702,7 +702,7 @@ void Client::AI_SpellCast() { uint32 idx = zone->random.Int(0, (valid_spells.size()-1)); spell_to_cast = valid_spells[idx]; - slot_to_use = static_cast(slots[idx]); + slot_to_use = static_cast(slots[idx]); } if(IsMezSpell(spell_to_cast) || IsFearSpell(spell_to_cast)) diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index b9884b2a0..334aeaf0b 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -3737,7 +3737,7 @@ XS(XS_Mob_CastSpell) { Mob *THIS; uint16 spell_id = (uint16) SvUV(ST(1)); uint16 target_id = (uint16) SvUV(ST(2)); - EQEmu::CastingSlot slot; + EQEmu::spells::CastingSlot slot; int32 casttime; int32 mana_cost; int16 resist_adjust; @@ -3751,9 +3751,9 @@ XS(XS_Mob_CastSpell) { Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); if (items < 4) - slot = EQEmu::CastingSlot::Item; + slot = EQEmu::spells::CastingSlot::Item; else { - slot = static_cast(SvUV(ST(3))); + slot = static_cast(SvUV(ST(3))); } if (items < 5) @@ -3827,7 +3827,7 @@ XS(XS_Mob_SpellFinished) { resist_diff = spells[spell_id].ResistDiff; } - THIS->SpellFinished(spell_id, spell_target, EQEmu::CastingSlot::Item, mana_cost, -1, resist_diff); + THIS->SpellFinished(spell_id, spell_target, EQEmu::spells::CastingSlot::Item, mana_cost, -1, resist_diff); } XSRETURN_EMPTY; } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index dad4ebd26..660ac3273 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -371,14 +371,14 @@ void QuestManager::castspell(int spell_id, int target_id) { if (owner) { Mob *tgt = entity_list.GetMob(target_id); if(tgt != nullptr) - owner->SpellFinished(spell_id, tgt, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + owner->SpellFinished(spell_id, tgt, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } } void QuestManager::selfcast(int spell_id) { QuestManagerCurrentQuestVars(); if (initiator) - initiator->SpellFinished(spell_id, initiator, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + initiator->SpellFinished(spell_id, initiator, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } void QuestManager::addloot(int item_id, int charges, bool equipitem, int aug1, int aug2, int aug3, int aug4, int aug5, int aug6) { @@ -985,7 +985,7 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) { bool SpellBucketCheckResult = 0; - for(spell_id = 0, book_slot = initiator->GetNextAvailableSpellBookSlot(), count = 0; spell_id < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; spell_id++, book_slot = initiator->GetNextAvailableSpellBookSlot(book_slot)) + for(spell_id = 0, book_slot = initiator->GetNextAvailableSpellBookSlot(), count = 0; spell_id < SPDAT_RECORDS && book_slot < EQEmu::spells::SPELLBOOK_SIZE; spell_id++, book_slot = initiator->GetNextAvailableSpellBookSlot(book_slot)) { if ( diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index ff3559db9..1e38b481b 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -197,7 +197,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 IsValidSpell(aabonuses.SkillAttackProc[2])) { float chance = aabonuses.SkillAttackProc[0] / 1000.0f; if (zone->random.Roll(chance)) - SpellFinished(aabonuses.SkillAttackProc[2], who, EQEmu::CastingSlot::Item, 0, -1, + SpellFinished(aabonuses.SkillAttackProc[2], who, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[2]].ResistDiff); } @@ -2156,7 +2156,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob *other, uint16 weapon_damage, EQEmu::skills: IsValidSpell(aabonuses.SkillAttackProc[2])) { float chance = aabonuses.SkillAttackProc[0] / 1000.0f; if (zone->random.Roll(chance)) - SpellFinished(aabonuses.SkillAttackProc[2], other, EQEmu::CastingSlot::Item, 0, -1, + SpellFinished(aabonuses.SkillAttackProc[2], other, EQEmu::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[2]].ResistDiff); } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 82fef55cf..e4c0badd5 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2470,7 +2470,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove case SE_FcTimerRefresh: { if(IsClient()) { - for(unsigned int i =0 ; i < MAX_PP_MEMSPELL; ++i) { + for (unsigned int i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; ++i) { if(IsValidSpell(CastToClient()->m_pp.mem_spells[i])) { if (CalcFocusEffect(focusFcTimerRefresh, spell_id, CastToClient()->m_pp.mem_spells[i])){ CastToClient()->m_pp.spellSlotRefresh[i] = 1; @@ -2739,7 +2739,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (caster && IsValidSpell(spells[spell_id].base2[i])){ if(zone->random.Roll(spells[spell_id].base[i])) - caster->SpellFinished(spells[spell_id].base2[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); + caster->SpellFinished(spells[spell_id].base2[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); } break; } @@ -3662,7 +3662,7 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster) case SE_CastOnFadeEffectNPC: case SE_CastOnFadeEffectAlways: { if (buff.ticsremaining == 0) { - SpellFinished(spells[buff.spellid].base[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spells[buff.spellid].base[i]].ResistDiff); + SpellFinished(spells[buff.spellid].base[i], this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spells[buff.spellid].base[i]].ResistDiff); } break; } @@ -5100,7 +5100,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo if (Caston_spell_id) { if (IsValidSpell(Caston_spell_id) && (Caston_spell_id != spell_id)) - SpellFinished(Caston_spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[Caston_spell_id].ResistDiff); + SpellFinished(Caston_spell_id, this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[Caston_spell_id].ResistDiff); } return (value * lvlModifier / 100); @@ -6663,10 +6663,10 @@ void Mob::TryTriggerThreshHold(int32 damage, int effect_id, Mob* attacker){ if (IsValidSpell(spell_id)) { if (IsBeneficialSpell(spell_id)) - SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spell_id, this, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); else if(attacker) - SpellFinished(spell_id, attacker, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spell_id, attacker, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } } } diff --git a/zone/spells.cpp b/zone/spells.cpp index b24d21725..9e3c11b6b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -107,7 +107,7 @@ extern volatile bool is_zone_loaded; extern WorldServer worldserver; extern FastMath g_Math; -using EQEmu::CastingSlot; +using EQEmu::spells::CastingSlot; // this is run constantly for every mob void Mob::SpellProcess() @@ -4968,7 +4968,7 @@ void Client::MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message) void Client::MemSpell(uint16 spell_id, int slot, bool update_client) { - if(slot >= MAX_PP_MEMSPELL || slot < 0) + if(slot >= EQEmu::spells::SPELL_GEM_COUNT || slot < 0) return; if(update_client) @@ -4990,7 +4990,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) void Client::UnmemSpell(int slot, bool update_client) { - if(slot > MAX_PP_MEMSPELL || slot < 0) + if(slot > EQEmu::spells::SPELL_GEM_COUNT || slot < 0) return; Log(Logs::Detail, Logs::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); @@ -5006,7 +5006,7 @@ void Client::UnmemSpell(int slot, bool update_client) void Client::UnmemSpellBySpellID(int32 spell_id) { - for(int i = 0; i < MAX_PP_MEMSPELL; i++) { + for(int i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; i++) { if(m_pp.mem_spells[i] == spell_id) { UnmemSpell(i, true); break; @@ -5018,14 +5018,14 @@ void Client::UnmemSpellAll(bool update_client) { int i; - for(i = 0; i < MAX_PP_MEMSPELL; i++) + for(i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; i++) if(m_pp.mem_spells[i] != 0xFFFFFFFF) UnmemSpell(i, update_client); } void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) { - if(slot >= MAX_PP_SPELLBOOK || slot < 0) + if(slot >= EQEmu::spells::SPELLBOOK_SIZE || slot < 0) return; if(update_client) @@ -5046,7 +5046,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) void Client::UnscribeSpell(int slot, bool update_client) { - if(slot >= MAX_PP_SPELLBOOK || slot < 0) + if(slot >= EQEmu::spells::SPELLBOOK_SIZE || slot < 0) return; Log(Logs::Detail, Logs::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); @@ -5068,7 +5068,7 @@ void Client::UnscribeSpellAll(bool update_client) { int i; - for(i = 0; i < MAX_PP_SPELLBOOK; i++) + for(i = 0; i < EQEmu::spells::SPELLBOOK_SIZE; i++) { if(m_pp.spell_book[i] != 0xFFFFFFFF) UnscribeSpell(i, update_client); @@ -5102,7 +5102,7 @@ void Client::UntrainDiscAll(bool update_client) } int Client::GetNextAvailableSpellBookSlot(int starting_slot) { - for (int i = starting_slot; i < MAX_PP_SPELLBOOK; i++) { //using starting_slot should help speed this up when we're iterating through a bunch of spells + for (int i = starting_slot; i < EQEmu::spells::SPELLBOOK_SIZE; i++) { //using starting_slot should help speed this up when we're iterating through a bunch of spells if (!IsValidSpell(GetSpellByBookSlot(i))) return i; } @@ -5111,7 +5111,7 @@ int Client::GetNextAvailableSpellBookSlot(int starting_slot) { } int Client::FindSpellBookSlotBySpellID(uint16 spellid) { - for(int i = 0; i < MAX_PP_SPELLBOOK; i++) { + for(int i = 0; i < EQEmu::spells::SPELLBOOK_SIZE; i++) { if(m_pp.spell_book[i] == spellid) return i; } @@ -5410,7 +5410,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) spell_id != SPELL_UNKNOWN && slot != -1 && GetClass() == BARD && - slot <= MAX_PP_MEMSPELL && + slot <= EQEmu::spells::SPELL_GEM_COUNT && IsBardSong(spell_id) ); } diff --git a/zone/trap.cpp b/zone/trap.cpp index 5e4198e5b..29314f568 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -135,7 +135,7 @@ void Trap::Trigger(Mob* trigger) entity_list.MessageClose(trigger,false,100,13,"%s",message.c_str()); } if(hiddenTrigger){ - hiddenTrigger->SpellFinished(effectvalue, trigger, EQEmu::CastingSlot::Item, 0, -1, spells[effectvalue].ResistDiff); + hiddenTrigger->SpellFinished(effectvalue, trigger, EQEmu::spells::CastingSlot::Item, 0, -1, spells[effectvalue].ResistDiff); } break; case trapTypeAlarm: diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 81e2ee9c4..29873a38e 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1204,12 +1204,12 @@ bool ZoneDatabase::LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_ auto results = database.QueryDatabase(query); int i = 0; /* Initialize Spells */ - for (i = 0; i < MAX_PP_MEMSPELL; i++){ + for (i = 0; i < EQEmu::spells::SPELL_GEM_COUNT; i++){ pp->mem_spells[i] = 0xFFFFFFFF; } for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); - if (i < MAX_PP_MEMSPELL && atoi(row[1]) <= SPDAT_RECORDS){ + if (i < EQEmu::spells::SPELL_GEM_COUNT && atoi(row[1]) <= SPDAT_RECORDS){ pp->mem_spells[i] = atoi(row[1]); } } @@ -1227,12 +1227,12 @@ bool ZoneDatabase::LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Str auto results = database.QueryDatabase(query); int i = 0; /* Initialize Spells */ - for (i = 0; i < MAX_PP_SPELLBOOK; i++){ + for (i = 0; i < EQEmu::spells::SPELLBOOK_SIZE; i++){ pp->spell_book[i] = 0xFFFFFFFF; } for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); - if (i < MAX_PP_SPELLBOOK && atoi(row[1]) <= SPDAT_RECORDS){ + if (i < EQEmu::spells::SPELLBOOK_SIZE && atoi(row[1]) <= SPDAT_RECORDS){ pp->spell_book[i] = atoi(row[1]); } }