mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[API] Perl functions added to apply spell effects directly to NPCs without requiring buffs. (#1975)
* script functions working * Update perl_npc.cpp * [API] Perl functions added to apply spell effects directly to NPCs without requiring buffs.
This commit is contained in:
+24
-2
@@ -2761,9 +2761,8 @@ void NPC::ApplyAISpellEffects(StatBonuses* newbon)
|
||||
}
|
||||
|
||||
// adds a spell to the list, taking into account priority and resorting list as needed.
|
||||
void NPC::AddSpellEffectToNPCList(uint16 iSpellEffectID, int32 base_value, int32 limit, int32 max_value)
|
||||
void NPC::AddSpellEffectToNPCList(uint16 iSpellEffectID, int32 base_value, int32 limit, int32 max_value, bool apply_bonus)
|
||||
{
|
||||
|
||||
if(!iSpellEffectID)
|
||||
return;
|
||||
|
||||
@@ -2775,6 +2774,29 @@ void NPC::AddSpellEffectToNPCList(uint16 iSpellEffectID, int32 base_value, int32
|
||||
t.limit = limit;
|
||||
t.max_value = max_value;
|
||||
AIspellsEffects.push_back(t);
|
||||
|
||||
//we recalculate if applied from quest script.
|
||||
if (apply_bonus) {
|
||||
CalcBonuses();
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::RemoveSpellEffectFromNPCList(uint16 iSpellEffectID, bool apply_bonus)
|
||||
{
|
||||
auto iter = AIspellsEffects.begin();
|
||||
while (iter != AIspellsEffects.end())
|
||||
{
|
||||
if ((*iter).spelleffectid == iSpellEffectID)
|
||||
{
|
||||
iter = AIspellsEffects.erase(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (apply_bonus) {
|
||||
CalcBonuses();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSpellEffectInList(DBnpcspellseffects_Struct* spelleffect_list, uint16 iSpellEffectID, int32 base_value, int32 limit, int32 max_value) {
|
||||
|
||||
Reference in New Issue
Block a user