Skip to content
Permalink
Browse files

Server/Reputation: Move bonusLFG check into a separate Function.

Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information...
AriDEV committed Jun 4, 2019
1 parent 57655b8 commit 31aeb51227d50c687f3307c60e3e02d7abe717ec
Showing with 10 additions and 6 deletions.
  1. +9 −6 src/server/game/Reputation/ReputationMgr.cpp
  2. +1 −0 src/server/game/Reputation/ReputationMgr.h
@@ -379,13 +379,8 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in

if (incremental)
{
float bonusLFG = sWorld->getRate(RATE_REPUTATION_LFG_BONUS);

if (factionEntry->ID != 0 || factionEntry->ID == _player->GetUInt32Value(PLAYER_FIELD_LFG_BONUS_FACTION_ID))
float bonusLFG = sWorld->getRate(RATE_REPUTATION_LFG_BONUS) * 2.0f;

// int32 *= float cause one point loss?
standing = int32(floor(((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5f) * bonusLFG));
standing = int32(floor(((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5f) * GetLFGBonus(factionEntry)));
standing += itr->second.Standing + BaseRep;
}

@@ -640,3 +635,11 @@ void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank n
if (new_rank >= REP_HONORED)
++_honoredFactionCount;
}

float ReputationMgr::GetLFGBonus(FactionEntry const* factionEntry)
{
if (factionEntry && (factionEntry->ID == _player->GetUInt32Value(PLAYER_FIELD_LFG_BONUS_FACTION_ID)))
return sWorld->getRate(RATE_REPUTATION_LFG_BONUS) * 2.0f;

return sWorld->getRate(RATE_REPUTATION_LFG_BONUS);
}
@@ -153,6 +153,7 @@ class ReputationMgr
void SetInactive(FactionState* faction, bool inactive) const;
void SendVisible(FactionState const* faction) const;
void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank);
float GetLFGBonus(FactionEntry const* factionEntry);
private:
Player* _player;
FactionStateList _factions;

0 comments on commit 31aeb51

Please sign in to comment.
You can’t perform that action at this time.