本文整理汇总了C++中SetWorldState函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWorldState函数的具体用法?C++ SetWorldState怎么用?C++ SetWorldState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetWorldState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetWorldState
void Arena::UpdatePlayerCounts()
{
if(m_ended)
return;
uint32 players[2] = {0,0};
for(uint32 i = 0; i < 2; ++i)
{
for(set<uint32>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
{
Player *plr = objmgr.GetPlayer(*itr);
if ( plr != NULL && plr->isAlive() )
players[i]++;
}
}
SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, players[0]);
SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, players[1]);
if(!m_started)
return;
if(players[1] == 0)
m_winningteam = 0;
else if(players[0] == 0)
m_winningteam = 1;
else
return;
Finish();
}
示例2: UpdatePvPData
void WarsongGulch::HookFlagDrop(Player * plr, GameObject * obj)
{
/* picking up a dropped flag */
if(m_dropFlags[plr->GetTeam()] != obj)
{
/* are we returning it? */
if( (obj->GetEntry() == 179785 && plr->GetTeam() == 0) ||
(obj->GetEntry() == 179786 && plr->GetTeam() == 1) )
{
uint32 x = plr->GetTeam() ? 0 : 1;
sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam());
if( m_dropFlags[x]->IsInWorld() )
m_dropFlags[x]->RemoveFromWorld(false);
if(m_homeFlags[x]->IsInWorld() == false)
m_homeFlags[x]->PushToWorld(m_mapMgr);
plr->m_bgScore.Misc2++;
UpdatePvPData();
if( plr->GetTeam() == 1 )
SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was returned to its base by %s!", plr->GetName() );
else
SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was returned to its base by %s!", plr->GetName() );
SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1);
PlaySoundToAll(plr->GetTeam() ? SOUND_HORDE_RETURNED : SOUND_ALLIANCE_RETURNED);
}
return;
}
if( plr->GetTeam() == 0 )
sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG);
else
sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + 1);
if( m_dropFlags[plr->GetTeam()]->IsInWorld() )
m_dropFlags[plr->GetTeam()]->RemoveFromWorld(false);
m_flagHolders[plr->GetTeam()] = plr->GetLowGUID();
plr->m_bgHasFlag = true;
/* This is *really* strange. Even though the A9 create sent to the client is exactly the same as the first one, if
* you spawn and despawn it, then spawn it again it will not show. So we'll assign it a new guid, hopefully that
* will work.
* - Burlex
*/
m_dropFlags[plr->GetTeam()]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
SpellEntry * pSp = dbcSpell.LookupEntry(23333 + (plr->GetTeam() * 2));
Spell * sp = new Spell(plr, pSp, true, 0);
SpellCastTargets targets(plr->GetGUID());
sp->prepare(&targets);
SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 2);
}
示例3: RemoveSpiritGuide
void ArathiBasin::CaptureControlPoint(uint32 Id, uint32 Team)
{
if (m_basesOwnedBy[Id] != -1)
{
// there is a very slim chance of this happening, 2 teams evnets could clash..
// just in case...
return;
}
// anticheat, not really necessary because this is a server method but anyway
if (m_basesAssaultedBy[Id] != (int32)Team)
return;
m_basesOwnedBy[Id] = Team;
m_basesAssaultedBy[Id] = -1;
// remove the other spirit guide (if it exists) // burlex: shouldnt' happen
if (m_spiritGuides[Id] != NULL)
{
RemoveSpiritGuide(m_spiritGuides[Id]);
m_spiritGuides[Id]->Despawn(0, 0);
}
// spawn the spirit guide for our faction
m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team);
AddSpiritGuide(m_spiritGuides[Id]);
// send the chat message/sounds out
PlaySoundToAll(Team ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE);
SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]);
// update the overhead display on the clients (world states)
m_capturedBases[Team]++;
SetWorldState(Team ? AB_HORDE_CAPTUREBASE : AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Team]);
// respawn the control point with the correct aura
SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_CONTROLLED : AB_SPAWN_TYPE_ALLIANCE_CONTROLLED);
// update the map
SetWorldState(AssaultFields[Id][Team], 0);
SetWorldState(OwnedFields[Id][Team], 1);
// resource update event. :)
if (m_capturedBases[Team] == 1)
{
// first
sEventMgr.AddEvent(this, &ArathiBasin::EventUpdateResources, (uint32)Team, EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Team, ResourceUpdateIntervals[1], 0,
EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
}
else
{
// not first
event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Team, ResourceUpdateIntervals[m_capturedBases[Team]]);
}
}
示例4: UpdatePvPData
bool EyeOfTheStorm::GivePoints(uint32 team, uint32 points)
{
//printf("EOTS: Give team %u %u points.\n", team, points);
m_points[team] += points;
if((m_points[team] - m_lastHonorGainPoints[team]) >= resourcesToGainBH)
{
uint32 honorToAdd = m_honorPerKill;
m_mainLock.Acquire();
for(set<Player*>::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
{
(*itr)->m_bgScore.BonusHonor += honorToAdd;
HonorHandler::AddHonorPointsToPlayer((*itr), honorToAdd);
}
UpdatePvPData();
m_mainLock.Release();
m_lastHonorGainPoints[team] += resourcesToGainBH;
}
if(m_points[team] >= 1600)
{
m_points[team] = 1600;
m_ended = true;
m_winningteam = static_cast<uint8>(team);
m_nextPvPUpdateTime = 0;
sEventMgr.RemoveEvents(this);
sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
m_mainLock.Acquire();
AddHonorToTeam( m_winningteam, 3 * 185 );
CastSpellOnTeam( m_winningteam, 43477 );
CastSpellOnTeam( m_winningteam, 69156 );
if( m_winningteam == TEAM_ALLIANCE )
AddHonorToTeam( TEAM_HORDE, 1 * 185 );
else
AddHonorToTeam( TEAM_ALLIANCE, 1 * 185 );
m_mainLock.Release();
SetWorldState(WORLDSTATE_EOTS_ALLIANCE_VICTORYPOINTS + team, m_points[team]);
UpdatePvPData();
return true;
}
SetWorldState(WORLDSTATE_EOTS_ALLIANCE_VICTORYPOINTS + team, m_points[team]);
return false;
}
示例5: SetWorldState
void StrandOfTheAncient::SpawnControlPoint(SOTAControlPoints point, SOTACPStates state)
{
if (state >= MAX_SOTA_CP_STATES)
return;
SOTAControlPoint &cp = controlpoint[point];
if (cp.worldstate != 0)
SetWorldState(cp.worldstate, 0);
uint32 team = TEAM_ALLIANCE;
uint32 faction = 0;
switch (state)
{
case SOTA_CP_STATE_ALLY_CONTROL:
team = TEAM_ALLIANCE;
faction = 2;
break;
case SOTA_CP_STATE_HORDE_CONTROL:
team = TEAM_HORDE;
faction = 1;
break;
default:
return;
break;
}
// First time spawning
if (cp.pole == NULL)
{
cp.pole = SpawnGameObject(SOTA_FLAGPOLE_ID, FlagPolePositions[point], 0, 35, 1.0f);
cp.pole->PushToWorld(m_mapMgr);
}
else
{
if (cp.banner->IsInWorld())
cp.banner->RemoveFromWorld(false);
}
cp.banner = SpawnGameObject(FlagIDs[point][team], FlagPositions[point], 0, faction, 1.0f);
cp.banner->PushToWorld(m_mapMgr);
cp.state = state;
cp.worldstate = CPWorldstates[point][team];
SetWorldState(cp.worldstate, 1);
//Spawn graveyard
SpawnGraveyard(SOTAGraveyards(uint32(point)), team);
}
示例6: SetWorldState
// time in seconds
void StrandOfTheAncient::SetTime( uint32 secs ){
uint32 minutes = secs / TIME_MINUTE;
uint32 seconds = secs % TIME_MINUTE;
uint32 digits[3];
digits[0] = minutes;
digits[1] = seconds / 10;
digits[2] = seconds % 10;
SetWorldState(WORLDSTATE_SOTA_TIMER_1, digits[0]);
SetWorldState(WORLDSTATE_SOTA_TIMER_2, digits[1]);
SetWorldState(WORLDSTATE_SOTA_TIMER_3, digits[2]);
SetRoundTime(secs);
}
示例7: RemoveSpiritGuide
void IsleOfConquest::CaptureControlPoint(uint32 Id, uint32 Team)
{
if(m_basesOwnedBy[Id] != -1)
{
// there is a very slim chance of this happening, 2 teams evnets could clash..
// just in case...
return;
}
// anticheat, not really necessary because this is a server method but anyway
if(m_basesAssaultedBy[Id] != (int32)Team)
return;
m_basesLastOwnedBy[Id] = Team;
m_flagIsVirgin[Id] = false;
m_basesOwnedBy[Id] = Team;
m_basesAssaultedBy[Id]=-1;
// remove the other spirit guide (if it exists) // burlex: shouldnt' happen
if(m_spiritGuides[Id] != NULL)
{
RemoveSpiritGuide(m_spiritGuides[Id]);
m_spiritGuides[Id]->Despawn(0,0);
}
// spawn the spirit guide for our faction
m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team);
AddSpiritGuide(m_spiritGuides[Id]);
// send the chat message/sounds out
PlaySoundToAll(Team ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES);
SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]);
// update the overhead display on the clients (world states)
m_capturedBases[Team]++;
// respawn the control point with the correct aura
SpawnControlPoint(Id, Team ? IOC_SPAWN_TYPE_HORDE_CONTROLLED : IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED);
// update the map
SetWorldState(AssaultFields[Id][Team], 0);
SetWorldState(OwnedFields[Id][Team], 1);
AddHonorToTeam(5, Team);
ApplyCaptureBonus(Id, Team);
if(Id == 5)
Updateworkshop(Team);
}
示例8: SpawnGameObject
void ArathiBasin::OnCreate()
{
// Alliance Gate
GameObject* gate = SpawnGameObject(180255, 529, 1284.597290f, 1281.166626f, -15.977916f, 0.76f, 32, 114, 1.5799990f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
// horde gate
gate = SpawnGameObject(180256, 529, 708.0902710f, 708.4479370f, -17.3898964f, 3.92f, 32, 114, 1.5699990f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
// spawn (default) control points
SpawnControlPoint(AB_CONTROL_POINT_STABLE, AB_SPAWN_TYPE_NEUTRAL);
SpawnControlPoint(AB_CONTROL_POINT_BLACKSMITH, AB_SPAWN_TYPE_NEUTRAL);
SpawnControlPoint(AB_CONTROL_POINT_LUMBERMILL, AB_SPAWN_TYPE_NEUTRAL);
SpawnControlPoint(AB_CONTROL_POINT_MINE, AB_SPAWN_TYPE_NEUTRAL);
SpawnControlPoint(AB_CONTROL_POINT_FARM, AB_SPAWN_TYPE_NEUTRAL);
// spawn buffs
SpawnBuff(AB_BUFF_STABLES);
SpawnBuff(AB_BUFF_BLACKSMITH);
SpawnBuff(AB_BUFF_LUMBERMILL);
SpawnBuff(AB_BUFF_MINE);
SpawnBuff(AB_BUFF_FARM);
// spawn the h/a base spirit guides
AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0], NoBaseGYLocations[0][1], NoBaseGYLocations[0][2], 0.0f, 0));
AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0], NoBaseGYLocations[1][1], NoBaseGYLocations[1][2], 0.0f, 1));
// Let's set this from the config
SetWorldState( WORLDSTATE_AB_MAX_SCORE, RESOURCES_WINVAL );
}
示例9: SetWorldState
void WarsongGulch::HookOnFlagDrop(Player* plr)
{
if (!plr->m_bgHasFlag || m_dropFlags[plr->GetTeam()]->IsInWorld())
return;
// drop the flag!
m_dropFlags[plr->GetTeam()]->SetPosition(plr->GetPosition());
// m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_X, plr->GetPositionX());
// m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Y, plr->GetPositionY());
// m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Z, plr->GetPositionZ());
// m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_FACING, plr->GetOrientation());
m_dropFlags[plr->GetTeam()]->PushToWorld(m_mapMgr);
m_flagHolders[plr->GetTeam()] = 0;
plr->m_bgHasFlag = false;
plr->RemoveAura(23333 + (plr->GetTeam() * 2));
SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_ALLIANCE_FLAG_DISPLAY : WORLDSTATE_WSG_HORDE_FLAG_DISPLAY, 1);
sEventMgr.AddEvent(this, &WarsongGulch::ReturnFlag, plr->GetTeamReal(), EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam(), 5000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
PlaySoundToAll(SOUND_FLAG_RETURNED);
if (plr->IsTeamHorde())
SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was dropped by %s!", plr->GetName());
else
SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was dropped by %s!", plr->GetName());
}
示例10: SetWorldState
void WarsongGulch::DropFlag(Player * plr)
{
if(!plr->m_bgHasFlag || m_dropFlags[plr->GetTeam()]->IsInWorld())
return;
/* drop the flag! */
m_dropFlags[plr->GetTeam()]->SetPosition(plr->GetPosition());
m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_X, plr->GetPositionX());
m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Y, plr->GetPositionY());
m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Z, plr->GetPositionZ());
m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_FACING, plr->GetOrientation());
m_dropFlags[plr->GetTeam()]->PushToWorld(m_mapMgr);
m_flagHolders[plr->GetTeam()] = 0;
SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1);
plr->m_bgHasFlag = false;
plr->CastSpell(plr, 42792, true);
sEventMgr.AddEvent( this, &WarsongGulch::ReturnFlag, plr->GetTeam(), EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam(), 5000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT );
if( plr->GetTeam() == 1 )
SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was dropped by %s!", plr->GetName() );
else
SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was dropped by %s!", plr->GetName() );
}
示例11: SetWorldState
void IsleOfConquest::RemoveReinforcements( uint32 team, uint32 amount ){
m_reinforcements[ team ] -= amount;
SetWorldState( WORLDSTATE_IOC_ALLY_SCORE_VALUE + team, m_reinforcements[ team ] );
if( m_reinforcements[ team ] == 0 )
Finish( team );
}
示例12: SetWorldState
void EyeOfTheStorm::EventResetFlag()
{
if(!m_dropFlag->IsInWorld())
return;
m_dropFlag->RemoveFromWorld(false);
m_standFlag->PushToWorld(m_mapMgr);
SetWorldState( 2757, 1 );
PlaySoundToAll( 8192 );
SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flag has been reset." );
m_flagHolder = 0;
}
示例13: SetWorldState
void Arena::UpdatePlayerCounts()
{
if(m_ended)
return;
SetWorldState(WORLDSTATE_ARENA__GREEN_PLAYER_COUNT, m_playersCount[0]);
SetWorldState(WORLDSTATE_ARENA__GOLD_PLAYER_COUNT, m_playersCount[1]);
if(!m_started)
return;
return;
if(m_playersCount[1] == 0)
m_winningteam = 0;
else if(m_playersCount[0] == 0)
m_winningteam = 1;
else
return;
Finish();
}
示例14: SpawnGameObject
void WarsongGulch::OnCreate()
{
/* add the buffs to the world */
for(int i = 0; i < 6; ++i)
{
if(!m_buffs[i]->IsInWorld())
m_buffs[i]->PushToWorld(m_mapMgr);
}
// Alliance Gates
GameObject* gate = SpawnGameObject(179921, 489, 1471.554688f, 1458.778076f, 362.633240f, 0, 33, 114, 2.33271f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
gate = SpawnGameObject(179919, 489, 1492.477783f, 1457.912354f, 342.968933f, 0, 33, 114, 2.68149f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
gate = SpawnGameObject(179918, 489, 1503.335327f, 1493.465820f, 352.188843f, 0, 33, 114, 2.26f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
// Horde Gates
gate = SpawnGameObject(179916, 489, 949.1663208f, 1423.7717285f, 345.6241455f, -0.5756807f, 32, 114, 0.900901f);
gate->SetParentRotation(0, -0.0167336f);
gate->SetParentRotation(1, -0.004956f);
gate->SetParentRotation(2, -0.283972f);
gate->SetParentRotation(3, 0.9586736f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
gate = SpawnGameObject(179917, 489, 953.0507202f, 1459.8424072f, 340.6525573f, -1.9966197f, 32, 114, 0.854700f);
gate->SetParentRotation(0, -0.1971825f);
gate->SetParentRotation(1, 0.1575096f);
gate->SetParentRotation(2, -0.8239487f);
gate->SetParentRotation(3, 0.5073640f);
gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100);
gate->PushToWorld(m_mapMgr);
m_gates.push_back(gate);
// Should be set from config
SetWorldState( WORLDSTATE_WSG_MAX_SCORE, 3 );
/* spawn spirit guides */
AddSpiritGuide(SpawnSpiritGuide(1423.218872f, 1554.663574f, 342.833801f, 3.124139f, 0));
AddSpiritGuide(SpawnSpiritGuide(1032.644775f, 1388.316040f, 340.559937f, 0.043200f, 1));
}
示例15: SetWorldState
void EyeOfTheStorm::EventResetFlag()
{
if(!m_dropFlag->IsInWorld())
return;
m_dropFlag->RemoveFromWorld(false);
m_dropFlag->SetUInt32Value(GAMEOBJECT_FLAGS, 0);
m_standFlag->PushToWorld(m_mapMgr);
SetWorldState(2757, 1);
PlaySoundToAll(SOUND_ALLIANCE_RETURNED);
SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flag has been reset.");
m_flagHolder = 0;
}