display honor gained from kills in bg score window

--HG--
branch : trunk
This commit is contained in:
Rat
2010-05-17 17:10:24 +02:00
parent 47b32302f1
commit 9a631614e3
19 changed files with 39 additions and 28 deletions
+4 -1
View File
@@ -1261,7 +1261,7 @@ bool BattleGround::HasFreeSlots() const
return GetPlayersSize() < GetMaxPlayers(); 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 //this procedure is called from virtual function implemented in bg subclass
BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -1285,8 +1285,11 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
if (isBattleGround()) if (isBattleGround())
{ {
// reward honor instantly // reward honor instantly
if (doAddHonor)
{
if (Source->RewardHonor(NULL, 1, value)) if (Source->RewardHonor(NULL, 1, value))
itr->second->BonusHonor += value; itr->second->BonusHonor += value;
}else itr->second->BonusHonor += value;
} }
break; break;
//used only in EY, but in MSG_PVP_LOG_DATA opcode //used only in EY, but in MSG_PVP_LOG_DATA opcode
+1 -1
View File
@@ -463,7 +463,7 @@ class BattleGround
Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } 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); 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; } static BattleGroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; } uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
+2 -2
View File
@@ -683,7 +683,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
return good_entry; 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()); BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... 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; ((BattleGroundABScore*)itr->second)->BasesDefended += value;
break; break;
default: default:
BattleGround::UpdatePlayerScore(Source,type,value); BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
break; break;
} }
} }
+1 -1
View File
@@ -255,7 +255,7 @@ class BattleGroundAB : public BattleGround
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */ /* 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); virtual void FillInitialWorldStates(WorldPacket& data);
+2 -2
View File
@@ -69,7 +69,7 @@ void BattleGroundABG::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
return; 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()); 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... if (itr == m_PlayerScores.end()) // player not found...
return; return;
BattleGround::UpdatePlayerScore(Source,type,value); BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
} }
+1 -1
View File
@@ -47,7 +47,7 @@ class BattleGroundABG : public BattleGround
//bool SetupBattleGround(); //bool SetupBattleGround();
/* Scorekeeping */ /* Scorekeeping */
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
private: private:
}; };
+2 -2
View File
@@ -530,7 +530,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
Source->CastSpell(Source, SpellId, true); 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()); 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; ((BattleGroundAVScore*)itr->second)->SecondaryObjectives += value;
break; break;
default: default:
BattleGround::UpdatePlayerScore(Source,type,value); BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
break; break;
} }
} }
+1 -1
View File
@@ -1547,7 +1547,7 @@ class BattleGroundAV : public BattleGround
/*general stuff*/ /*general stuff*/
void UpdateScore(uint16 team, int16 points); 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 /*handlestuff*/ //these are functions which get called from extern
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
+2 -2
View File
@@ -173,7 +173,7 @@ bool BattleGroundBE::SetupBattleGround()
return true; 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()); BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
@@ -181,7 +181,7 @@ void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
return; return;
//there is nothing special in this score //there is nothing special in this score
BattleGround::UpdatePlayerScore(Source,type,value); BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
} }
+1 -1
View File
@@ -73,6 +73,6 @@ class BattleGroundBE : public BattleGround
bool HandlePlayerUnderMap(Player * plr); bool HandlePlayerUnderMap(Player * plr);
/* Scorekeeping */ /* Scorekeeping */
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
}; };
#endif #endif
+2 -2
View File
@@ -807,7 +807,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); 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()); BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found 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; ((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
break; break;
default: default:
BattleGround::UpdatePlayerScore(Source, type, value); BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
break; break;
} }
} }
+1 -1
View File
@@ -354,7 +354,7 @@ class BattleGroundEY : public BattleGround
virtual void Reset(); virtual void Reset();
void UpdateTeamScore(uint32 Team); void UpdateTeamScore(uint32 Team);
void EndBattleGround(uint32 winner); 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); virtual void FillInitialWorldStates(WorldPacket& data);
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;} void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
+2 -2
View File
@@ -71,7 +71,7 @@ void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
return; 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()); 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... if (itr == m_PlayerScores.end()) // player not found...
return; return;
BattleGround::UpdatePlayerScore(Source,type,value); BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
} }
bool BattleGroundIC::SetupBattleGround() bool BattleGroundIC::SetupBattleGround()
+1 -1
View File
@@ -57,7 +57,7 @@ class BattleGroundIC : public BattleGround
void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/); void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/);
/* Scorekeeping */ /* Scorekeeping */
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
private: private:
}; };
+2 -2
View File
@@ -371,7 +371,7 @@ void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
return; 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()); BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... 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) else if (type == SCORE_DESTROYED_WALL)
((BattleGroundSAScore*)itr->second)->gates_destroyed += value; ((BattleGroundSAScore*)itr->second)->gates_destroyed += value;
else else
BattleGround::UpdatePlayerScore(Source,type,value); BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
} }
void BattleGroundSA::TeleportPlayers() void BattleGroundSA::TeleportPlayers()
+1 -1
View File
@@ -316,7 +316,7 @@ class BattleGroundSA : public BattleGround
/* Scorekeeping */ /* Scorekeeping */
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
private: private:
bool ResetObjs(); bool ResetObjs();
+2 -2
View File
@@ -754,7 +754,7 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
BattleGround::HandleKillPlayer(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()); 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; ((BattleGroundWGScore*)itr->second)->FlagReturns += value;
break; break;
default: default:
BattleGround::UpdatePlayerScore(Source, type, value); BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
break; break;
} }
} }
+1 -1
View File
@@ -193,7 +193,7 @@ class BattleGroundWS : public BattleGround
void UpdateFlagState(uint32 team, uint32 value); void UpdateFlagState(uint32 team, uint32 value);
void SetFirstFlagCapture(uint32 team) { m_FirstFlagCaptureTeam = team; } void SetFirstFlagCapture(uint32 team) { m_FirstFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 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;} void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
virtual void FillInitialWorldStates(WorldPacket& data); virtual void FillInitialWorldStates(WorldPacket& data);
+8
View File
@@ -6573,6 +6573,14 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true); 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 (sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken)
{ {
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))