[7446] Applied mangos coding style for AB and EY.

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
Triply 2009-03-12 13:33:46 +01:00
parent b71759d204
commit 424c8b39df
5 changed files with 82 additions and 66 deletions

View file

@ -48,7 +48,7 @@ void BattleGroundAB::Update(uint32 diff)
if( GetStatus() == STATUS_IN_PROGRESS ) if( GetStatus() == STATUS_IN_PROGRESS )
{ {
int team_points[2] = { 0, 0 }; int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
{ {
@ -88,24 +88,24 @@ void BattleGroundAB::Update(uint32 diff)
{ {
// FIXME: team and node names not localized // FIXME: team and node names not localized
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node)); SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node));
PlaySoundToAll(SOUND_NODE_CAPTURED_ALLIANCE); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
} }
else else
{ {
// FIXME: team and node names not localized // FIXME: team and node names not localized
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_AB_HORDE,_GetNodeNameId(node)); SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_AB_HORDE,_GetNodeNameId(node));
PlaySoundToAll(SOUND_NODE_CAPTURED_HORDE); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
} }
} }
} }
for (int team = 0; team < 2; ++team) for (int team = 0; team < BG_TEAMS_COUNT; ++team)
if( m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED ) if( m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED )
++team_points[team]; ++team_points[team];
} }
// Accumulate points // Accumulate points
for (int team = 0; team < 2; ++team) for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{ {
int points = team_points[team]; int points = team_points[team];
if( !points ) if( !points )
@ -127,18 +127,18 @@ void BattleGroundAB::Update(uint32 diff)
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE); RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_HonorScoreTics[team] -= m_HonorTics; m_HonorScoreTics[team] -= m_HonorTics;
} }
if( !m_IsInformedNearVictory && m_TeamScores[team] > 1800 ) if( !m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE )
{ {
if( team == BG_TEAM_ALLIANCE ) if( team == BG_TEAM_ALLIANCE )
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(SOUND_NEAR_VICTORY); PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true; m_IsInformedNearVictory = true;
} }
if( m_TeamScores[team] > 2000 ) if( m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE )
m_TeamScores[team] = 2000; m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
if( team == BG_TEAM_ALLIANCE ) if( team == BG_TEAM_ALLIANCE )
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]); UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
if( team == BG_TEAM_HORDE ) if( team == BG_TEAM_HORDE )
@ -147,9 +147,9 @@ void BattleGroundAB::Update(uint32 diff)
} }
// Test win condition // Test win condition
if( m_TeamScores[BG_TEAM_ALLIANCE] >= 2000 ) if( m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE )
EndBattleGround(ALLIANCE); EndBattleGround(ALLIANCE);
if( m_TeamScores[BG_TEAM_HORDE] >= 2000 ) if( m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE )
EndBattleGround(HORDE); EndBattleGround(HORDE);
} }
} }
@ -313,7 +313,7 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
// Team scores // Team scores
data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE); data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE);
data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_SCORE); data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE);
data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]); data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]);
data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]); data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]);
@ -440,7 +440,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
else else
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE);
sound = SOUND_NODE_CLAIMED; sound = BG_AB_SOUND_NODE_CLAIMED;
} }
// If node is contested // If node is contested
else if( (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED) ) else if( (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED) )
@ -484,7 +484,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
else else
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
} }
sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE; sound = (teamIndex == 0) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
} }
// If node is occupied, change to enemy-contested // If node is occupied, change to enemy-contested
else else
@ -506,7 +506,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
else else
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE; sound = (teamIndex == 0) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
} }
// If node is occupied again, send "X has taken the Y" msg. // If node is occupied again, send "X has taken the Y" msg.

View file

@ -128,8 +128,8 @@ enum BG_AB_Timers
enum BG_AB_Score enum BG_AB_Score
{ {
BG_AB_MAX_TEAM_SCORE = 2000, BG_AB_WARNING_NEAR_VICTORY_SCORE = 1800,
BG_AB_WARNING_SCORE = 1800 BG_AB_MAX_TEAM_SCORE = 2000
}; };
/* do NOT change the order, else wrong behaviour */ /* do NOT change the order, else wrong behaviour */
@ -162,12 +162,12 @@ enum BG_AB_NodeStatus
enum BG_AB_Sounds enum BG_AB_Sounds
{ {
SOUND_NODE_CLAIMED = 8192, BG_AB_SOUND_NODE_CLAIMED = 8192,
SOUND_NODE_CAPTURED_ALLIANCE = 8173, BG_AB_SOUND_NODE_CAPTURED_ALLIANCE = 8173,
SOUND_NODE_CAPTURED_HORDE = 8213, BG_AB_SOUND_NODE_CAPTURED_HORDE = 8213,
SOUND_NODE_ASSAULTED_ALLIANCE = 8174, BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE = 8174,
SOUND_NODE_ASSAULTED_HORDE = 8212, BG_AB_SOUND_NODE_ASSAULTED_HORDE = 8212,
SOUND_NEAR_VICTORY = 8456 BG_AB_SOUND_NEAR_VICTORY = 8456
}; };
#define BG_AB_NotABBGWeekendHonorTicks 330 #define BG_AB_NotABBGWeekendHonorTicks 330
@ -283,10 +283,10 @@ class BattleGroundAB : public BattleGround
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]; uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]; BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
int32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]; int32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
uint32 m_TeamScores[2]; uint32 m_TeamScores[BG_TEAMS_COUNT];
uint32 m_lastTick[2]; uint32 m_lastTick[BG_TEAMS_COUNT];
uint32 m_HonorScoreTics[2]; uint32 m_HonorScoreTics[BG_TEAMS_COUNT];
uint32 m_ReputationScoreTics[2]; uint32 m_ReputationScoreTics[BG_TEAMS_COUNT];
bool m_IsInformedNearVictory; bool m_IsInformedNearVictory;
uint32 m_HonorTics; uint32 m_HonorTics;
uint32 m_ReputationTics; uint32 m_ReputationTics;

View file

@ -258,9 +258,20 @@ void BattleGroundEY::UpdatePointStatuses()
void BattleGroundEY::UpdateTeamScore(uint32 Team) void BattleGroundEY::UpdateTeamScore(uint32 Team)
{ {
uint32 score = GetTeamScore(Team); uint32 score = GetTeamScore(Team);
if(score >= EY_MAX_TEAM_SCORE) //TODO there should be some sound played when one team is near victory!! - and define variables
/*if( !m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE )
{ {
score = EY_MAX_TEAM_SCORE; if( Team == ALLIANCE )
SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}*/
if( score >= BG_EY_MAX_TEAM_SCORE )
{
score = BG_EY_MAX_TEAM_SCORE;
EndBattleGround(Team); EndBattleGround(Team);
} }

View file

@ -23,7 +23,6 @@
class BattleGround; class BattleGround;
#define EY_MAX_TEAM_SCORE 2000
#define BG_EY_FLAG_RESPAWN_TIME (10*IN_MILISECONDS) //10 seconds #define BG_EY_FLAG_RESPAWN_TIME (10*IN_MILISECONDS) //10 seconds
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILISECONDS) //2 seconds #define BG_EY_FPOINTS_TICK_TIME (2*IN_MILISECONDS) //2 seconds
@ -213,6 +212,12 @@ enum EYBattleGroundObjectTypes
#define BG_EY_NotEYWeekendHonorTicks 330 #define BG_EY_NotEYWeekendHonorTicks 330
#define BG_EY_EYWeekendHonorTicks 200 #define BG_EY_EYWeekendHonorTicks 200
enum BG_EY_Score
{
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1800,
BG_EY_MAX_TEAM_SCORE = 2000
};
enum BG_EY_FlagState enum BG_EY_FlagState
{ {
BG_EY_FLAG_STATE_ON_BASE = 0, BG_EY_FLAG_STATE_ON_BASE = 0,

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7445" #define REVISION_NR "7446"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__