[Quest API] Add AddAISpellEffect(spell_effect_id, base_value, limit_value, max_value) and RemoveAISpellEffect(spell_effect_id) to Lua. (#1981)

- Add npc:AddAISpellEffect(spell_effect_id, base_value, limit_value, max_value) to Lua.
- Add npc:RemoveAISpellEffect(spell_effect_id) to Lua.
This commit is contained in:
Kinglykrab
2022-02-08 20:46:59 -05:00
committed by GitHub
parent 79f250da2d
commit f65a6d2761
5 changed files with 60 additions and 7 deletions
+11
View File
@@ -2799,6 +2799,17 @@ void NPC::RemoveSpellEffectFromNPCList(uint16 iSpellEffectID, bool apply_bonus)
}
}
bool NPC::HasAISpellEffect(uint16 spell_effect_id)
{
for (const auto& spell_effect : AIspellsEffects) {
if (spell_effect.spelleffectid == spell_effect_id) {
return true;
}
}
return false;
}
bool IsSpellEffectInList(DBnpcspellseffects_Struct* spelleffect_list, uint16 iSpellEffectID, int32 base_value, int32 limit, int32 max_value) {
for (uint32 i=0; i < spelleffect_list->numentries; i++) {
if (spelleffect_list->entries[i].spelleffectid == iSpellEffectID && spelleffect_list->entries[i].base_value == base_value