mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Scripts: Adding script hooks to allow for third party scripts to modify damage dealt.
Originally from the VAS Autobalance script, slightly modified. Only addresses Spells, Dots, and Melee Damage. I'll have look at the current modules on ways of doing this but, Environmental Damage(fire/lava/drowning), Fall Damage, and Potentially AoE aren't covered by these. Closes #7867 Signed-off-by: Nay <dnpd.dd@gmail.com>
This commit is contained in:
@@ -217,6 +217,7 @@ void ScriptMgr::Unload()
|
||||
SCR_CLEAR(PlayerScript);
|
||||
SCR_CLEAR(GuildScript);
|
||||
SCR_CLEAR(GroupScript);
|
||||
SCR_CLEAR(UnitScript);
|
||||
|
||||
#undef SCR_CLEAR
|
||||
}
|
||||
@@ -1338,6 +1339,22 @@ void ScriptMgr::OnGroupDisband(Group* group)
|
||||
FOREACH_SCRIPT(GroupScript)->OnDisband(group);
|
||||
}
|
||||
|
||||
// Unit
|
||||
void ScriptMgr::ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage)
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifyPeriodicDamageAurasTick(target, attacker, damage);
|
||||
}
|
||||
|
||||
void ScriptMgr::ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage)
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifyMeleeDamage(target, attacker, damage);
|
||||
}
|
||||
|
||||
void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage)
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifySpellDamageTaken(target, attacker, damage);
|
||||
}
|
||||
|
||||
SpellScriptLoader::SpellScriptLoader(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -1362,6 +1379,12 @@ FormulaScript::FormulaScript(const char* name)
|
||||
ScriptRegistry<FormulaScript>::AddScript(this);
|
||||
}
|
||||
|
||||
UnitScript::UnitScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<UnitScript>::AddScript(this);
|
||||
}
|
||||
|
||||
WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<Map>(mapId)
|
||||
{
|
||||
@@ -1396,7 +1419,7 @@ ItemScript::ItemScript(const char* name)
|
||||
}
|
||||
|
||||
CreatureScript::CreatureScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
: UnitScript(name)
|
||||
{
|
||||
ScriptRegistry<CreatureScript>::AddScript(this);
|
||||
}
|
||||
@@ -1450,7 +1473,7 @@ ConditionScript::ConditionScript(const char* name)
|
||||
}
|
||||
|
||||
VehicleScript::VehicleScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
: UnitScript(name)
|
||||
{
|
||||
ScriptRegistry<VehicleScript>::AddScript(this);
|
||||
}
|
||||
@@ -1474,7 +1497,7 @@ AchievementCriteriaScript::AchievementCriteriaScript(const char* name)
|
||||
}
|
||||
|
||||
PlayerScript::PlayerScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
: UnitScript(name)
|
||||
{
|
||||
ScriptRegistry<PlayerScript>::AddScript(this);
|
||||
}
|
||||
@@ -1520,6 +1543,7 @@ template class ScriptRegistry<AchievementCriteriaScript>;
|
||||
template class ScriptRegistry<PlayerScript>;
|
||||
template class ScriptRegistry<GuildScript>;
|
||||
template class ScriptRegistry<GroupScript>;
|
||||
template class ScriptRegistry<UnitScript>;
|
||||
|
||||
// Undefine utility macros.
|
||||
#undef GET_SCRIPT_RET
|
||||
|
||||
Reference in New Issue
Block a user