Remove Sentry Totem Aura when Sentry Totem is destroyed.
For Totems use Totem::UnSummon() when old totem is replaced with new one Signed-off-by: dr.skull <[email protected]>
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "TemporarySummon.h"
|
#include "TemporarySummon.h"
|
||||||
|
#include "Totem.h"
|
||||||
|
|
||||||
TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) :
|
TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) :
|
||||||
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
|
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
|
||||||
@@ -195,7 +196,12 @@ void TempSummon::InitStats(uint32 duration)
|
|||||||
{
|
{
|
||||||
Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
|
Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
|
||||||
if (oldSummon && oldSummon->isSummon())
|
if (oldSummon && oldSummon->isSummon())
|
||||||
oldSummon->ToTempSummon()->UnSummon();
|
{
|
||||||
|
if (oldSummon->isTotem())
|
||||||
|
oldSummon->ToTotem()->UnSummon();
|
||||||
|
else
|
||||||
|
oldSummon->ToTempSummon()->UnSummon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
owner->m_SummonSlot[slot] = GetGUID();
|
owner->m_SummonSlot[slot] = GetGUID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void Totem::InitStats(uint32 duration)
|
|||||||
|
|
||||||
void Totem::InitSummon()
|
void Totem::InitSummon()
|
||||||
{
|
{
|
||||||
if (m_type == TOTEM_PASSIVE)
|
if (m_type == TOTEM_PASSIVE && GetSpell())
|
||||||
{
|
{
|
||||||
CastSpell(this, GetSpell(), true);
|
CastSpell(this, GetSpell(), true);
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ void Totem::InitSummon()
|
|||||||
void Totem::UnSummon()
|
void Totem::UnSummon()
|
||||||
{
|
{
|
||||||
CombatStop();
|
CombatStop();
|
||||||
RemoveAurasDueToSpell(GetSpell());
|
RemoveAurasDueToSpell(GetSpell(), GetGUID());
|
||||||
|
|
||||||
// clear owner's totem slot
|
// clear owner's totem slot
|
||||||
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
|
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
|
||||||
@@ -111,7 +111,11 @@ void Totem::UnSummon()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_owner->RemoveAurasDueToSpell(GetSpell());
|
m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID());
|
||||||
|
|
||||||
|
// Remove Sentry Totem Aura
|
||||||
|
if (GetEntry() == SENTRY_TOTEM_ENTRY)
|
||||||
|
m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
|
||||||
|
|
||||||
//remove aura all party members too
|
//remove aura all party members too
|
||||||
if (Player* owner = m_owner->ToPlayer())
|
if (Player* owner = m_owner->ToPlayer())
|
||||||
@@ -127,7 +131,7 @@ void Totem::UnSummon()
|
|||||||
{
|
{
|
||||||
Player* target = itr->getSource();
|
Player* target = itr->getSource();
|
||||||
if (target && group->SameSubGroup(owner, target))
|
if (target && group->SameSubGroup(owner, target))
|
||||||
target->RemoveAurasDueToSpell(GetSpell());
|
target->RemoveAurasDueToSpell(GetSpell(), GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ enum TotemType
|
|||||||
TOTEM_ACTIVE = 1,
|
TOTEM_ACTIVE = 1,
|
||||||
TOTEM_STATUE = 2 // copied straight from MaNGOS, may need more implementation to work
|
TOTEM_STATUE = 2 // copied straight from MaNGOS, may need more implementation to work
|
||||||
};
|
};
|
||||||
|
// Some Totems cast spells that are not in creature DB
|
||||||
|
#define SENTRY_TOTEM_SPELLID 6495
|
||||||
|
|
||||||
#define SENTRY_TOTEM_ENTRY 3968
|
#define SENTRY_TOTEM_ENTRY 3968
|
||||||
|
|
||||||
class Totem : public Minion
|
class Totem : public Minion
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user