diff options
author | w12x <none@none> | 2008-10-17 18:13:04 -0500 |
---|---|---|
committer | w12x <none@none> | 2008-10-17 18:13:04 -0500 |
commit | 16dcd3727935841c94982165ef240d53d3b06db9 (patch) | |
tree | 06a29d396f16e2a4ffcc57899dfca0b53fb55c77 /src/game/Object.cpp | |
parent | 0bdf12f3dd07a036d799d5b19770817ff6c9225e (diff) |
[svn] Added a function for WorldObjects to summon GameObjects. Original patch provided by streetrat. Please refer to the patch thread for usage instructions.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index cbe40ffb593..be66efde0ad 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1435,6 +1435,29 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa 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()) + return NULL; + Map * map = GetMap(); + if(!map) + return NULL; + GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry); + if(!goinfo) + { + sLog.outErrorDb("Gameobject template %u not found in database!", entry); + return NULL; + } + GameObject *go = new GameObject(); + if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry,map,x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,1)) + return NULL; + go->SetRespawnTime(respawnTime); + go->SetSpawnedByDefault(false); // do not save respawn time + map->Add(go); + + return go; +} + void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle ) const { x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle); |