[Bug Fix] Replace uses of SPELL_UNKNOWN with IsValidSpell() (#2938)

This commit is contained in:
Aeadoin
2023-02-15 22:01:35 -05:00
committed by GitHub
parent 4a64048744
commit 5ee2856133
14 changed files with 134 additions and 116 deletions
+8 -5
View File
@@ -2535,8 +2535,9 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) {
}
for (int buffCount = 0; buffCount <= BUFF_COUNT; buffCount++) {
if(buffs[buffCount].spellid == 0 || buffs[buffCount].spellid == SPELL_UNKNOWN)
continue;
if (!IsValidSpell(buffs[buffCount].spellid)) {
continue;
}
int IsPersistent = buffs[buffCount].persistant_buff? 1: 0;
@@ -3079,8 +3080,9 @@ void ZoneDatabase::SaveBuffs(Client *client) {
Buffs_Struct *buffs = client->GetBuffs();
for (int index = 0; index < buff_count; index++) {
if(buffs[index].spellid == SPELL_UNKNOWN)
continue;
if (!IsValidSpell(buffs[index].spellid)) {
continue;
}
query = StringFormat("INSERT INTO `character_buffs` (character_id, slot_id, spell_id, "
"caster_level, caster_name, ticsremaining, counters, numhits, melee_rune, "
@@ -3261,8 +3263,9 @@ void ZoneDatabase::SavePetInfo(Client *client)
// pet buffs!
int max_slots = RuleI(Spells, MaxTotalSlotsPET);
for (int index = 0; index < max_slots; index++) {
if (petinfo->Buffs[index].spellid == SPELL_UNKNOWN || petinfo->Buffs[index].spellid == 0)
if (!IsValidSpell(petinfo->Buffs[index].spellid)) {
continue;
}
if (query.length() == 0)
query = StringFormat("INSERT INTO `character_pet_buffs` "
"(`char_id`, `pet`, `slot`, `spell_id`, `caster_level`, "