aboutsummaryrefslogtreecommitdiff
path: root/src/game/Totem.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-02 19:24:22 -0500
committermegamage <none@none>2009-05-02 19:24:22 -0500
commit122d94494523bd9e7fe8fabbacd11c08dbaba8f8 (patch)
tree54a52abd8d6bb27f72f9090a4e9fd78d14f69cab /src/game/Totem.cpp
parentabe9b27ee44dd8484b8b8992bba742480f4ab33a (diff)
*Update summon system.
*Fix the bug that shaman cannot summon fire elemental. *Fix the bug that totem meters cannot be displayed. --HG-- branch : trunk
Diffstat (limited to 'src/game/Totem.cpp')
-rw-r--r--src/game/Totem.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index 1b23b40fa37..5f1a044d4df 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -26,7 +26,7 @@
#include "ObjectMgr.h"
#include "SpellMgr.h"
-Totem::Totem(SummonPropertiesEntry const *properties, Unit *owner) : TempSummon(properties, owner)
+Totem::Totem(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner)
{
m_summonMask |= SUMMON_MASK_TOTEM;
m_duration = 0;
@@ -35,8 +35,7 @@ Totem::Totem(SummonPropertiesEntry const *properties, Unit *owner) : TempSummon(
void Totem::Update( uint32 time )
{
- Unit *owner = GetOwner();
- if (!owner || !owner->isAlive() || !isAlive())
+ if (!m_owner->isAlive() || !isAlive())
{
UnSummon(); // remove self
return;
@@ -55,15 +54,13 @@ void Totem::Update( uint32 time )
void Totem::InitSummon(uint32 duration)
{
- Unit *owner = GetOwner();
- if(!owner)
- return;
+ Minion::InitSummon(duration);
CreatureInfo const *cinfo = GetCreatureInfo();
- if (owner->GetTypeId()==TYPEID_PLAYER && cinfo)
+ if (m_owner->GetTypeId()==TYPEID_PLAYER && cinfo)
{
uint32 modelid = 0;
- if(((Player*)owner)->GetTeam() == HORDE)
+ if(((Player*)m_owner)->GetTeam() == HORDE)
{
if(cinfo->Modelid_H1)
modelid = cinfo->Modelid_H1;
@@ -80,7 +77,7 @@ void Totem::InitSummon(uint32 duration)
if (modelid)
SetDisplayId(modelid);
else
- sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam());
+ sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)m_owner)->GetTeam());
}
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
@@ -95,9 +92,7 @@ void Totem::InitSummon(uint32 duration)
m_duration = duration;
- SetCreatorGUID(owner->GetGUID());
- setFaction(owner->getFaction());
- SetLevel(owner->getLevel());
+ SetLevel(m_owner->getLevel());
// Get spell casted by totem
SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell());
@@ -107,8 +102,6 @@ void Totem::InitSummon(uint32 duration)
if (GetSpellCastTime(totemSpell))
m_type = TOTEM_ACTIVE;
}
-
- TempSummon::InitSummon(duration);
}
void Totem::UnSummon()
@@ -154,11 +147,6 @@ void Totem::UnSummon()
AddObjectToRemoveList();
}
-Unit *Totem::GetOwner()
-{
- return GetSummoner();
-}
-
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
// TODO: possibly all negative auras immuned?