mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 21:57:01 +01:00
Core/Misc: Always reward all necessary reputations on creature kill (#19106)
(cherry picked from commit fb2aebe46b)
This commit is contained in:
@@ -6415,8 +6415,8 @@ void Player::RewardReputation(Unit* victim, float rate)
|
||||
|
||||
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
||||
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
|
||||
if (factionEntry1 && current_reputation_rank1 <= Rep->ReputationMaxCap1)
|
||||
GetReputationMgr().ModifyReputation(factionEntry1, donerep1);
|
||||
if (factionEntry1)
|
||||
GetReputationMgr().ModifyReputation(factionEntry1, donerep1, current_reputation_rank1 > Rep->ReputationMaxCap1);
|
||||
}
|
||||
|
||||
if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE))
|
||||
@@ -6426,8 +6426,8 @@ void Player::RewardReputation(Unit* victim, float rate)
|
||||
|
||||
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
||||
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
|
||||
if (factionEntry2 && current_reputation_rank2 <= Rep->ReputationMaxCap2)
|
||||
GetReputationMgr().ModifyReputation(factionEntry2, donerep2);
|
||||
if (factionEntry2)
|
||||
GetReputationMgr().ModifyReputation(factionEntry2, donerep2, current_reputation_rank2 > Rep->ReputationMaxCap2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6479,7 +6479,7 @@ void Player::RewardReputation(Quest const* quest)
|
||||
rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus);
|
||||
|
||||
bool noSpillover = (quest->GetRewardReputationMask() & (1 << i)) != 0;
|
||||
GetReputationMgr().ModifyReputation(factionEntry, rep, noSpillover);
|
||||
GetReputationMgr().ModifyReputation(factionEntry, rep, false, noSpillover);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6937,7 +6937,7 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
{
|
||||
if (currency->Flags & CURRENCY_FLAG_HIGH_PRECISION)
|
||||
count /= 100;
|
||||
GetReputationMgr().ModifyReputation(factionEntry, count, true);
|
||||
GetReputationMgr().ModifyReputation(factionEntry, count, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ void ReputationMgr::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool noSpillover)
|
||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly, bool noSpillover)
|
||||
{
|
||||
sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental);
|
||||
bool res = false;
|
||||
@@ -334,7 +334,10 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||
FactionStateList::iterator faction = _factions.find(factionEntry->ReputationIndex);
|
||||
if (faction != _factions.end())
|
||||
{
|
||||
res = SetOneFactionReputation(factionEntry, standing, incremental);
|
||||
// if we update spillover only, do not update main reputation (rank exceeds creature reward rate)
|
||||
if (!spillOverOnly)
|
||||
res = SetOneFactionReputation(factionEntry, standing, incremental);
|
||||
|
||||
// only this faction gets reported to client, even if it has no own visible standing
|
||||
SendState(&faction->second);
|
||||
}
|
||||
|
||||
@@ -118,11 +118,11 @@ class TC_GAME_API ReputationMgr
|
||||
public: // modifiers
|
||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
{
|
||||
return SetReputation(factionEntry, standing, false, false);
|
||||
return SetReputation(factionEntry, standing, false, false, false);
|
||||
}
|
||||
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing, bool noSpillover = false)
|
||||
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing, bool spillOverOnly = false, bool noSpillover = false)
|
||||
{
|
||||
return SetReputation(factionEntry, standing, true, noSpillover);
|
||||
return SetReputation(factionEntry, standing, true, spillOverOnly, noSpillover);
|
||||
}
|
||||
|
||||
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
|
||||
@@ -144,7 +144,7 @@ class TC_GAME_API ReputationMgr
|
||||
private: // internal helper functions
|
||||
void Initialize();
|
||||
uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const;
|
||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool noSpillover);
|
||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly, bool noSpillover);
|
||||
void SetVisible(FactionState* faction);
|
||||
void SetAtWar(FactionState* faction, bool atWar) const;
|
||||
void SetInactive(FactionState* faction, bool inactive) const;
|
||||
|
||||
Reference in New Issue
Block a user