aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRat <none@none>2010-05-17 17:10:24 +0200
committerRat <none@none>2010-05-17 17:10:24 +0200
commit9a631614e38d5b24a7c53fe7f686a96e9abb529a (patch)
treed27ca41cdee96804db9111536aa3e79faf317a1e
parent47b32302f1ab40255c63da57ee2129b945c3765e (diff)
display honor gained from kills in bg score window
--HG-- branch : trunk
-rw-r--r--src/game/BattleGround.cpp9
-rw-r--r--src/game/BattleGround.h2
-rw-r--r--src/game/BattleGroundAB.cpp4
-rw-r--r--src/game/BattleGroundAB.h2
-rw-r--r--src/game/BattleGroundABG.cpp4
-rw-r--r--src/game/BattleGroundABG.h2
-rw-r--r--src/game/BattleGroundAV.cpp4
-rw-r--r--src/game/BattleGroundAV.h2
-rw-r--r--src/game/BattleGroundBE.cpp4
-rw-r--r--src/game/BattleGroundBE.h2
-rw-r--r--src/game/BattleGroundEY.cpp4
-rw-r--r--src/game/BattleGroundEY.h2
-rw-r--r--src/game/BattleGroundIC.cpp4
-rw-r--r--src/game/BattleGroundIC.h2
-rw-r--r--src/game/BattleGroundSA.cpp4
-rw-r--r--src/game/BattleGroundSA.h2
-rw-r--r--src/game/BattleGroundWS.cpp4
-rw-r--r--src/game/BattleGroundWS.h2
-rw-r--r--src/game/Player.cpp8
19 files changed, 39 insertions, 28 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index bce5008788a..f8b98159462 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -1261,7 +1261,7 @@ bool BattleGround::HasFreeSlots() const
return GetPlayersSize() < GetMaxPlayers();
}
-void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
+void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
{
//this procedure is called from virtual function implemented in bg subclass
BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -1285,8 +1285,11 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
if (isBattleGround())
{
// reward honor instantly
- if (Source->RewardHonor(NULL, 1, value))
- itr->second->BonusHonor += value;
+ if (doAddHonor)
+ {
+ if (Source->RewardHonor(NULL, 1, value))
+ itr->second->BonusHonor += value;
+ }else itr->second->BonusHonor += value;
}
break;
//used only in EY, but in MSG_PVP_LOG_DATA opcode
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index 80c605ca61f..6d9bdfc5ecd 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -463,7 +463,7 @@ class BattleGround
Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; }
void SetBgRaid(uint32 TeamID, Group *bg_raid);
- virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
static BattleGroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index 31c30a4275e..38671e85597 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -683,7 +683,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
return good_entry;
}
-void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
+void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
@@ -698,7 +698,7 @@ void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value
((BattleGroundABScore*)itr->second)->BasesDefended += value;
break;
default:
- BattleGround::UpdatePlayerScore(Source,type,value);
+ BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
break;
}
}
diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h
index 733ba832473..3072f8beafd 100644
--- a/src/game/BattleGroundAB.h
+++ b/src/game/BattleGroundAB.h
@@ -255,7 +255,7 @@ class BattleGroundAB : public BattleGround
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */
- virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
virtual void FillInitialWorldStates(WorldPacket& data);
diff --git a/src/game/BattleGroundABG.cpp b/src/game/BattleGroundABG.cpp
index 434fed6f119..5aa9c7a571b 100644
--- a/src/game/BattleGroundABG.cpp
+++ b/src/game/BattleGroundABG.cpp
@@ -69,7 +69,7 @@ void BattleGroundABG::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
return;
}
-void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -77,5 +77,5 @@ void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 valu
if (itr == m_PlayerScores.end()) // player not found...
return;
- BattleGround::UpdatePlayerScore(Source,type,value);
+ BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
} \ No newline at end of file
diff --git a/src/game/BattleGroundABG.h b/src/game/BattleGroundABG.h
index 478e8ffaf46..70d48a7ceeb 100644
--- a/src/game/BattleGroundABG.h
+++ b/src/game/BattleGroundABG.h
@@ -47,7 +47,7 @@ class BattleGroundABG : public BattleGround
//bool SetupBattleGround();
/* Scorekeeping */
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
private:
};
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 28cc6d3e908..7f5482cbf16 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -530,7 +530,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
Source->CastSpell(Source, SpellId, true);
}
-void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -561,7 +561,7 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
((BattleGroundAVScore*)itr->second)->SecondaryObjectives += value;
break;
default:
- BattleGround::UpdatePlayerScore(Source,type,value);
+ BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
break;
}
}
diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h
index b3a2f42ef1b..6d95c7bbc5d 100644
--- a/src/game/BattleGroundAV.h
+++ b/src/game/BattleGroundAV.h
@@ -1547,7 +1547,7 @@ class BattleGroundAV : public BattleGround
/*general stuff*/
void UpdateScore(uint16 team, int16 points);
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
/*handlestuff*/ //these are functions which get called from extern
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp
index 992587a4f18..d6debe45ae3 100644
--- a/src/game/BattleGroundBE.cpp
+++ b/src/game/BattleGroundBE.cpp
@@ -173,7 +173,7 @@ bool BattleGroundBE::SetupBattleGround()
return true;
}
-void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -181,7 +181,7 @@ void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
return;
//there is nothing special in this score
- BattleGround::UpdatePlayerScore(Source,type,value);
+ BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
}
diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h
index 83a29015940..760d4d278c9 100644
--- a/src/game/BattleGroundBE.h
+++ b/src/game/BattleGroundBE.h
@@ -73,6 +73,6 @@ class BattleGroundBE : public BattleGround
bool HandlePlayerUnderMap(Player * plr);
/* Scorekeeping */
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
};
#endif
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index f0e6eadab42..20f023e4c2a 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -807,7 +807,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
}
-void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
+void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found
@@ -819,7 +819,7 @@ void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
break;
default:
- BattleGround::UpdatePlayerScore(Source, type, value);
+ BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
break;
}
}
diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h
index 61e96cb26da..4fe23c4c821 100644
--- a/src/game/BattleGroundEY.h
+++ b/src/game/BattleGroundEY.h
@@ -354,7 +354,7 @@ class BattleGroundEY : public BattleGround
virtual void Reset();
void UpdateTeamScore(uint32 Team);
void EndBattleGround(uint32 winner);
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
virtual void FillInitialWorldStates(WorldPacket& data);
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
diff --git a/src/game/BattleGroundIC.cpp b/src/game/BattleGroundIC.cpp
index 3d8cd76e459..8dbcc81e5c6 100644
--- a/src/game/BattleGroundIC.cpp
+++ b/src/game/BattleGroundIC.cpp
@@ -71,7 +71,7 @@ void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
return;
}
-void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -79,7 +79,7 @@ void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
if (itr == m_PlayerScores.end()) // player not found...
return;
- BattleGround::UpdatePlayerScore(Source,type,value);
+ BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
}
bool BattleGroundIC::SetupBattleGround()
diff --git a/src/game/BattleGroundIC.h b/src/game/BattleGroundIC.h
index 7038be0feb8..e49ea01e850 100644
--- a/src/game/BattleGroundIC.h
+++ b/src/game/BattleGroundIC.h
@@ -57,7 +57,7 @@ class BattleGroundIC : public BattleGround
void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/);
/* Scorekeeping */
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
private:
};
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index ffa2167278d..25fcb74d954 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -371,7 +371,7 @@ void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
return;
}
-void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
@@ -382,7 +382,7 @@ void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
else if (type == SCORE_DESTROYED_WALL)
((BattleGroundSAScore*)itr->second)->gates_destroyed += value;
else
- BattleGround::UpdatePlayerScore(Source,type,value);
+ BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
}
void BattleGroundSA::TeleportPlayers()
diff --git a/src/game/BattleGroundSA.h b/src/game/BattleGroundSA.h
index 01a76ab7a1a..aedf8307369 100644
--- a/src/game/BattleGroundSA.h
+++ b/src/game/BattleGroundSA.h
@@ -316,7 +316,7 @@ class BattleGroundSA : public BattleGround
/* Scorekeeping */
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
private:
bool ResetObjs();
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index 71134149618..71872511274 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -754,7 +754,7 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
BattleGround::HandleKillPlayer(player, killer);
}
-void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
+void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -770,7 +770,7 @@ void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value
((BattleGroundWGScore*)itr->second)->FlagReturns += value;
break;
default:
- BattleGround::UpdatePlayerScore(Source, type, value);
+ BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
break;
}
}
diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h
index 2488de1f7c2..1a733c14570 100644
--- a/src/game/BattleGroundWS.h
+++ b/src/game/BattleGroundWS.h
@@ -193,7 +193,7 @@ class BattleGroundWS : public BattleGround
void UpdateFlagState(uint32 team, uint32 value);
void SetFirstFlagCapture(uint32 team) { m_FirstFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team);
- void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
virtual void FillInitialWorldStates(WorldPacket& data);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index cea646fe436..7385f8f97af 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -6573,6 +6573,14 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true);
+ if (InBattleGround() && honor > 0)
+ {
+ if (BattleGround *bg = GetBattleGround())
+ {
+ bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, uint32(honor), false);//false: prevent looping
+ }
+ }
+
if (sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken)
{
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))