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:
raczman
2009-04-04 00:29:43 +02:00
parent b449693f17
commit 38d634a163
9 changed files with 39 additions and 5 deletions
+21 -1
View File
@@ -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);
@@ -565,6 +574,17 @@ void BattleGround::EndBattleGround(uint32 winner)
{
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);
+2
View File
@@ -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:
@@ -514,6 +515,7 @@ class BattleGround
uint32 m_PrematureCountDownTimer;
char const *m_Name;
/* Player lists */
std::vector<uint64> m_ResurrectQueue; // Player GUID
std::map<uint64, uint8> m_RemovedPlayers; // uint8 is remove type (0 - bgqueue, 1 - bg, 2 - resurrect queue)
+1
View File
@@ -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] )
+2
View File
@@ -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)
{
+1
View File
@@ -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])
{
+3 -3
View File
@@ -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
+1
View File
@@ -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);
+1
View File
@@ -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
};
+6
View File
@@ -507,6 +507,11 @@ LogColors = ""
# Default: 0 (false)
# 1 (true)
#
# Battleground.PrematureReward
# Reward players in case of prematurely finished BG
# Default: 1 (true)
# 0 (false)
#
# CastUnstuck
# Allow cast or not Unstuck spell at .start or client Help option use
# Default: 1 (true)
@@ -612,6 +617,7 @@ ActivateWeather = 1
Battleground.CastDeserter = 1
Battleground.QueueAnnouncer.Enable = 1
Battleground.QueueAnnouncer.PlayerOnly = 0
Battleground.PrematureReward = 1
CastUnstuck = 1
Instance.IgnoreLevel = 0
Instance.IgnoreRaid = 0