mirror of
https://github.com/araxiaonline/azerothshard-core.git
synced 2026-06-13 02:42:24 -04:00
Implemented OnBeforeAuraRankForLevel hook
Co-authored-by: Kargatum <dowlandtop@yandex.com>
This commit is contained in:
@@ -2754,6 +2754,11 @@ void ScriptMgr::OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, u
|
||||
FOREACH_SCRIPT(SpellSC)->OnRemoveAuraScaleTargets(spell, targetInfo, auraScaleMask, needErase);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuraRankForLevel(SpellInfo const* spellInfo, SpellInfo const* latestSpellInfo, uint8 level)
|
||||
{
|
||||
FOREACH_SCRIPT(SpellSC)->OnBeforeAuraRankForLevel(spellInfo, latestSpellInfo, level);
|
||||
}
|
||||
|
||||
// GameEventScript
|
||||
void ScriptMgr::OnGameEventStart(uint16 EventID)
|
||||
{
|
||||
|
||||
@@ -1296,6 +1296,8 @@ public:
|
||||
virtual void OnScaleAuraUnitAdd(Spell* /*spell*/, Unit* /*target*/, uint32 /*effectMask*/, bool /*checkIfValid*/, bool /*implicit*/, uint8 /*auraScaleMask*/, TargetInfo& /*targetInfo*/) { }
|
||||
|
||||
virtual void OnRemoveAuraScaleTargets(Spell* /*spell*/, TargetInfo& /*targetInfo*/, uint8 /*auraScaleMask*/, bool& /*needErase*/) { }
|
||||
|
||||
virtual void OnBeforeAuraRankForLevel(SpellInfo const* /*spellInfo*/, SpellInfo const* /*latestSpellInfo*/, uint8 /*level*/) { }
|
||||
};
|
||||
|
||||
// this class can be used to be extended by Modules
|
||||
@@ -1850,6 +1852,7 @@ class ScriptMgr
|
||||
bool CanSelectSpecTalent(Spell* spell);
|
||||
void OnScaleAuraUnitAdd(Spell* spell, Unit* target, uint32 effectMask, bool checkIfValid, bool implicit, uint8 auraScaleMask, TargetInfo& targetInfo);
|
||||
void OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, uint8 auraScaleMask, bool& needErase);
|
||||
void OnBeforeAuraRankForLevel(SpellInfo const* spellInfo, SpellInfo const* latestSpellInfo, uint8 level);
|
||||
|
||||
public: /* GameEventScript */
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "Player.h"
|
||||
#include "Battleground.h"
|
||||
#include "Chat.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
|
||||
{
|
||||
@@ -2478,27 +2479,21 @@ SpellInfo const* SpellInfo::GetAuraRankForLevel(uint8 level) const
|
||||
if (!needRankSelection)
|
||||
return this;
|
||||
|
||||
SpellInfo const* latestSpellInfo; //[AZTH] we can use after
|
||||
for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != NULL; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
|
||||
{
|
||||
// [AZTH] timewalking
|
||||
if (nextSpellInfo->SpellLevel == 0)
|
||||
if (uint32(level) >= nextSpellInfo->BaseLevel)
|
||||
return nextSpellInfo;
|
||||
else if (uint32(level /*[AZTH]+ 10*/) >= nextSpellInfo->SpellLevel) // if found appropriate level
|
||||
return nextSpellInfo;
|
||||
SpellInfo const* nextSpellInfo = nullptr;
|
||||
|
||||
latestSpellInfo = nextSpellInfo;
|
||||
// one rank less then
|
||||
sScriptMgr->OnBeforeAuraRankForLevel(this, nextSpellInfo, level);
|
||||
|
||||
if (nextSpellInfo != nullptr)
|
||||
return nextSpellInfo;
|
||||
|
||||
for (nextSpellInfo = this; nextSpellInfo != nullptr; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
|
||||
{
|
||||
// if found appropriate level
|
||||
if (uint32(level + 10) >= nextSpellInfo->SpellLevel)
|
||||
return nextSpellInfo; // one rank less then
|
||||
}
|
||||
|
||||
//[AZTH] if any low level found, we could pass the first
|
||||
// one that is in a 10 level higher range as official code did
|
||||
if (uint32(level + 10) >= latestSpellInfo->SpellLevel)
|
||||
return latestSpellInfo;
|
||||
|
||||
// not found
|
||||
return NULL;
|
||||
return nullptr; // not found
|
||||
}
|
||||
|
||||
bool SpellInfo::IsRankOf(SpellInfo const* spellInfo) const
|
||||
|
||||
Reference in New Issue
Block a user