feat(Core/Hooks): added collection of hooks to extends AC (#3047)

This collection of hooks comes from the Maelstrom project. It allows to release modules such as :
- 3v3-soloqueue
- 1v1 arena
- pvestats

and many others
This commit is contained in:
Kargatum
2021-04-13 18:26:39 +07:00
committed by GitHub
parent 911fbb377e
commit 2b3d46bd4f
46 changed files with 2053 additions and 278 deletions

View File

@@ -4363,6 +4363,8 @@ void Unit::RemoveAura(AuraApplicationMap::iterator& i, AuraRemoveMode mode)
// Remove aura - for Area and Target auras
if (aura->GetOwner() == this)
aura->Remove(mode);
sScriptMgr->OnAuraRemove(this, aurApp, mode);
}
void Unit::RemoveAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
@@ -9687,6 +9689,11 @@ ReputationRank Unit::GetReactionTo(Unit const* target) const
}
}
}
ReputationRank repRank = REP_HATED;
if (!sScriptMgr->IfNormalReaction(this, target, repRank))
return ReputationRank(repRank);
// do checks dependant only on our faction
return GetFactionReactionTo(GetFactionTemplateEntry(), target);
}
@@ -10782,6 +10789,9 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da
if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
continue;
if (!sScriptMgr->IsNeedModSpellDamagePercent(this, *i, DoneTotalMod, spellProto))
continue;
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
{
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
@@ -11784,8 +11794,13 @@ float Unit::SpellPctHealingModsDone(Unit* victim, SpellInfo const* spellProto, D
// Healing done percent
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
AddPct(DoneTotalMod, (*i)->GetAmount());
for (auto const& auraEff : mHealingDonePct)
{
if (!sScriptMgr->IsNeedModHealPercent(this, auraEff, DoneTotalMod, spellProto))
continue;
AddPct(DoneTotalMod, auraEff->GetAmount());
}
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -12400,6 +12415,9 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
continue;
if (!sScriptMgr->IsNeedModMeleeDamagePercent(this, *i, DoneTotalMod, spellProto))
continue;
if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()) && !((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
{
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
@@ -18230,6 +18248,9 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
// pussywizard: goign to other phase (valithria, algalon) should not remove such auras
//RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
return;
// modify hostile references for new phasemask, some special cases deal with hostile references themselves
if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
{
@@ -20077,7 +20098,10 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
fieldBuffer << (uint32)target->getFaction();
}
else
fieldBuffer << m_uint32Values[index];
if (!sScriptMgr->IsCustomBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
{
fieldBuffer << m_uint32Values[index];
}
}
else
// send in current format (float as float, uint32 as uint32)