本文整理汇总了C++中RespawnFlagAfterDrop函数的典型用法代码示例。如果您正苦于以下问题:C++ RespawnFlagAfterDrop函数的具体用法?C++ RespawnFlagAfterDrop怎么用?C++ RespawnFlagAfterDrop使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RespawnFlagAfterDrop函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RespawnFlag
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
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);
}
}
if (m_EndTimer > 0)
{
m_EndTimer -= diff;
if(GetEndTimeMinutes() != m_LastEndTimeMinutes)
{
m_LastEndTimeMinutes = GetEndTimeMinutes();
UpdateWorldState(BG_WS_TIME_REMAINING, m_LastEndTimeMinutes);
}
}
else
{
uint32 h = GetTeamScore(HORDE);
uint32 a = GetTeamScore(ALLIANCE);
if(h || a)
{
if(h > a)
EndBattleGround(HORDE);
else if(a > h)
EndBattleGround(ALLIANCE);
else
EndBattleGround(m_LastCapturedFlagTeam);
}
else
// tie
EndBattleGround(0);
}
}
}
示例2: EndBattleground
void BattlegroundTP::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
if (GetElapsedTime() >= 30*MINUTE*IN_MILLISECONDS)
{
if (GetTeamScore(TEAM_ALLIANCE) == 0)
{
if (GetTeamScore(TEAM_HORDE) == 0) // No one scored - result is tie
EndBattleground(WINNER_NONE);
else // Horde has more points and thus wins
EndBattleground(HORDE);
}
else if (GetTeamScore(TEAM_HORDE) == 0)
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
else if (GetTeamScore(TEAM_HORDE) == GetTeamScore(TEAM_ALLIANCE)) // Team score equal, winner is team that scored the last flag
EndBattleground(_lastFlagCaptureTeam);
else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE)) // Last but not least, check who has the higher score
EndBattleground(HORDE);
else
EndBattleground(ALLIANCE);
}
// first update needed after 1 minute of game already in progress
else if (GetElapsedTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS) + 3 * MINUTE * IN_MILLISECONDS)
{
++_minutesElapsed;
UpdateWorldState(BG_TP_STATE_TIMER, 28 - _minutesElapsed);
}
if (_flagState[TEAM_ALLIANCE] == BG_TP_FLAG_STATE_WAIT_RESPAWN)
{
_flagsTimer[TEAM_ALLIANCE] -= diff;
if (_flagsTimer[TEAM_ALLIANCE] < 0)
{
_flagsTimer[TEAM_ALLIANCE] = 0;
RespawnFlag(ALLIANCE, true);
}
}
if (_flagState[TEAM_ALLIANCE] == BG_TP_FLAG_STATE_ON_GROUND)
{
_flagsDropTimer[TEAM_ALLIANCE] -= diff;
if (_flagsDropTimer[TEAM_ALLIANCE] < 0)
{
_flagsDropTimer[TEAM_ALLIANCE] = 0;
RespawnFlagAfterDrop(ALLIANCE);
_bothFlagsKept = false;
}
}
if (_flagState[TEAM_HORDE] == BG_TP_FLAG_STATE_WAIT_RESPAWN)
{
_flagsTimer[TEAM_HORDE] -= diff;
if (_flagsTimer[TEAM_HORDE] < 0)
{
_flagsTimer[TEAM_HORDE] = 0;
RespawnFlag(HORDE, true);
}
}
if (_flagState[TEAM_HORDE] == BG_TP_FLAG_STATE_ON_GROUND)
{
_flagsDropTimer[TEAM_HORDE] -= diff;
if (_flagsDropTimer[TEAM_HORDE] < 0)
{
_flagsDropTimer[TEAM_HORDE] = 0;
RespawnFlagAfterDrop(HORDE);
_bothFlagsKept = false;
}
}
if (_bothFlagsKept)
{
_flagSpellForceTimer += diff;
if (_flagDebuffState == 0 && _flagSpellForceTimer >= 10*MINUTE*IN_MILLISECONDS) //10 minutes
{
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
player->CastSpell(player, TP_SPELL_FOCUSED_ASSAULT, true);
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
player->CastSpell(player, TP_SPELL_FOCUSED_ASSAULT, true);
_flagDebuffState = 1;
}
else if (_flagDebuffState == 1 && _flagSpellForceTimer >= 900000) // 15 minutes
{
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
{
player->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT);
//.........这里部分代码省略.........
示例3: EndBattleground
void BattlegroundWS::Update(uint32 diff)
{
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS)
{
if (GetTeamScore(ALLIANCE) == 0)
{
if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
EndBattleground(NULL);
else // Horde has more points and thus wins
EndBattleground(HORDE);
}
else if (GetTeamScore(HORDE) == 0)
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
EndBattleground(m_LastFlagCaptureTeam);
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
EndBattleground(HORDE);
else
EndBattleground(ALLIANCE);
}
else if (GetStartTime() > uint32(m_minutesElapsed * MINUTE * IN_MILLISECONDS))
{
++m_minutesElapsed;
UpdateWorldState(BG_WS_STATE_TIMER, 28 - m_minutesElapsed);
}
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);
m_BothFlagsKept = false;
}
}
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);
m_BothFlagsKept = false;
}
}
if (m_BothFlagsKept)
{
m_FlagSpellForceTimer += diff;
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
{
if (Player * plr = sObjectMgr->GetPlayer(m_FlagKeepers[0]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
if (Player * plr = sObjectMgr->GetPlayer(m_FlagKeepers[1]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
m_FlagDebuffState = 1;
}
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
if (Player * plr = sObjectMgr->GetPlayer(m_FlagKeepers[0]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
}
if (Player * plr = sObjectMgr->GetPlayer(m_FlagKeepers[1]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
}
m_FlagDebuffState = 2;
}
//.........这里部分代码省略.........
示例4: 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;
}
// for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i <= WS_SPIRIT_MAIN_HORDE; i++)
// SpawnBGCreature(i, RESPAWN_IMMEDIATELY);
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; i++)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
DoorClose(i);
}
for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; i++)
SpawnBGObject(i, RESPAWN_ONE_DAY);
SetStartDelayTime(START_DELAY0);
}
// After 1 minute, warning is signalled
else if (GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04))
{
m_Events |= 0x04;
SendMessageToAll(GetTrinityString(LANG_BG_WS_ONE_MINUTE));
}
// After 1,5 minute, warning is signalled
else if (GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08))
{
m_Events |= 0x08;
SendMessageToAll(GetTrinityString(LANG_BG_WS_HALF_MINUTE));
}
// After 2 minutes, gates OPEN ! x)
else if (GetStartDelayTime() < 0 && !(m_Events & 0x10))
{
m_Events |= 0x10;
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; i++)
DoorOpen(i);
for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; i++)
DoorOpen(i);
SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY);
SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY);
SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY);
SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY);
for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
SendMessageToAll(GetTrinityString(LANG_BG_WS_BEGIN));
PlaySoundToAll(SOUND_BG_START);
if (sWorld.getConfig(CONFIG_BG_START_MUSIC))
PlaySoundToAll(SOUND_BG_START_L70ETC); //MUSIC - Custom config
SetStatus(STATUS_IN_PROGRESS);
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
}
}
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);
m_BothFlagsKept = false;
}
}
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
//.........这里部分代码省略.........
示例5: RespawnFlag
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
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);
}
}
if (m_FlagState[BG_TEAM_ALLIANCE] >= BG_WS_FLAG_STATE_ON_PLAYER && m_FlagState[BG_TEAM_HORDE] >= BG_WS_FLAG_STATE_ON_PLAYER)
{
if (m_FocusedAssault < BG_WS_FIVE_MINUTES)
{
for(uint8 i = 0; i < BG_TEAMS_COUNT; i++)
{
Player* carrier = sObjectMgr.GetPlayer(m_FlagKeepers[i]);
if(!carrier)
continue;
if((!carrier->HasAura(BG_WS_SPELL_FOCUSED_ASSAULT) && !carrier->HasAura(BG_WS_SPELL_BRUTAL_ASSAULT)) ||
(m_FocusedAssaultExtra && m_FocusedAssault < diff))
carrier->CastSpell(carrier, (m_FocusedAssault < diff) ? BG_WS_SPELL_BRUTAL_ASSAULT : BG_WS_SPELL_FOCUSED_ASSAULT, true);
}
if(m_FocusedAssault < BG_WS_FIVE_MINUTES && m_FocusedAssaultExtra)
m_FocusedAssaultExtra = false;
}else m_FocusedAssault -= diff;
}else
{
m_FocusedAssault = BG_WS_CARRIER_DEBUFF;
m_FocusedAssaultExtra = true;
}
if (m_EndTimer > 0)
if (m_EndTimer <= diff)
{
uint32 allianceScore = GetTeamScore(ALLIANCE);
uint32 hordeScore = GetTeamScore(HORDE);
if (allianceScore > hordeScore)
EndBattleGround(ALLIANCE);
else if (allianceScore < hordeScore)
EndBattleGround(HORDE);
else
{
// if 0 => tie
EndBattleGround(m_LastCapturedFlagTeam);
}
}
else
{
uint32 minutesLeftPrev = GetRemainingTimeInMinutes();
m_EndTimer -= diff;
uint32 minutesLeft = GetRemainingTimeInMinutes();
if (minutesLeft != minutesLeftPrev)
UpdateWorldState(BG_WS_TIME_REMAINING, minutesLeft);
}
}
}
示例6: ModifyStartDelayTime
void BattleGroundEY::Update(time_t 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;
SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_IMMEDIATELY);
for(uint32 i = BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER; i < BG_EY_OBJECT_MAX; ++i)
SpawnBGObject(i, RESPAWN_ONE_DAY);
SetStartDelayTime(START_DELAY0);
}
// After 1 minute, warning is signalled
else if(GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04))
{
m_Events |= 0x04;
SendMessageToAll(GetMangosString(LANG_BG_EY_ONE_MINUTE));
}
// After 1,5 minute, warning is signalled
else if(GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08))
{
m_Events |= 0x08;
SendMessageToAll(GetMangosString(LANG_BG_EY_HALF_MINUTE));
}
// After 2 minutes, gates OPEN ! x)
else if(GetStartDelayTime() < 0 && !(m_Events & 0x10))
{
m_Events |= 0x10;
SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_ONE_DAY);
SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_ONE_DAY);
for(uint32 i = BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER; i <= BG_EY_OBJECT_FLAG_NETHERSTORM; ++i)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
for(uint32 i = 0; i < EY_POINTS_MAX; ++i)
{
//randomly spawn buff
uint8 buff = urand(0, 2);
SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + buff + i * 3, RESPAWN_IMMEDIATELY);
}
SendMessageToAll(GetMangosString(LANG_BG_EY_BEGIN));
PlaySoundToAll(SOUND_BG_START);
SetStatus(STATUS_IN_PROGRESS);
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if(Player *plr = objmgr.GetPlayer(itr->first))
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
}
}
else if(GetStatus() == STATUS_IN_PROGRESS)
{
m_PointAddingTimer -= diff;
if(m_PointAddingTimer <= 0)
{
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]);
if (m_TeamPointsCount[BG_TEAM_HORDE] > 0)
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
}
if(m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
{
m_FlagsTimer -= diff;
if(m_FlagsTimer < 0)
{
m_FlagsTimer = 0;
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
RespawnFlag(true);
else
RespawnFlagAfterDrop();
}
}
m_TowerCapCheckTimer -= diff;
if(m_TowerCapCheckTimer <= 0)
{
//check if player joined point
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
but we can count of players on current point in CheckSomeoneLeftPoint
*/
this->CheckSomeoneJoinedPoint();
//check if player left point
this->CheckSomeoneLeftPoint();
this->UpdatePointStatuses();
m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME;
}
}
}
示例7: AddPoints
void BattlegroundEY::Update(uint32 diff)
{
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
m_PointAddingTimer -= diff;
if (m_PointAddingTimer <= 0)
{
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]);
if (m_TeamPointsCount[BG_TEAM_HORDE] > 0)
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
}
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
{
m_FlagsTimer -= diff;
if (m_FlagsTimer < 0)
{
m_FlagsTimer = 0;
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
RespawnFlag(true);
else
RespawnFlagAfterDrop();
}
}
m_TowerCapCheckTimer -= diff;
if (m_TowerCapCheckTimer <= 0)
{
//check if player joined point
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
but we can count of players on current point in CheckSomeoneLeftPoint
*/
this->CheckSomeoneJoinedPoint();
//check if player left point
this->CheckSomeoneLeftPoint();
this->UpdatePointStatuses();
m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME;
}
}
if (GetStatus() == STATUS_WAIT_JOIN)
{
m_CheatersCheckTimer -= diff;
if(m_CheatersCheckTimer <= 0)
{
for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player * plr = sObjectMgr->GetPlayer(itr->first);
if (!plr || !plr->IsInWorld())
continue;
if (plr->GetPositionZ() < 1249)
{
if (plr->GetTeam() == HORDE)
plr->TeleportTo(566, 1807.73f, 1539.41f, 1267.63f, plr->GetOrientation(), 0);
else
plr->TeleportTo(566, 2523.68f, 1596.59f, 1269.35f, plr->GetOrientation(), 0);
}
}
m_CheatersCheckTimer = 3000;
}
}
}
示例8: 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);
}
}
}
}
示例9: RespawnFlag
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
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);
}
}
if (m_EndTimer <= diff)
{
uint32 allianceScore = GetTeamScore(ALLIANCE);
uint32 hordeScore = GetTeamScore(HORDE);
if (allianceScore > hordeScore)
EndBattleGround(ALLIANCE);
else if (allianceScore < hordeScore)
EndBattleGround(HORDE);
else
{
// if 0 => tie
EndBattleGround(m_LastCapturedFlagTeam);
}
}
else
{
uint32 minutesLeftPrev = GetRemainingTimeInMinutes();
m_EndTimer -= diff;
uint32 minutesLeft = GetRemainingTimeInMinutes();
if (minutesLeft != minutesLeftPrev)
UpdateWorldState(BG_WS_TIME_REMAINING, minutesLeft);
}
}
}
示例10: RespawnFlag
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
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);
m_BothFlagsKept = false;
}
}
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);
m_BothFlagsKept = false;
}
}
if(m_BothFlagsKept)
{
m_FlagSpellForceTimer += diff;
if(m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
{
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
m_FlagDebuffState = 1;
}
else if(m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
}
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
}
m_FlagDebuffState = 2;
}
}
else
{
m_FlagSpellForceTimer = 0; //reset timer.
m_FlagDebuffState = 0;
}
}
}
示例11: AddPoints
void BattlegroundEY::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
m_PointAddingTimer -= diff;
if (m_PointAddingTimer <= 0)
{
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]);
if (m_TeamPointsCount[BG_TEAM_HORDE] > 0)
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
}
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
{
m_FlagsTimer -= diff;
if (m_FlagsTimer < 0)
{
m_FlagsTimer = 0;
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
RespawnFlag(true);
else
RespawnFlagAfterDrop();
}
}
m_TowerCapCheckTimer -= diff;
if (m_TowerCapCheckTimer <= 0)
{
// Check if the player joined the point.
CheckSomeoneJoinedPoint();
// Check if the player left the point.
CheckSomeoneLeftPoint();
UpdatePointStatuses();
m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME;
}
}
// Check for players below map / cheaters.
if (GetStatus() == STATUS_WAIT_JOIN)
{
m_CheatersCheckTimer -= diff;
if (m_CheatersCheckTimer <= 0)
{
if (!GetPlayers().empty())
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
Player * plr = ObjectAccessor::FindPlayer(itr->first);
if (!plr || !plr->IsInWorld())
continue;
if (plr->GetPositionZ() < 1244.0f)
{
if (plr->GetBGTeam() == HORDE)
plr->TeleportTo(566, 1807.98f, 1539.42f, 1247.52f, plr->GetOrientation(), 0);
else
plr->TeleportTo(566, 2527.18f, 1597.31f, 1248.78f, plr->GetOrientation(), 0);
}
}
}
m_CheatersCheckTimer = 4000;
}
}
}
示例12: RespawnFlag
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
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);
}
}
if (m_FlagState[BG_TEAM_ALLIANCE] >= BG_WS_FLAG_STATE_ON_PLAYER && m_FlagState[BG_TEAM_HORDE] >= BG_WS_FLAG_STATE_ON_PLAYER)
{
if (m_FocusedAssault < BG_WS_FIVE_MINUTES)
{
Player* CarrierA = sObjectMgr.GetPlayer(m_FlagKeepers[BG_TEAM_ALLIANCE]);
Player* CarrierH = sObjectMgr.GetPlayer(m_FlagKeepers[BG_TEAM_HORDE]);
if(!CarrierA || !CarrierH)
return;
//after 15 minutes spell should have double effect
SpellEntry const *spellInfo = sSpellStore.LookupEntry(BG_WS_FOCUSED_ASSAULT);
if (!spellInfo)
return;
int32 SpellValue0 = spellInfo->CalculateSimpleValue(EFFECT_INDEX_0);
int32 SpellValue1 = spellInfo->EffectBasePoints[0];
int32 dmgtaken = ((m_FocusedAssault < diff) ? 2*SpellValue0 : SpellValue0) - 1;
if(!CarrierA->HasAura(BG_WS_FOCUSED_ASSAULT))
CarrierA->CastCustomSpell(CarrierA, BG_WS_FOCUSED_ASSAULT, &dmgtaken, &SpellValue1, 0, true);
if(!CarrierH->HasAura(BG_WS_FOCUSED_ASSAULT))
CarrierH->CastCustomSpell(CarrierH, BG_WS_FOCUSED_ASSAULT, &dmgtaken, &SpellValue1, 0, true);
// after 15 minutes buff must be reapplied with double value
if(m_FocusedAssaultExtra && m_FocusedAssault < diff)
{
CarrierA->CastCustomSpell(CarrierA, BG_WS_FOCUSED_ASSAULT, &dmgtaken, &SpellValue1, 0, true);
CarrierH->CastCustomSpell(CarrierH, BG_WS_FOCUSED_ASSAULT, &dmgtaken, &SpellValue1, 0, true);
m_FocusedAssaultExtra = false;
}
}else m_FocusedAssault -= diff;
}else
{
m_FocusedAssault = BG_WS_CARRIER_DEBUFF;
m_FocusedAssaultExtra = true;
}
if (m_EndTimer > 0)
{
m_EndTimer -= diff;
if(GetEndTimeMinutes() != m_LastEndTimeMinutes)
{
m_LastEndTimeMinutes = GetEndTimeMinutes();
UpdateWorldState(BG_WS_TIME_REMAINING, m_LastEndTimeMinutes);
}
}
else
{
uint32 h = GetTeamScore(HORDE);
uint32 a = GetTeamScore(ALLIANCE);
if(h || a)
//.........这里部分代码省略.........