mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 06:36:24 +00:00
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:
@@ -15,6 +15,7 @@
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -1073,6 +1074,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
}
|
||||
}
|
||||
|
||||
sScriptMgr->OnInitStatsForLevel(this, petlevel);
|
||||
|
||||
UpdateAllStats();
|
||||
|
||||
SetFullHealth();
|
||||
@@ -1585,7 +1588,7 @@ void Pet::InitLevelupSpellsForLevel()
|
||||
for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr)
|
||||
{
|
||||
// will called first if level down
|
||||
if (itr->first > level)
|
||||
if (itr->first > level && sScriptMgr->CanUnlearnSpellSet(this, itr->first, itr->second))
|
||||
unlearnSpell(itr->second, true); // will learn prev rank if any
|
||||
// will called if level up
|
||||
else
|
||||
@@ -1605,7 +1608,7 @@ void Pet::InitLevelupSpellsForLevel()
|
||||
continue;
|
||||
|
||||
// will called first if level down
|
||||
if (spellEntry->SpellLevel > level)
|
||||
if (spellEntry->SpellLevel > level && sScriptMgr->CanUnlearnSpellDefault(this, spellEntry))
|
||||
unlearnSpell(spellEntry->Id, true);
|
||||
// will called if level up
|
||||
else
|
||||
@@ -1710,6 +1713,9 @@ bool Pet::resetTalents()
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
if (!sScriptMgr->CanResetTalents(this))
|
||||
return false;
|
||||
|
||||
// not need after this call
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||
@@ -1863,16 +1869,17 @@ void Pet::InitTalentForLevel()
|
||||
{
|
||||
uint8 level = getLevel();
|
||||
uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
|
||||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// Reset talents in case low level (on level down) or wrong points for level (hunter can unlearn TP increase talent)
|
||||
if (talentPointsForLevel == 0 || m_usedTalentCount > talentPointsForLevel)
|
||||
resetTalents(); // Remove all talent points
|
||||
|
||||
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
|
||||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (!m_loading)
|
||||
owner->ToPlayer()->SendTalentsInfoData(true);
|
||||
}
|
||||
@@ -1883,6 +1890,9 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint8 level)
|
||||
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
|
||||
if (Unit* owner = GetOwner())
|
||||
points += owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
|
||||
|
||||
sScriptMgr->OnCalculateMaxTalentPointsForLevel(this, level, points);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user