*Update summon system.

*Fix the bug that shaman cannot summon fire elemental.
*Fix the bug that totem meters cannot be displayed.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-02 19:24:22 -05:00
parent abe9b27ee4
commit 122d944945
12 changed files with 124 additions and 98 deletions
+7 -19
View File
@@ -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?