aboutsummaryrefslogtreecommitdiff
path: root/src/game/Totem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Totem.cpp')
-rw-r--r--src/game/Totem.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index 077dec45cde..f1629d4e6a2 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -56,21 +56,23 @@ void Totem::Update( uint32 time )
void Totem::Summon(Unit* owner)
{
- sLog.outDebug("AddObject at Totem.cpp line 49");
-
- SetInstanceId(owner->GetInstanceId());
- owner->GetMap()->Add((Creature*)this);
-
- // select totem model in dependent from owner team
CreatureInfo const *cinfo = GetCreatureInfo();
- if(owner->GetTypeId()==TYPEID_PLAYER && cinfo)
+ if (owner->GetTypeId()==TYPEID_PLAYER && cinfo)
{
- if(((Player*)owner)->GetTeam()==HORDE)
- SetDisplayId(cinfo->DisplayID_H);
+ if (uint32 modelid = cinfo->GetRandomValidModelId())
+ SetDisplayId(modelid);
else
- SetDisplayId(cinfo->DisplayID_A);
+ {
+ sLog.outErrorDb("No displayid found for the totem with the entry %u! Can't summon it!", GetEntry());
+ return;
+ }
}
+ // 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);