display honor gained from kills in bg score window
--HG-- branch : trunk
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)]; }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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:
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
};
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user