本文整理汇总了C++中GameObject::AddToWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::AddToWorld方法的具体用法?C++ GameObject::AddToWorld怎么用?C++ GameObject::AddToWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::AddToWorld方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRadius
void
Spell::Effect_Transmitted(uint32 i)
{
float fx,fy;
WorldPacket data;
float dis = GetRadius(sSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
fx = m_caster->GetPositionX() + dis * cos(m_caster->GetOrientation());
fy = m_caster->GetPositionY() + dis * sin(m_caster->GetOrientation());
GameObject* pGameObj = new GameObject();
uint32 name_id = m_spellInfo->EffectMiscValue[i];
pGameObj->Create(
objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),
name_id,m_caster->GetMapId(),
fx, fy, m_caster->GetPositionZ(),
m_caster->GetOrientation(), 0, 0, 0, 0);
pGameObj->SetUInt32Value(OBJECT_FIELD_ENTRY, m_spellInfo->EffectMiscValue[i] );
pGameObj->SetUInt32Value(OBJECT_FIELD_TYPE, 33 );
pGameObj->SetUInt32Value(OBJECT_FIELD_CREATED_BY, m_caster->GetGUIDLow() );
pGameObj->SetUInt32Value(GAMEOBJECT_ROTATION+1, 0x3F63BB3C );
pGameObj->SetUInt32Value(GAMEOBJECT_ROTATION+2, 0xBEE9E017 );
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel() );
pGameObj->PlaceOnMap();
pGameObj->AddToWorld();
data.Initialize(SMSG_GAMEOBJECT_SPAWN_ANIM);
data << (uint64)pGameObj->GetGUID();
m_caster->SendMessageToSet(&data,true);
}
示例2: SpawnObjects
void SpawnObjects(MapMgr *pmgr)
{
if(pmgr->GetMapId() != 530)
return;
const static sgodata godata[] = {
{ 182173, -290.016f, 3702.42f, 56.6729f, 0.0349066f, 0, 0, 0.0174524f, 0.999848f, 1, 32, 0, 1 }, // stadium
{ 182174, -184.889f, 3476.93f, 38.205f, -0.0174535f, 0, 0, 0.00872664f, -0.999962f, 1, 32, 0, 1 }, // overlook
{ 182175, -471.462f, 3451.09f, 34.6432f, 0.174533f, 0, 0, 0.0871557f, 0.996195f, 1, 32, 0, 1 }, // brokenhill
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};
const static sgodata godata_banner[] = {
{ 183515, -289.61f, 3696.83f, 75.9447f, 3.12414f, 0, 0, 0.999962f, 0.00872656f, 1, 32, 1375, 1 }, // stadium
{ 182525, -187.887f, 3459.38f, 60.0403f, -3.12414f, 0, 0, 0.999962f, -0.00872653f, 1, 32, 1375, 1 }, // overlook
{ 183514, -467.078f, 3528.17f, 64.7121f, 3.14159f, 0, 0, 1, -4.37114E-8f, 1, 32, 1375, 1 }, // brokenhill
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};
for(uint32 i = 0; i < 3; ++i)
{
GameObject *pGo = pmgr->GetInterface()->SpawnGameObject(godata[i].entry, godata[i].posx, godata[i].posy, godata[i].posz, godata[i].facing, false, 0, 0);
if(pGo == NULL)
continue;
GameObject *pGo2 = pmgr->GetInterface()->SpawnGameObject(godata_banner[i].entry, godata_banner[i].posx, godata_banner[i].posy, godata_banner[i].posz, godata_banner[i].facing, false, 0, 0);
if(pGo2 == NULL)
{
pGo->Delete();
continue;
}
pGo->SetUInt32Value(GAMEOBJECT_STATE, godata[i].state);
pGo->SetUInt32Value(GAMEOBJECT_FLAGS, godata[i].flags);
pGo->SetUInt32Value(GAMEOBJECT_FACTION, godata[i].faction);
pGo2->SetUInt32Value(GAMEOBJECT_STATE, godata_banner[i].state);
pGo2->SetUInt32Value(GAMEOBJECT_FLAGS, godata_banner[i].flags);
pGo2->SetUInt32Value(GAMEOBJECT_FACTION, godata_banner[i].faction);
for(uint32 j = 0; j < 4; ++j)
{
pGo->SetFloatValue(GAMEOBJECT_ROTATION + j, godata[i].orientation[j]);
pGo2->SetFloatValue(GAMEOBJECT_ROTATION + j, godata_banner[i].orientation[j]);
}
// now make his script
pGo->SetScript(new HellfirePeninsulaBannerAI(pGo));
dynamic_cast<HellfirePeninsulaBannerAI*>(pGo->GetScript())->pBanner = pGo2;
pGo->AddToWorld(pmgr);
pGo2->AddToWorld(pmgr);
dynamic_cast<HellfirePeninsulaBannerAI*>(pGo->GetScript())->SetupGo(pmgr);
}
}
示例3: SpawnBattleground
void Arena::SpawnBattleground()
{
// Alliance Gate
GameObject *gate = SpawnGameObject(180255, 529, 1284.597290, 1281.166626, -15.977916, 0.706859, 32, 114, 1.5799990);
gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0129570);
gate->SetFloatValue(GAMEOBJECT_ROTATION_01,-0.0602880);
gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.3449600);
gate->SetFloatValue(GAMEOBJECT_ROTATION_03,0.9365900);
gate->AddToWorld();
m_Gates.insert(gate);
// Horde Gate
gate = SpawnGameObject(180256, 529, 708.0902710, 708.4479370, -17.3898964, -2.3910990, 32, 114, 1.5699990);
gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0502910);
gate->SetFloatValue(GAMEOBJECT_ROTATION_01,0.0151270);
gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.9292169);
gate->SetFloatValue(GAMEOBJECT_ROTATION_03,-0.3657840);
gate->AddToWorld();
m_Gates.insert(gate);
bSpawned = true;
}
示例4: AddObject
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/)
{
// must be created this way, adding to godatamap would add it to the base map of the instance
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
// so we must create it specific for this instance
GameObject * go = new GameObject;
if(!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
{
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);
delete go;
return false;
}
/*
uint32 guid = go->GetGUIDLow();
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
// iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
GameObjectData& data = objmgr.NewGOData(guid);
data.id = entry;
data.mapid = GetMapId();
data.posX = x;
data.posY = y;
data.posZ = z;
data.orientation = o;
data.rotation0 = rotation0;
data.rotation1 = rotation1;
data.rotation2 = rotation2;
data.rotation3 = rotation3;
data.spawntimesecs = respawnTime;
data.spawnMask = 1;
data.animprogress = 100;
data.go_state = 1;
*/
// add to world, so it can be later looked up from HashMapHolder
go->AddToWorld();
m_BgObjects[type] = go->GetGUID();
return true;
}
示例5: SpawnBattleground
void AlteracValley::SpawnBattleground()
{
// Alliance Gate
/*GameObject *gate = SpawnGameObject(180255, 529, 1284.597290, 1281.166626, -15.977916, 0.706859, 32, 114, 1.5799990);
gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0129570);
gate->SetFloatValue(GAMEOBJECT_ROTATION_01,-0.0602880);
gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.3449600);
gate->SetFloatValue(GAMEOBJECT_ROTATION_03,0.9365900);
m_Gates.insert(gate);
// Horde Gate
gate = SpawnGameObject(180256, 529, 708.0902710, 708.4479370, -17.3898964, -2.3910990, 32, 114, 1.5699990);
gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0502910);
gate->SetFloatValue(GAMEOBJECT_ROTATION_01,0.0151270);
gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.9292169);
gate->SetFloatValue(GAMEOBJECT_ROTATION_03,-0.3657840);
m_Gates.insert(gate);*/
// -- Places Banners --
// Frostworlf gravyard
GameObject *pbanner = SpawnGameObject(178393 ,30 ,-1083.244385 ,-345.994507 ,55.124435 ,4.596910, 32, 84, 1);
pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->AddToWorld();
if(pbanner->GetInfo()->sound3)
{
pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->pcbannerAura->AddToWorld();
}
pbanner->bannerslot = 0;
// Iceblood graveyard
pbanner = SpawnGameObject(178393, 30 ,-612.329285 ,-396.660095 ,60.858463 ,2.916166, 32, 84, 1);
pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->AddToWorld();
if(pbanner->GetInfo()->sound3)
{
pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->pcbannerAura->AddToWorld();
}
pbanner->bannerslot = 1;
// Stormpike gravyard
pbanner = SpawnGameObject(178389, 30 ,669.968567 ,-293.467468 ,30.283821 ,3.152932, 32, 83, 1);
pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->AddToWorld();
if(pbanner->GetInfo()->sound3)
{
pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->pcbannerAura->AddToWorld();
}
pbanner->bannerslot = 2;
// Stoneheart gravyard
pbanner = SpawnGameObject(178389, 30 ,78.205989 ,-405.1715 ,47.11583 ,1.535766, 32, 83, 1);
pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->AddToWorld();
if(pbanner->GetInfo()->sound3)
{
pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pbanner->pcbannerAura->AddToWorld();
}
pbanner->bannerslot = 3;
//.........这里部分代码省略.........
示例6: HandleBanner
void AlteracValley::HandleBanner(Player *p_caster,GameObject *go,uint32 spellid)
{
int32 bannerslot = go->bannerslot;
// spawn contest banner
if(bannerslot > -1 && bannerslot < MAXOFBANNERS)
{
sEventMgr.RemoveEvents(this,EVENT_BATTLEGROUND_AV_CAPTURE_BASE + bannerslot);
// If whe contest a horde/alliance flag, he loses the base
/*uint32 rbasesfield = p_caster->m_bgTeam ? AB_ALLIANCE_CAPTUREBASE : AB_HORDE_CAPTUREBASE;
if(go->GetEntry() == 180078 || go->GetEntry() == 180076)
{
uint64 guid = p_caster->GetGUID();
std::map<uint64, BattlegroundScore>::iterator itr = m_PlayerScores.find(guid);
if(itr == m_PlayerScores.end())
{
SendMessageToPlayer(p_caster, "INTERNAL ERROR: Could not find in internal player score map!", true);
return;
}
itr->second.FlagReturns++;
UpdatePVPData();
SetWorldStateValue(rbasesfield,WorldStateVars[rbasesfield]-1);
}*/
uint32 goentry = 0;
if(bannerslot < 6) // outside flags are diferent
goentry = p_caster->m_bgTeam ? 180420:180419;
else
goentry = p_caster->m_bgTeam ? 179435:178940;
gcbanner[bannerslot] = SpawnGameObject(goentry, 30, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetOrientation(), 32, 83, 1);
GameObject *pcbanner = gcbanner[bannerslot];
pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_02,go->GetFloatValue(GAMEOBJECT_ROTATION_02));
pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_03,go->GetFloatValue(GAMEOBJECT_ROTATION_03));
pcbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
pcbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
pcbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pcbanner->SetUInt32Value(GAMEOBJECT_DYN_FLAGS,1);
pcbanner->bannerslot = bannerslot;
pcbanner->AddToWorld();
if(pcbanner->GetInfo()->sound3)
{
pcbanner->pcbannerAura = SpawnGameObject(pcbanner->GetInfo()->sound3, 30, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetOrientation(), 32, 114, 5);
pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,go->GetFloatValue(GAMEOBJECT_ROTATION_02));
pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,go->GetFloatValue(GAMEOBJECT_ROTATION_03));
pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pcbanner->pcbannerAura->AddToWorld();
}
if(go->pcbannerAura)
{
if( go->pcbannerAura->IsInWorld() )
go->pcbannerAura->RemoveFromWorld();
delete go->pcbannerAura;
}
if( go->IsInWorld() )
go->RemoveFromWorld();
delete go;
char message[300];
static char *resnames[11] = {"Frostworlf Gravyard","Iceblood Graveyard","Stormpike Gravyard",
"Stoneheart gravyard","Relief Hunt","Stormpike Aid Station",
"Iceblood Tower","Stoneheart Bunker","Icewing Bunker",
"Stormpike North Bunker","Stormpike South Bunker"};
snprintf(message, 300, "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", resnames[bannerslot] , p_caster->m_bgTeam ? "Horde" : "Alliance" );
WorldPacket *data = BuildMessageChat(p_caster->m_bgTeam ? 0x54:0x53, 0, message, 0,p_caster->GetGUID());
SendPacketToAll(data);
delete data;
sEventMgr.AddEvent(this, &AlteracValley::EventCaptureBase, p_caster, (uint32)bannerslot, EVENT_BATTLEGROUND_AV_CAPTURE_BASE + bannerslot, 60000, 1);
}
}
示例7: EventCaptureBase
void AlteracValley::EventCaptureBase(Player *src,uint32 bannerslot)
{
if(!gcbanner[bannerslot])
return;
/*uint64 guid = src->GetGUID();
std::map<uint64, BattlegroundScore>::iterator itr = m_PlayerScores.find(guid);
if(itr == m_PlayerScores.end())
{
SendMessageToPlayer(src, "INTERNAL ERROR: Could not find in internal player score map!", true);
return;
}
itr->second.FlagCaptures++;
UpdatePVPData();*/
//uint32 rbasesfield = src->m_bgTeam ? AB_HORDE_CAPTUREBASE : AB_ALLIANCE_CAPTUREBASE;
uint32 goentry = 0;
if(bannerslot < 6) // outside flags are diferent
goentry = src->m_bgTeam ? 178393:178389;
else
goentry = src->m_bgTeam ? 178946:178935;
GameObject *pcbanner = src->GetCurrentBattleground()->SpawnGameObject(goentry, 30, gcbanner[bannerslot]->GetPositionX(), gcbanner[bannerslot]->GetPositionY(), gcbanner[bannerslot]->GetPositionZ(), gcbanner[bannerslot]->GetOrientation(), 32, src->m_bgTeam ?84:83, 1);
pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_02,gcbanner[bannerslot]->GetFloatValue(GAMEOBJECT_ROTATION_02));
pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_03,gcbanner[bannerslot]->GetFloatValue(GAMEOBJECT_ROTATION_03));
pcbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
pcbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
pcbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pcbanner->AddToWorld();
if(pcbanner->GetInfo()->sound3)
{
pcbanner->pcbannerAura = src->GetCurrentBattleground()->SpawnGameObject(pcbanner->GetInfo()->sound3, 30, pcbanner->GetPositionX(), pcbanner->GetPositionY(), pcbanner->GetPositionZ(), pcbanner->GetOrientation(), 32, 114, 5);
pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pcbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pcbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
pcbanner->pcbannerAura->AddToWorld();
}
if(gcbanner[bannerslot]->pcbannerAura)
{
if( gcbanner[bannerslot]->pcbannerAura->IsInWorld() )
gcbanner[bannerslot]->pcbannerAura->RemoveFromWorld();
delete gcbanner[bannerslot]->pcbannerAura;
}
if( gcbanner[bannerslot]->IsInWorld() )
gcbanner[bannerslot]->RemoveFromWorld();
delete gcbanner[bannerslot];
gcbanner[bannerslot] = NULL;
// Play sound
WorldPacket pkt;
pkt.Initialize(SMSG_PLAY_SOUND);
pkt << uint32(src->m_bgTeam ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE);
SendPacketToAll(&pkt);
char message[300];
static char *resnames[11] = {"Frostworlf Gravyard","Iceblood Graveyard","Stormpike Gravyard",
"Stoneheart gravyard","Relief Hunt","Stormpike Aid Station",
"Iceblood Tower","Stoneheart Bunker","Icewing Bunker",
"Stormpike North Bunker","Stormpike South Bunker"};
snprintf(message, 300, "The %s has taken the %s!", src->m_bgTeam ? "Horde" : "Alliance" , resnames[bannerslot] );
WorldPacket *data = BuildMessageChat(src->m_bgTeam ? 0x54:0x53, 0x27, message, 0);
SendPacketToAll(data);
delete data;
}
示例8: ProcessObjectsAndScriptsProc
//.........这里部分代码省略.........
// get mapmgr for spawn
MapMgr * mgr = sInstanceMgr.GetMapMgr(mapid);
if(mgr == NULL)
{
// So this is a really interesting situation!
Log.Success("GameEvent","Failed to spawn creature spawn %u for event %u on nonexistant map %u", spawn.id, id, mapid);
continue;
}
// spawn the creature
//Creature * crt = mgr->GetInterface()->SpawnCreature(&spawn, true);
Creature * crt = mgr->CreateCreature(spawn.entry);
if(crt == NULL)
{
// we didnt succeed creating the creature! Print a warning and go on
Log.Success("GameEvent","Failed to spawn creature spawn %u for event %u", spawn.id, id);
continue;
}
crt->Load(&spawn, 0, mgr->GetMapInfo());
crt->spawnid = 0;
crt->m_spawn = NULL;
// add waypoints
crt->m_custom_waypoint_map = new WayPointMap();
for(std::list<WayPoint *>::iterator itr = waypoints[id][spawn_id].begin(); itr != waypoints[id][spawn_id].end(); itr++)
{
// use custom waypoint map, so we avoid saving it to database
crt->m_custom_waypoint_map->push_back(*itr);
}
crt->GetAIInterface()->SetWaypointMap(crt->m_custom_waypoint_map);
crt->AddToWorld(mgr);
m_creaturespawns[id][mapid].push_back(crt->GetUIdFromGUID());
}
while(query->NextRow());
}
// gameobject spawns
if(QueryResult *query = results[3].result)
{
do
{
Field * f = query->Fetch();
GOSpawn spawn;
//uint32 event = f[0].GetUInt32();
uint32 spawn_id = f[1].GetUInt32();
// generate new ingame sql id
spawn.id = /*objmgr.GenerateCreatureSpawnID()*/0;
spawn.entry = f[2].GetUInt32();
uint32 mapid = f[3].GetUInt32();
spawn.x = f[4].GetFloat();
spawn.y = f[5].GetFloat();
spawn.z = f[6].GetFloat();
spawn.facing = f[7].GetFloat();
spawn.o = f[8].GetFloat();
spawn.o1 = f[9].GetFloat();
spawn.o2 = f[10].GetFloat();
spawn.o3 = f[11].GetFloat();
spawn.state = f[12].GetUInt32();
spawn.flags = f[13].GetUInt32();
spawn.faction = f[14].GetUInt32();
spawn.scale = f[15].GetFloat();