aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-20 12:05:58 -0600
committermegamage <none@none>2009-02-20 12:05:58 -0600
commit1b587c0fe3355567173918d7a0b56141c6bcd1b2 (patch)
treefd8b03d40861ec08c1fd3d47744131032f7398bd /src/game/Object.cpp
parent187cd928ea6a02df715c349ec970d5899ef6274f (diff)
parent956c828bf56f06b5c25ff20d760ad41be2642a51 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 14a893f243e..26a36ebe1ba 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1606,7 +1606,6 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
{
TemporarySummon* pCreature = new TemporarySummon(GetGUID());
- //pCreature->SetInstanceId(GetInstanceId());
uint32 team = 0;
if (GetTypeId()==TYPEID_PLAYER)
team = ((Player*)this)->GetTeam();
@@ -1646,6 +1645,46 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
return pCreature;
}
+Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration)
+{
+ Pet* pCreature = new Pet(petType);
+
+ Map *map = GetMap();
+ uint32 pet_number = objmgr.GeneratePetNumber();
+ if(!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
+ {
+ sLog.outError("no such creature entry %u", entry);
+ delete pCreature;
+ return NULL;
+ }
+
+ pCreature->Relocate(x, y, z, ang);
+
+ if(!pCreature->IsPositionValid())
+ {
+ sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
+ delete pCreature;
+ return NULL;
+ }
+
+ if(duration > 0)
+ pCreature->SetDuration(duration);
+
+ pCreature->SetOwnerGUID(GetGUID());
+ pCreature->SetCreatorGUID(GetGUID());
+ pCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
+
+ pCreature->GetCharmInfo()->SetPetNumber(pet_number, false);
+
+ pCreature->AIM_Initialize();
+
+ map->Add((Creature*)pCreature);
+
+ AddGuardian(pCreature);
+
+ return pCreature;
+}
+
GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
{
if(!IsInWorld())