mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9910] Implement expected from 3.2.x time limit for BattleGroundWS.
With updates and fixes from zergtmn. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
df6bd3df30
commit
0828c3aa81
4 changed files with 42 additions and 2 deletions
|
|
@ -86,6 +86,31 @@ void BattleGroundWS::Update(uint32 diff)
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +190,8 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
m_LastCapturedFlagTeam = Source->GetTeam();
|
||||
|
||||
uint32 winner = 0;
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
|
@ -526,6 +553,8 @@ void BattleGroundWS::Reset()
|
|||
m_HonorWinKills = (isBGWeekend) ? 3 : 1;
|
||||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
|
||||
m_EndTimer = BG_WS_TIME_LIMIT;
|
||||
m_LastCapturedFlagTeam = 0;
|
||||
}
|
||||
|
||||
void BattleGroundWS::EndBattleGround(uint32 winner)
|
||||
|
|
@ -626,4 +655,7 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2);
|
||||
else
|
||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1);
|
||||
|
||||
FillInitialWorldState(data, count, BG_WS_UNK1, 1);
|
||||
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#define BG_WS_MAX_TEAM_SCORE 3
|
||||
#define BG_WS_FLAG_RESPAWN_TIME (23*IN_MILLISECONDS)
|
||||
#define BG_WS_FLAG_DROP_TIME (10*IN_MILLISECONDS)
|
||||
#define BG_WS_TIME_LIMIT (25*MINUTE*IN_MILLISECONDS)
|
||||
|
||||
enum BG_WS_Sound
|
||||
{
|
||||
|
|
@ -53,7 +54,9 @@ enum BG_WS_WorldStates
|
|||
BG_WS_FLAG_CAPTURES_HORDE = 1582,
|
||||
BG_WS_FLAG_CAPTURES_MAX = 1601,
|
||||
BG_WS_FLAG_STATE_HORDE = 2338,
|
||||
BG_WS_FLAG_STATE_ALLIANCE = 2339
|
||||
BG_WS_FLAG_STATE_ALLIANCE = 2339,
|
||||
BG_WS_UNK1 = 4247, // Show time limit?
|
||||
BG_WS_TIME_REMAINING = 4248
|
||||
};
|
||||
|
||||
enum BG_WS_FlagState
|
||||
|
|
@ -128,6 +131,7 @@ class BattleGroundWS : public BattleGround
|
|||
virtual void Reset();
|
||||
void EndBattleGround(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
uint32 GetRemainingTimeInMinutes() { return m_EndTimer ? (m_EndTimer-1) / (MINUTE * IN_MILLISECONDS) + 1 : 0; }
|
||||
|
||||
void UpdateFlagState(uint32 team, uint32 value);
|
||||
void UpdateTeamScore(uint32 team);
|
||||
|
|
@ -152,5 +156,7 @@ class BattleGroundWS : public BattleGround
|
|||
uint32 m_ReputationCapture;
|
||||
uint32 m_HonorWinKills;
|
||||
uint32 m_HonorEndKills;
|
||||
uint32 m_EndTimer;
|
||||
uint32 m_LastCapturedFlagTeam;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8066,6 +8066,8 @@ static WorldStatePair WS_world_states[] =
|
|||
{ 0x641, 0x3 }, // 12 1601 unk (max flag captures?)
|
||||
{ 0x922, 0x1 }, // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
|
||||
{ 0x923, 0x1 }, // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
|
||||
{ 0x1097,0x1 }, // 15 4247 show time limit?
|
||||
{ 0x1098,0x19 }, // 16 4248 time remaining in minutes
|
||||
{ 0x0, 0x0 }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9909"
|
||||
#define REVISION_NR "9910"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue