Show
Ignore:
Timestamp:
11/19/08 13:29:24 (17 years ago)
Author:
yumileroy
Message:

[svn] Added a function for WorldObjects? to summon GameObjects?. Original patch provided by streetrat. Please refer to the patch thread for usage instructions.

Original author: w12x
Date: 2008-10-17 18:13:04-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Object.cpp

    r44 r52  
    14361436} 
    14371437 
     1438GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime) 
     1439{ 
     1440    if(!IsInWorld()) 
     1441        return NULL; 
     1442    Map * map = GetMap(); 
     1443    if(!map) 
     1444        return NULL; 
     1445    GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry); 
     1446    if(!goinfo) 
     1447    { 
     1448        sLog.outErrorDb("Gameobject template %u not found in database!", entry); 
     1449        return NULL; 
     1450    } 
     1451    GameObject *go = new GameObject(); 
     1452    if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry,map,x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,1)) 
     1453        return NULL; 
     1454    go->SetRespawnTime(respawnTime); 
     1455    go->SetSpawnedByDefault(false); // do not save respawn time 
     1456    map->Add(go); 
     1457 
     1458    return go; 
     1459} 
     1460 
    14381461void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle ) const 
    14391462{