feat(Core/Hook): New PlayerScript hooks (#2639)

This commit is contained in:
Stoabrogga
2020-02-04 08:25:11 +01:00
committed by GitHub
parent 2fa9f5c249
commit 3f0739f1c9
4 changed files with 68 additions and 22 deletions
@@ -11,6 +11,7 @@
#include "TemporarySummon.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
TempSummon::TempSummon(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject) :
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
@@ -147,13 +148,16 @@ void TempSummon::InitStats(uint32 duration)
{
ASSERT(!IsPet());
Unit* owner = GetSummoner();
if (Player* player = owner->ToPlayer())
sScriptMgr->OnBeforeTempSummonInitStats(player, this, duration);
m_timer = duration;
m_lifetime = duration;
if (m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit* owner = GetSummoner();
if (owner)
{
if (IsTrigger() && m_spells[0])