diff options
Diffstat (limited to 'src/game/Totem.cpp')
| -rw-r--r-- | src/game/Totem.cpp | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index eff78d4e8cd..3bee1c005b2 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -53,8 +53,12 @@ void Totem::Update( uint32 time ) Creature::Update( time ); } -void Totem::Summon(Unit* owner) +void Totem::InitSummon(uint32 duration) { + Unit *owner = GetOwner(); + if(!owner) + return; + CreatureInfo const *cinfo = GetCreatureInfo(); if (owner->GetTypeId()==TYPEID_PLAYER && cinfo) { @@ -79,24 +83,32 @@ void Totem::Summon(Unit* owner) sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam()); } - // Only add if a display exists. - sLog.outDebug("AddObject at Totem.cpp line 49"); - SetInstanceId(owner->GetInstanceId()); - owner->GetMap()->Add((Creature*)this); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data,true); - switch(m_type) - { - case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; - case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; - default: break; - } + if(m_type == TOTEM_PASSIVE) + CastSpell(this, GetSpell(), true); if(GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); + + m_duration = duration; + + SetCreatorGUID(owner->GetGUID()); + setFaction(owner->getFaction()); + SetLevel(owner->getLevel()); + + // Get spell casted by totem + SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell()); + if (totemSpell) + { + // If spell have cast time -> so its active totem + if (GetSpellCastTime(totemSpell)) + m_type = TOTEM_ACTIVE; + } + + TempSummon::InitSummon(duration); } void Totem::UnSummon() @@ -142,14 +154,6 @@ void Totem::UnSummon() AddObjectToRemoveList(); } -void Totem::SetOwner(Unit *owner) -{ - SetCreatorGUID(owner->GetGUID()); - TempSummon::SetOwner(owner, true); - setFaction(owner->getFaction()); - SetLevel(owner->getLevel()); -} - Unit *Totem::GetOwner() { uint64 ownerid = GetOwnerGUID(); @@ -158,20 +162,6 @@ Unit *Totem::GetOwner() return ObjectAccessor::GetUnit(*this, ownerid); } -void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto) -{ - // Get spell casted by totem - SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell()); - if (totemSpell) - { - // If spell have cast time -> so its active totem - if (GetSpellCastTime(totemSpell)) - m_type = TOTEM_ACTIVE; - } - if(spellProto->SpellIconID==2056) - m_type = TOTEM_STATUE; //Jewelery statue -} - bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const { // TODO: possibly all negative auras immuned? |
