Fixed BG mark rewarding in case of prematurely finished BG:
-team with most points will get 3 marks, the other one 1 mark -in case of a draw, each team gets 1 mark (not sure if blizzlike) TODO: -remove per BG score variables and substitute them further with general m_score[] array to avoid data duplication. Please report any bugs, and TC2 devs - dont pull this change into TC2, its not 309-like. --HG-- branch : trunk
This commit is contained in:
@@ -445,7 +445,7 @@ void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player
|
||||
void BattleGround::EndBattleGround(uint32 winner)
|
||||
{
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
|
||||
uint32 almost_winning_team = HORDE;
|
||||
ArenaTeam * winner_arena_team = NULL;
|
||||
ArenaTeam * loser_arena_team = NULL;
|
||||
uint32 loser_rating = 0;
|
||||
@@ -522,6 +522,15 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
}
|
||||
}
|
||||
|
||||
if(!isArena()){
|
||||
|
||||
if(m_score[GetTeamIndexByTeamId(ALLIANCE)] == m_score[GetTeamIndexByTeamId(HORDE)])
|
||||
almost_winning_team = 0; //no real winner
|
||||
if(m_score[GetTeamIndexByTeamId(ALLIANCE)] > m_score[GetTeamIndexByTeamId(HORDE)])
|
||||
almost_winning_team = ALLIANCE;
|
||||
|
||||
}
|
||||
|
||||
for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
@@ -563,8 +572,19 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
}
|
||||
else if(winner !=0)
|
||||
{
|
||||
RewardMark(plr,ITEM_LOSER_COUNT);
|
||||
RewardMark(plr,ITEM_LOSER_COUNT);
|
||||
}
|
||||
else if(winner == 0)
|
||||
{
|
||||
if(sWorld.getConfig(CONFIG_PREMATURE_BG_REWARD)) // We're feeling generous, giving rewards to people who not earned them ;)
|
||||
{ //nested ifs for the win! its boring writing that, forgive me my unfunniness
|
||||
|
||||
if(almost_winning_team == team) //player's team had more points
|
||||
RewardMark(plr,ITEM_WINNER_COUNT);
|
||||
else
|
||||
RewardMark(plr,ITEM_LOSER_COUNT); // if scores were the same, each team gets 1 mark.
|
||||
}
|
||||
}
|
||||
|
||||
plr->CombatStopWithPets(true);
|
||||
|
||||
|
||||
@@ -489,6 +489,7 @@ class BattleGround
|
||||
uint8 m_Events;
|
||||
|
||||
bool m_BuffChange;
|
||||
uint32 m_score[2]; //array that keeps general team scores, used to determine who gets most marks when bg ends prematurely
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
private:
|
||||
@@ -513,6 +514,7 @@ class BattleGround
|
||||
bool m_PrematureCountDown;
|
||||
uint32 m_PrematureCountDownTimer;
|
||||
char const *m_Name;
|
||||
|
||||
|
||||
/* Player lists */
|
||||
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
||||
|
||||
@@ -195,6 +195,7 @@ void BattleGroundAB::Update(time_t diff)
|
||||
{
|
||||
m_lastTick[team] -= BG_AB_TickIntervals[points];
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_score[team] = m_TeamScores[team];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if( m_ReputationScoreTics[team] >= BG_AB_ReputationScoreTicks[m_HonorMode] )
|
||||
|
||||
@@ -229,6 +229,8 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points )
|
||||
uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
|
||||
m_Team_Scores[teamindex] += points;
|
||||
|
||||
m_score[teamindex] = m_Team_Scores[teamindex];
|
||||
|
||||
UpdateWorldState(((teamindex==BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
|
||||
if( points < 0)
|
||||
{
|
||||
|
||||
@@ -166,6 +166,7 @@ void BattleGroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
{
|
||||
uint8 team_index = GetTeamIndexByTeamId(Team);
|
||||
m_TeamScores[team_index] += Points;
|
||||
m_score[team_index] = m_TeamScores[team_index];
|
||||
m_HonorScoreTics[team_index] += Points;
|
||||
if (m_HonorScoreTics[team_index] >= BG_EY_HonorScoreTicks[m_HonorMode])
|
||||
{
|
||||
|
||||
@@ -185,9 +185,9 @@ class BattleGroundWS : public BattleGround
|
||||
|
||||
/* Scorekeeping */
|
||||
uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
|
||||
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
|
||||
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
|
||||
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
|
||||
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; m_score[GetTeamIndexByTeamId(TeamID)] = m_TeamScores[GetTeamIndexByTeamId(TeamID)];}
|
||||
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; m_score[GetTeamIndexByTeamId(TeamID)] = m_TeamScores[GetTeamIndexByTeamId(TeamID)];}
|
||||
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; m_score[GetTeamIndexByTeamId(TeamID)] = m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
|
||||
|
||||
private:
|
||||
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
|
||||
|
||||
@@ -1005,6 +1005,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
|
||||
m_configs[CONFIG_MAX_WHO] = sConfig.GetIntDefault("MaxWhoListReturns", 49);
|
||||
|
||||
m_configs[CONFIG_PREMATURE_BG_REWARD] = sConfig.GetBoolDefault("Battleground.PrematureReward", true);
|
||||
m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false);
|
||||
m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false);
|
||||
m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0);
|
||||
|
||||
@@ -201,6 +201,7 @@ enum WorldConfigs
|
||||
CONFIG_INTERVAL_LOG_UPDATE,
|
||||
CONFIG_MIN_LOG_UPDATE,
|
||||
CONFIG_ENABLE_SINFO_LOGIN,
|
||||
CONFIG_PREMATURE_BG_REWARD,
|
||||
|
||||
CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user