Core/Misc: Always reward all necessary reputations on creature kill

Port From (https://github.com/TrinityCore/TrinityCore/commit/e36497aef57899f18e0d55c0640bfd96e2251a8e)
This commit is contained in:
hondacrx
2020-05-06 18:00:59 -04:00
parent f723336c35
commit 03cb874825
2 changed files with 20 additions and 9 deletions
+6 -6
View File
@@ -1244,7 +1244,7 @@ namespace Game.Entities
{ {
if (currency.Flags.HasAnyFlag((uint)CurrencyFlags.HighPrecision)) if (currency.Flags.HasAnyFlag((uint)CurrencyFlags.HighPrecision))
count /= 100; count /= 100;
GetReputationMgr().ModifyReputation(factionEntry, count, true); GetReputationMgr().ModifyReputation(factionEntry, count, false, true);
return; return;
} }
@@ -1645,8 +1645,8 @@ namespace Game.Entities
FactionRecord factionEntry1 = CliDB.FactionStorage.LookupByKey(ChampioningFaction != 0 ? ChampioningFaction : Rep.RepFaction1); FactionRecord factionEntry1 = CliDB.FactionStorage.LookupByKey(ChampioningFaction != 0 ? ChampioningFaction : Rep.RepFaction1);
ReputationRank current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); ReputationRank current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
if (factionEntry1 != null && (uint)current_reputation_rank1 <= Rep.ReputationMaxCap1) if (factionEntry1 != null)
GetReputationMgr().ModifyReputation(factionEntry1, donerep1); GetReputationMgr().ModifyReputation(factionEntry1, donerep1, (uint)current_reputation_rank1 > Rep.ReputationMaxCap1);
} }
if (Rep.RepFaction2 != 0 && (!Rep.TeamDependent || team == Team.Horde)) if (Rep.RepFaction2 != 0 && (!Rep.TeamDependent || team == Team.Horde))
@@ -1656,8 +1656,8 @@ namespace Game.Entities
FactionRecord factionEntry2 = CliDB.FactionStorage.LookupByKey(ChampioningFaction != 0 ? ChampioningFaction : Rep.RepFaction2); FactionRecord factionEntry2 = CliDB.FactionStorage.LookupByKey(ChampioningFaction != 0 ? ChampioningFaction : Rep.RepFaction2);
ReputationRank current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); ReputationRank current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
if (factionEntry2 != null && (uint)current_reputation_rank2 <= Rep.ReputationMaxCap2) if (factionEntry2 != null)
GetReputationMgr().ModifyReputation(factionEntry2, donerep2); GetReputationMgr().ModifyReputation(factionEntry2, donerep2, (uint)current_reputation_rank2 > Rep.ReputationMaxCap2);
} }
} }
// Calculate how many reputation points player gain with the quest // Calculate how many reputation points player gain with the quest
@@ -1709,7 +1709,7 @@ namespace Game.Entities
rep = CalculateReputationGain(ReputationSource.Quest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus); rep = CalculateReputationGain(ReputationSource.Quest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
bool noSpillover = Convert.ToBoolean(quest.RewardReputationMask & (1 << i)); bool noSpillover = Convert.ToBoolean(quest.RewardReputationMask & (1 << i));
GetReputationMgr().ModifyReputation(factionEntry, rep, noSpillover); GetReputationMgr().ModifyReputation(factionEntry, rep, false, noSpillover);
} }
} }
+14 -3
View File
@@ -264,9 +264,17 @@ namespace Game
} }
} }
public bool ModifyReputation(FactionRecord factionEntry, int standing, bool noSpillover = false) { return SetReputation(factionEntry, standing, true, noSpillover); } public bool ModifyReputation(FactionRecord factionEntry, int standing, bool spillOverOnly = false, bool noSpillover = false)
{
return SetReputation(factionEntry, standing, true, spillOverOnly, noSpillover);
}
public bool SetReputation(FactionRecord factionEntry, int standing, bool incremental = false, bool noSpillover = false) public bool SetReputation(FactionRecord factionEntry, int standing)
{
return SetReputation(factionEntry, standing, false, false, false);
}
public bool SetReputation(FactionRecord factionEntry, int standing, bool incremental, bool spillOverOnly, bool noSpillover)
{ {
Global.ScriptMgr.OnPlayerReputationChange(_player, factionEntry.Id, standing, incremental); Global.ScriptMgr.OnPlayerReputationChange(_player, factionEntry.Id, standing, incremental);
bool res = false; bool res = false;
@@ -336,7 +344,10 @@ namespace Game
var faction = _factions.LookupByKey(factionEntry.ReputationIndex); var faction = _factions.LookupByKey(factionEntry.ReputationIndex);
if (faction != null) if (faction != null)
{ {
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 // only this faction gets reported to client, even if it has no own visible standing
SendState(faction); SendState(faction);
} }