From bef849b5c1ad91af75e969df385e489995df78c5 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 9 Feb 2019 05:58:49 -0500 Subject: [PATCH] Definition clean-up --- common/emu_constants.h | 4 +++- common/spdat.h | 16 ++++++++-------- zone/bot.cpp | 4 ++-- zone/bot.h | 2 +- zone/bot_database.cpp | 4 ++-- zone/merc.cpp | 2 +- zone/mob_ai.cpp | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/common/emu_constants.h b/common/emu_constants.h index 970b2861d..ee8fdfcee 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -219,7 +219,9 @@ namespace EQEmu const char *GetStanceName(StanceType stance_type); int ConvertStanceTypeToIndex(StanceType stance_type); - const size_t STANCE_TYPE_MAX = stanceBurnAE; + const int STANCE_TYPE_FIRST = stancePassive; + const int STANCE_TYPE_LAST = stanceBurnAE; + const int STANCE_TYPE_COUNT = stanceBurnAE; } /*constants*/ diff --git a/common/spdat.h b/common/spdat.h index cb9a301d8..877d37823 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -68,16 +68,16 @@ enum SpellTypes : uint32 SpellType_InCombatBuffSong = (1 << 18), // bard in-combat group/ae buffs SpellType_OutOfCombatBuffSong = (1 << 19), // bard out-of-combat group/ae buffs SpellType_PreCombatBuff = (1 << 20), - SpellType_PreCombatBuffSong = (1 << 21), - - SpellTypes_Detrimental = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow), - SpellTypes_Beneficial = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong), - - SpellTypes_Innate = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root), - - SpellType_Any = 0xFFFFFFFF + SpellType_PreCombatBuffSong = (1 << 21) }; +const uint32 SPELL_TYPE_MIN = (SpellType_Nuke << 1) - 1; +const uint32 SPELL_TYPE_MAX = (SpellType_PreCombatBuffSong << 1) - 1; +const uint32 SPELL_TYPE_ANY = 0xFFFFFFFF; + +const uint32 SPELL_TYPES_DETRIMENTAL = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow); +const uint32 SPELL_TYPES_BENEFICIAL = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong); +const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root); // These should not be used to determine spell category.. // They are a graphical affects (effects?) index only diff --git a/zone/bot.cpp b/zone/bot.cpp index 381701a51..e6dd36011 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8213,7 +8213,7 @@ bool Bot::CheckLoreConflict(const EQEmu::ItemData* item) { } bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint32 iSpellTypes) { - if((iSpellTypes&SpellTypes_Detrimental) != 0) { + if((iSpellTypes & SPELL_TYPES_DETRIMENTAL) != 0) { Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return false; } @@ -9096,6 +9096,6 @@ std::string Bot::CreateSayLink(Client* c, const char* message, const char* name) return saylink; } -uint8 Bot::spell_casting_chances[MaxSpellTypes][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_MAX][cntHSND] = { 0 }; +uint8 Bot::spell_casting_chances[MaxSpellTypes][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 }; #endif diff --git a/zone/bot.h b/zone/bot.h index 08b62b7b0..8d99654a6 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -771,7 +771,7 @@ private: bool DeletePet(); public: - static uint8 spell_casting_chances[MaxSpellTypes][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_MAX][cntHSND]; + static uint8 spell_casting_chances[MaxSpellTypes][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND]; }; #endif // BOTS diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 651729223..15194270f 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -122,7 +122,7 @@ bool BotDatabase::LoadBotSpellCastingChances() continue; --class_index; uint8 stance_index = atoi(row[2]); - if (stance_index >= EQEmu::constants::STANCE_TYPE_MAX) + if (stance_index >= EQEmu::constants::STANCE_TYPE_COUNT) continue; for (uint8 conditional_index = nHSND; conditional_index < cntHSND; ++conditional_index) { @@ -2853,7 +2853,7 @@ uint8 BotDatabase::GetSpellCastingChance(uint8 spell_type_index, uint8 class_ind return 0; if (class_index >= PLAYER_CLASS_COUNT) return 0; - if (stance_index >= EQEmu::constants::STANCE_TYPE_MAX) + if (stance_index >= EQEmu::constants::STANCE_TYPE_COUNT) return 0; if (conditional_index >= cntHSND) return 0; diff --git a/zone/merc.cpp b/zone/merc.cpp index e71667320..7c15fbd65 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1908,7 +1908,7 @@ bool Merc::AI_IdleCastCheck() { bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, float iRange, uint32 iSpellTypes) { - if((iSpellTypes&SpellTypes_Detrimental) != 0) { + if((iSpellTypes & SPELL_TYPES_DETRIMENTAL) != 0) { //according to live, you can buff and heal through walls... //now with PCs, this only applies if you can TARGET the target, but // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 37fbb7814..5a31cc12b 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -379,7 +379,7 @@ bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain } bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float iRange, uint32 iSpellTypes) { - if((iSpellTypes & SpellTypes_Detrimental) != 0) { + if((iSpellTypes & SPELL_TYPES_DETRIMENTAL) != 0) { //according to live, you can buff and heal through walls... //now with PCs, this only applies if you can TARGET the target, but // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. @@ -2813,7 +2813,7 @@ DBnpcspells_Struct *ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) entry.max_hp = atoi(row[8]); // some spell types don't make much since to be priority 0, so fix that - if (!(entry.type & SpellTypes_Innate) && entry.priority == 0) + if (!(entry.type & SPELL_TYPES_INNATE) && entry.priority == 0) entry.priority = 1; if (row[9])