本文整理汇总了C++中SpawnEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ SpawnEvent函数的具体用法?C++ SpawnEvent怎么用?C++ SpawnEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SpawnEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnEvent
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
Team team = Source->GetTeam();
++m_TeamPointsCount[GetTeamIndexByTeamId(team)];
SpawnEvent(Point, GetTeamIndexByTeamId(team), true);
//buff isn't respawned
m_PointOwnedByTeam[Point] = team;
m_PointState[Point] = EY_POINT_UNDER_CONTROL;
if (team == ALLIANCE)
SendMessageToAll(CapturingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdatePointsIcons(team, Point);
UpdatePointsCount(team);
}
示例2: ClearFlagPicker
void BattleGroundAC::EventPlayerCapturedFlag(Player *Source, BG_AC_Nodes node)
{
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGuid() != Source->GetObjectGuid())
return;
ClearFlagPicker();
m_FlagState = BG_AC_FLAG_STATE_WAIT_RESPAWN;
Source->RemoveAurasDueToSpell(BG_AC_FLAG_1_FLAG_SPELL);
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
PlaySoundToAll(BG_AC_SOUND_FLAG_CAPTURED_ALLIANCE);
else
PlaySoundToAll(BG_AC_SOUND_FLAG_CAPTURED_HORDE);
SpawnEvent(BG_AC_EVENT_CAPTURE_FLAG, node, true);
m_FlagsTimer = BG_AC_FLAG_RESPAWN_TIME;
BattleGroundTeamIndex team_id;
if (Source->GetTeam() == ALLIANCE)
{
team_id = BG_TEAM_ALLIANCE;
SendMessageToAll(LANG_BG_AC_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
}
else
{
team_id = BG_TEAM_HORDE;
SendMessageToAll(LANG_BG_AC_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
}
if (m_TeamPointsCount[team_id] > 0)
AddPoints(Source->GetTeam(), BG_AC_FlagPoints[m_TeamPointsCount[team_id] - 1]);
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
}
示例3: SpawnEvent
void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
{
// stop if we want to spawn something which was already spawned
// or despawn something which was already despawned
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|| (!spawn && m_ActiveEvents[event1] != event2))
return;
if (spawn)
{
// if event gets spawned, the current active event mus get despawned
SpawnEvent(event1, m_ActiveEvents[event1], false);
m_ActiveEvents[event1] = event2; // set this event to active
}
else
m_ActiveEvents[event1] = BG_EVENT_NONE; // no event active if event2 gets despawned
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
SpawnBGCreature(*itr, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
GuidVector::const_iterator itr2 = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
for (; itr2 != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr2)
SpawnBGObject(*itr2, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
}
示例4: UpdateWorldState
void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedUp() || !source->IsWithinDistInMap(target_obj, 10))
return;
if (m_flagState == EY_FLAG_STATE_ON_BASE)
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
if (source->GetTeam() == ALLIANCE)
{
PlaySoundToAll(EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
m_flagState = EY_FLAG_STATE_ON_ALLIANCE_PLAYER;
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_STATE_ALLIANCE, 2);
}
else
{
PlaySoundToAll(EY_SOUND_FLAG_PICKED_UP_HORDE);
m_flagState = EY_FLAG_STATE_ON_HORDE_PLAYER;
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_STATE_HORDE, 2);
}
// despawn center-flag
SpawnEvent(EY_EVENT_CAPTURE_FLAG, EY_EVENT2_FLAG_CENTER, false);
SetFlagCarrier(source->GetObjectGuid());
// get flag aura on player
source->CastSpell(source, EY_NETHERSTORM_FLAG_SPELL, true);
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (source->GetTeam() == ALLIANCE)
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, source->GetName());
else
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, source->GetName());
}
示例5: ClearFlagCarrier
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
{
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagCarrierGuid() != source->GetObjectGuid())
return;
ClearFlagCarrier();
m_flagState = EY_FLAG_STATE_WAIT_RESPAWN;
m_flagRespawnTimer = EY_FLAG_RESPAWN_TIME;
source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (source->GetTeam() == ALLIANCE)
{
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_ALLIANCE);
if (m_towersAlliance > 0)
AddPoints(ALLIANCE, eyFlagPoints[m_towersAlliance - 1]);
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
}
else
{
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_HORDE);
if (m_towersHorde > 0)
AddPoints(HORDE, eyFlagPoints[m_towersHorde - 1]);
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, source);
}
SpawnEvent(EY_EVENT_CAPTURE_FLAG, node, true);
UpdatePlayerScore(source, SCORE_FLAG_CAPTURES, 1);
}
示例6: PlaySoundToAll
void BattleGroundWS::PickOrReturnFlag(Player* pPlayer, Team forTeam, bool pickedUp, bool fromGround/*false*/)
{
int32 message_id = 0;
bool A = forTeam == ALLIANCE;
// Flag picked up from base or ground.
if (pickedUp)
{
message_id = A ? LANG_BG_WS_PICKEDUP_HF : LANG_BG_WS_PICKEDUP_AF;
PlaySoundToAll(A ? BG_WS_SOUND_HORDE_FLAG_PICKED_UP : BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnEvent(A ? WS_EVENT_FLAG_H : WS_EVENT_FLAG_A, 0, false);
A ? SetHordeFlagCarrier(pPlayer->GetObjectGuid()) : SetAllianceFlagCarrier(pPlayer->GetObjectGuid());
m_FlagState[A ? TEAM_INDEX_HORDE : TEAM_INDEX_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
// update world state to show correct flag carrier
UpdateFlagState(A ? ALLIANCE : HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(A ? BG_WS_FLAG_UNK_HORDE : BG_WS_FLAG_UNK_ALLIANCE, 1);
pPlayer->CastSpell(pPlayer, A ? BG_WS_SPELL_WARSONG_FLAG : BG_WS_SPELL_SILVERWING_FLAG, true);
if (!fromGround)
//For timed achivements (Quick Cap)
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, A ? BG_WS_SPELL_WARSONG_FLAG_PICKED : BG_WS_SPELL_SILVERWING_FLAG_PICKED);
}
// Flag on ground (not in base), return flag to base.
else
{
message_id = A ? LANG_BG_WS_RETURNED_AF : LANG_BG_WS_RETURNED_HF;
UpdateFlagState(A ? HORDE : ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
RespawnFlag(A ? ALLIANCE : HORDE, false);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(pPlayer, SCORE_FLAG_RETURNS, 1);
}
SendMessageToAll(message_id, A ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, pPlayer);
pPlayer->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
示例7: GetTeamIndex
void BattleGroundSA::EventPlayerDamageGO(Player *player, GameObject* target_obj, uint32 eventId, uint32 doneBy)
{
TeamIndex teamIndex = GetTeamIndex(player->GetTeam());
// Seaforium Charge Explosion
if (doneBy == 52408)
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_PLANT_SEAFORIUM_CHARGE);
BG_SA_GoType type = BG_SA_GO_GATES_T_NONE;
switch (target_obj->GetEntry())
{
case BG_SA_GO_GATES_ROOM_ANCIENT_SHRINE:
{
type = BG_SA_GO_GATES_T_ROOM_ANCIENT_SHRINE;
switch (eventId)
{
case 21630:
if (!GateRoomAncientShrineDamaged)
{
SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj));
GateRoomAncientShrineDamaged = true;
}
break;
case 19836:
SendWarningToAllSA(SA_EVENT_NONE, TEAM_NONE, true, type);
UpdateWorldState(BG_SA_GateStatus[type], (GetDefender() == HORDE) ? 5 : 2);
GateStatus[type] = BG_SA_GO_GATES_DAMAGE;
break;
case 19837:
SendWarningToAllSA(SA_EVENT_NONE, TEAM_NONE, true, type, true);
UpdateWorldState(BG_SA_GateStatus[type], (GetDefender() == HORDE) ? 6 : 3);
GateStatus[type] = BG_SA_GO_GATES_DESTROY;
UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1);
RewardHonorToTeam(100, (teamIndex == 0) ? ALLIANCE : HORDE);
MakeInteractive(SA_EVENT_ADD_RELIC, (GetDefender() == ALLIANCE) ? 2 : 1, true);
relicGateDestroyed = true;
break;
}
break;
}
case BG_SA_GO_GATES_GREEN_EMERALD:
{
type = BG_SA_GO_GATES_T_GREEN_EMERALD;
switch (eventId)
{
case 21630:
if (!GateGreenEmeraldDamaged)
{
SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj));
GateGreenEmeraldDamaged = true;
}
break;
case 19041:
SendWarningToAllSA(SA_EVENT_NONE, TEAM_NONE, true, type);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE);
break;
case 19046:
SendWarningToAllSA(SA_EVENT_NONE, TEAM_NONE, true, type, true);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY);
UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1);
RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE : HORDE);
// make western/eastern graveyard capturable
for (int i = SA_EVENT_ADD_GRAVE_E; i <= SA_EVENT_ADD_GRAVE_W; i++)
MakeInteractive(i, (GetDefender() == ALLIANCE) ? BG_SA_GRAVE_STATUS_ALLY_CONTESTED : BG_SA_GRAVE_STATUS_HORDE_CONTESTED, true);
SpawnEvent(SA_EVENT_ADD_GREEN_SIGIL, 0, false);
break;
}
break;
}
case BG_SA_GO_GATES_BLUE_SAPHIRE:
{
type = BG_SA_GO_GATES_T_BLUE_SAPHIRE;
switch (eventId)
{
case 21630:
if (!GateBlueSaphireDamaged)
{
SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj));
GateBlueSaphireDamaged = true;
}
break;
case 19040:
SendWarningToAllSA(SA_EVENT_NONE, TEAM_NONE, true, type);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE);
break;
case 19045:
SendWarningToAllSA(SA_EVENT_NONE, TEAM_NONE, true, type, true);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY);
UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1);
RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE : HORDE);
// make western/eastern graveyard capturable
for (int i = SA_EVENT_ADD_GRAVE_E; i <= SA_EVENT_ADD_GRAVE_W; i++)
MakeInteractive(i, (GetDefender() == ALLIANCE) ? BG_SA_GRAVE_STATUS_ALLY_CONTESTED : BG_SA_GRAVE_STATUS_HORDE_CONTESTED, true);
SpawnEvent(SA_EVENT_ADD_BLUE_SIGIL, 0, false);
break;
}
break;
}
case BG_SA_GO_GATES_MAUVE_AMETHYST:
{
//.........这里部分代码省略.........
示例8: StartShips
void BattleGroundSA::Update(uint32 diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_WAIT_JOIN && !shipsStarted)
if (Phase == SA_ROUND_ONE) // Round one not started yet
{
if (shipsTimer <= diff)
StartShips();
else
shipsTimer -= diff;
}
if (GetStatus() == STATUS_IN_PROGRESS) // Battleground already in progress
{
if (Round_timer >= BG_SA_ROUNDLENGTH)
{
if (Phase == SA_ROUND_ONE) // Timeout of first round
{
PlaySoundToAll(BG_SA_SOUND_GYD_VICTORY);
SendMessageToAll(defender == ALLIANCE ? LANG_BG_SA_ALLIANCE_TIMEOUT_END_1ROUND : LANG_BG_SA_HORDE_TIMEOUT_END_1ROUND, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
SendWarningToAll(LANG_BG_SA_END_1ROUND);
RoundScores[0].winner = GetDefender();
RoundScores[0].time = BG_SA_ROUNDLENGTH;
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player* plr = sObjectMgr.GetPlayer(itr->first);
if (plr)
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_END_OF_ROUND);
}
ResetBattle(0, defender);
}
else // Timeout of second round
{
SendMessageToAll(defender == ALLIANCE ? LANG_BG_SA_ALLIANCE_TIMEOUT_END_2ROUND : LANG_BG_SA_HORDE_TIMEOUT_END_2ROUND, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
RoundScores[1].winner = GetDefender();
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player* plr = sObjectMgr.GetPlayer(itr->first);
if (plr)
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_END_OF_ROUND);
}
if (RoundScores[0].winner == GetDefender())
EndBattleGround(GetDefender());
else
EndBattleGround(TEAM_NONE);
return;
}
}
else
Round_timer += diff;
for (int gyd = 0; gyd < BG_SA_GRY_MAX; ++gyd)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[gyd].timer)
{
if (m_BannerTimers[gyd].timer > diff)
m_BannerTimers[gyd].timer -= diff;
else
{
m_BannerTimers[gyd].timer = 0;
_CreateBanner(gyd, m_BannerTimers[gyd].type, m_BannerTimers[gyd].teamIndex, false);
}
}
}
UpdateTimer();
}
if (GetStatus() == STATUS_WAIT_JOIN && Phase == SA_ROUND_TWO) // Round two, not yet started
{
if (!shipsStarted)
{
if (shipsTimer <= diff)
{
SendMessageToAll(LANG_BG_SA_START_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
StartShips();
}
else
shipsTimer -= diff;
}
if (TimeST2Round < diff)
{
Phase = SA_ROUND_TWO;
SpawnEvent(SA_EVENT_ADD_NPC, 0, true);
SpawnEvent(SA_EVENT_ADD_BOMB_B, (GetDefender() == ALLIANCE ? BG_SA_GRAVE_STATUS_HORDE_OCCUPIED : BG_SA_GRAVE_STATUS_ALLY_OCCUPIED), true);
ToggleTimer();
SetStatus(STATUS_IN_PROGRESS); // Start round two
PlaySoundToAll(SOUND_BG_START);
SendWarningToAll(LANG_BG_SA_HAS_BEGUN);
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player* plr = sObjectMgr.GetPlayer(itr->first);
if (plr)
//.........这里部分代码省略.........
示例9: SpawnEvent
void BattleGroundEY::StartingEventOpenDoors()
{
// eye-doors are despawned, not opened
SpawnEvent(BG_EVENT_DOOR, 0, false);
}
示例10: ResetWorldStates
void BattleGroundSA::UpdatePhase()
{
ResetWorldStates();
if (Phase == SA_ROUND_TWO)
{
SpawnEvent(SA_EVENT_ADD_VECH_E, 0, false);
SpawnEvent(SA_EVENT_ADD_VECH_W, 0, false);
SpawnEvent(SA_EVENT_ADD_BOMB, 0, false);
SpawnEvent(SA_EVENT_ADD_BOMB, 1, false);
SpawnEvent(SA_EVENT_ADD_NPC, 0, false);
OpenDoorEvent(SA_EVENT_OP_DOOR, 0);
SpawnEvent(SA_EVENT_ADD_BOMB, 0, true);
}
_GydOccupied(3,GetDefender());
if(Phase == SA_ROUND_ONE)
{
SpawnEvent(SA_EVENT_ADD_SPIR, BG_SA_GARVE_STATUS_HORDE_OCCUPIED, false);
SpawnEvent(SA_EVENT_ADD_SPIR, BG_SA_GARVE_STATUS_ALLY_OCCUPIED, true);
m_ActiveEvents[5] = GetDefender() == ALLIANCE ? BG_SA_GARVE_STATUS_ALLY_OCCUPIED : BG_SA_GARVE_STATUS_HORDE_OCCUPIED;
for (uint8 i = 0; i < BG_SA_GRY_MAX; ++i)
{
for (uint8 z = 1; z < 5; ++z)
SpawnEvent(i, z, false);
m_prevGyd[i] = 0;
m_GydTimers[i] = 0;
m_BannerTimers[i].timer = 0;
SpawnEvent(i, 3, true);
m_Gyd[i] = GetDefender() == ALLIANCE ? BG_SA_GARVE_STATUS_ALLY_OCCUPIED : BG_SA_GARVE_STATUS_HORDE_OCCUPIED;
m_ActiveEvents[i] = GetDefender() == ALLIANCE ? BG_SA_GARVE_STATUS_ALLY_OCCUPIED : BG_SA_GARVE_STATUS_HORDE_OCCUPIED;
_GydOccupied(i,GetDefender());
}
SpawnEvent(SA_EVENT_ADD_BOMB, 1, true);
//SpawnEvent(SA_EVENT_ADD_NPC, 0, true);
}
// We already do it at ResetWorldStates
/*for (uint32 z = 0; z <= BG_SA_GATE_MAX; ++z)
UpdateWorldState(BG_SA_GateStatus[z], GateStatus[z]);*/
if (Phase == SA_ROUND_TWO)
{
Round_timer = 0;
SetStatus(STATUS_WAIT_JOIN);
SendMessageToAll(LANG_BG_SA_START_TWO_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
}
SpawnEvent(SA_EVENT_ADD_GO, 0, false);
SpawnEvent(SA_EVENT_ADD_GO, 0, true);
}
示例11: urand
void BattleGroundDS::Update(uint32 diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
// push people from the tubes
if (pushbackCheck)
{
// knockback
if (m_uiKnockback < diff)
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player *plr = sObjectMgr.GetPlayer(itr->first);
if (!plr)
continue;
if (GameObject* obj = plr->GetGameObject(48018)) // Remove Demonic Circle
obj->Delete();
if (plr->GetPositionZ() < 11.0f)
continue;
float angle = (plr->GetBGTeam() == ALLIANCE /*gold*/) ? plr->GetAngle(1259.58f, 764.43f) : plr->GetAngle(1325.84f, 817.304f);
plr->KnockBackPlayerWithAngle(angle, 45, 7);
if (plr->IsWithinDist2d(1214, 765, 50) && plr->IsWithinLOS(1214, 765, 14))
plr->KnockBackPlayerWithAngle(6.40f,55,7);
if (plr->IsWithinDist2d(1369, 817, 50) && plr->IsWithinLOS(1369, 817, 14))
plr->KnockBackPlayerWithAngle(3.03f,55,7);
}
pushbackCheck = false;
m_uiKnockback = 1000;
}
else
m_uiKnockback -= diff;
}
// in case pushback failed
if (teleportCheck)
{
if (m_uiTeleport < diff)
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
{
if (plr->GetPositionZ() < 11.0f)
continue;
float x, y;
if (plr->GetBGTeam() == ALLIANCE)
{
x = 1259.58f;
y = 764.43f;
}
else
{
x = 1325.84f;
y = 817.304f;
}
plr->TeleportTo(GetMapId(), x + urand(0,2), y + urand(0,2), 3.15f, plr->GetOrientation());
}
}
teleportCheck = false;
// close the gate
OpenDoorEvent(BG_EVENT_DOOR);
}
else
m_uiTeleport -= diff;
}
// Waterfall
if (m_uiWaterfall < diff)
{
if (waterfallActivated)
{
SpawnEvent(WATERFALL_EVENT, 0, false);
waterfallActivated = false;
}
else
{
SpawnEvent(WATERFALL_EVENT, 0, true);
waterfallActivated = true;
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player * plr = sObjectMgr.GetPlayer(itr->first);
if (plr && plr->GetDistance2d(1291, 790) <= 6)
plr->KnockBackFrom(plr, -20.0f, 9.0f);
}
}
m_uiWaterfall = urand(30,45)*IN_MILLISECONDS;
}
else
m_uiWaterfall -= diff;
//.........这里部分代码省略.........
示例12: SetHordeFlagPicker
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 winner = 0;
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
}
//for flag capture is reward 2 honorable kills
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
// despawn flags
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}
示例13: ModifyStartDelayTime
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
// after bg start we get there (once)
if (GetStatus() == STATUS_WAIT_JOIN && GetPlayersSize())
{
ModifyStartDelayTime(diff);
if (!(m_Events & 0x01))
{
m_Events |= 0x01;
// setup here, only when at least one player has ported to the map
if (!SetupBattleGround())
{
EndNow();
return;
}
SetStartDelayTime(START_DELAY0);
}
// After 1 minute, warning is signalled
else if (GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04))
{
m_Events |= 0x04;
SendMessageToAll(GetMangosString(LANG_BG_WS_ONE_MINUTE));
}
// After 1,5 minute, warning is signalled
else if (GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08))
{
m_Events |= 0x08;
SendMessageToAll(GetMangosString(LANG_BG_WS_HALF_MINUTE));
}
// After 2 minutes, gates OPEN ! x)
else if (GetStartDelayTime() < 0 && !(m_Events & 0x10))
{
m_Events |= 0x10;
// TODO implement timer to despawn doors after a short while
OpenDoorEvent(BG_EVENT_DOOR);
SpawnEvent(WS_EVENT_SPIRITGUIDES_SPAWN, 0, true);
SpawnEvent(WS_EVENT_FLAG_A, 0, true);
SpawnEvent(WS_EVENT_FLAG_H, 0, true);
SendMessageToAll(GetMangosString(LANG_BG_WS_BEGIN));
PlaySoundToAll(SOUND_BG_START);
SetStatus(STATUS_IN_PROGRESS);
}
}
else if (GetStatus() == STATUS_IN_PROGRESS)
{
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
{
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0;
RespawnFlag(ALLIANCE, true);
}
}
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
{
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
{
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0;
RespawnFlagAfterDrop(ALLIANCE);
}
}
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
if (m_FlagsTimer[BG_TEAM_HORDE] < 0)
{
m_FlagsTimer[BG_TEAM_HORDE] = 0;
RespawnFlag(HORDE, true);
}
}
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
{
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff;
if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
{
m_FlagsDropTimer[BG_TEAM_HORDE] = 0;
RespawnFlagAfterDrop(HORDE);
}
}
}
}
示例14: GetMangosString
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
const char *message = NULL;
uint8 type = 0;
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetDBTableGUIDLow())).event1;
//alliance flag picked up from base
if(Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& event == WS_EVENT_FLAG_A)
{
message = GetMangosString(LANG_BG_WS_PICKEDUP_AF);
type = CHAT_MSG_BG_SYSTEM_HORDE;
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SetAllianceFlagPicker(Source->GetGUID());
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
}
//horde flag picked up from base
if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
&& event == WS_EVENT_FLAG_H)
{
message = GetMangosString(LANG_BG_WS_PICKEDUP_HF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
SetHordeFlagPicker(Source->GetGUID());
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
}
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
{
if (Source->GetTeam() == ALLIANCE)
{
message = GetMangosString(LANG_BG_WS_RETURNED_AF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
RespawnFlag(ALLIANCE, false);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
}
else
{
message = GetMangosString(LANG_BG_WS_PICKEDUP_AF);
type = CHAT_MSG_BG_SYSTEM_HORDE;
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SetAllianceFlagPicker(Source->GetGUID());
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
}
//called in HandleGameObjectUseOpcode:
//target_obj->Delete();
}
//Horde flag on ground(not in base) (returned or picked up again)
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
{
if (Source->GetTeam() == HORDE)
{
message = GetMangosString(LANG_BG_WS_RETURNED_HF);
type = CHAT_MSG_BG_SYSTEM_HORDE;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
RespawnFlag(HORDE, false);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
}
else
{
message = GetMangosString(LANG_BG_WS_PICKEDUP_HF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
SetHordeFlagPicker(Source->GetGUID());
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
}
//called in HandleGameObjectUseOpcode:
//target_obj->Delete();
}
if (!type)
return;
//.........这里部分代码省略.........
示例15: SetHordeFlagPicker
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint8 type = 0;
uint32 winner = 0;
const char *message = "";
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
message = GetMangosString(LANG_BG_WS_CAPTURED_HF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
message = GetMangosString(LANG_BG_WS_CAPTURED_AF);
type = CHAT_MSG_BG_SYSTEM_HORDE;
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
}
//for flag capture is reward distributed according level range
RewardHonorToTeamDepOnLvl(BG_WSG_FlagCapturedHonor, Source->GetTeam());
// despawn flags
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
WorldPacket data;
ChatHandler::FillMessageData(&data, Source->GetSession(), type, LANG_UNIVERSAL, NULL, Source->GetGUID(), message, NULL);
SendPacketToAll(&data);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}