aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraczman <none@none>2009-04-04 00:29:43 +0200
committerraczman <none@none>2009-04-04 00:29:43 +0200
commit38d634a1632720fb1ff596f43e988b1b6014ae82 (patch)
tree35e180d33afd35ec75fb2119b44450caa634b952 /src
parentb449693f1737894b9be4d836a9a35abf6b38d4cc (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/game/BattleGround.cpp24
-rw-r--r--src/game/BattleGround.h2
-rw-r--r--src/game/BattleGroundAB.cpp1
-rw-r--r--src/game/BattleGroundAV.cpp2
-rw-r--r--src/game/BattleGroundEY.cpp1
-rw-r--r--src/game/BattleGroundWS.h6
-rw-r--r--src/game/World.cpp1
-rw-r--r--src/game/World.h1
-rw-r--r--src/trinitycore/trinitycore.conf.dist6
9 files changed, 39 insertions, 5 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 5ab9490b215..405dd7f1ac0 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -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);
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index a0e0d94e6e8..c9592cebe63 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -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
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index 501ac8eef33..1cd5cfad420 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -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] )
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 9eced355ba3..6086d0be441 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -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)
{
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index e9eba524349..ecf454d1cfe 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -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])
{
diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h
index c804c250209..4e57826cd30 100644
--- a/src/game/BattleGroundWS.h
+++ b/src/game/BattleGroundWS.h
@@ -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
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 1ef570fe0d7..5c40acd9c40 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -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);
diff --git a/src/game/World.h b/src/game/World.h
index 8b6fe46b561..03b0b0e0c88 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -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
};
diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist
index 552e87f34bf..fcc093e811a 100644
--- a/src/trinitycore/trinitycore.conf.dist
+++ b/src/trinitycore/trinitycore.conf.dist
@@ -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