feat(Core/Scripting): Implement OnLoadSpellCustomAttr global hook (#10469)

This commit is contained in:
Skjalf
2022-01-31 18:03:42 -03:00
committed by GitHub
parent 0377b71e16
commit 4c5aceedbd
3 changed files with 15 additions and 0 deletions

View File

@@ -153,3 +153,11 @@ bool ScriptMgr::OnSpellHealingBonusTakenNegativeModifiers(Unit const* target, Un
return false;
}
void ScriptMgr::OnLoadSpellCustomAttr(SpellInfo* spell)
{
ExecuteScript<GlobalScript>([&](GlobalScript* script)
{
script->OnLoadSpellCustomAttr(spell);
});
}

View File

@@ -1531,6 +1531,9 @@ public:
// Called when checking for spell negative healing modifiers
virtual bool OnSpellHealingBonusTakenNegativeModifiers(Unit const* /*target*/, Unit const* /*caster*/, SpellInfo const* /*spellInfo*/, float& /*val*/) { return false; };
// Called after loading spell dbc corrections
virtual void OnLoadSpellCustomAttr(SpellInfo* /*spell*/) { }
};
class BGScript : public ScriptObject
@@ -2350,6 +2353,7 @@ public: /* GlobalScript */
void OnBeforeWorldObjectSetPhaseMask(WorldObject const* worldObject, uint32& oldPhaseMask, uint32& newPhaseMask, bool& useCombinedPhases, bool& update);
bool OnIsAffectedBySpellModCheck(SpellInfo const* affectSpell, SpellInfo const* checkSpell, SpellModifier const* mod);
bool OnSpellHealingBonusTakenNegativeModifiers(Unit const* target, Unit const* caster, SpellInfo const* spellInfo, float& val);
void OnLoadSpellCustomAttr(SpellInfo* spell);
public: /* Scheduled scripts */
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }

View File

@@ -31,6 +31,7 @@
#include "SpellAuraDefines.h"
#include "SpellAuras.h"
#include "SpellInfo.h"
#include "ScriptMgr.h"
#include "World.h"
bool IsPrimaryProfessionSkill(uint32 skill)
@@ -3403,6 +3404,8 @@ void SpellMgr::LoadSpellCustomAttr()
}
}
spellInfo->_InitializeExplicitTargetMask();
sScriptMgr->OnLoadSpellCustomAttr(spellInfo);
}
// Xinef: addition for binary spells, ommit spells triggering other spells