From 8dc3afdf9b944436f560f122521089804e907f9f Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 26 Apr 2023 07:11:44 -0400 Subject: [PATCH] Core/Reputation: Fixed crash in reptutation code when PlayerStart.AllReputation is enabled in config Port From (https://github.com/TrinityCore/TrinityCore/commit/353a71c6cd57c883722f8cd8d7897c15aad43fa2) --- Source/Game/Reputation/ReputationManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Game/Reputation/ReputationManager.cs b/Source/Game/Reputation/ReputationManager.cs index c7b4aa57d..dfd140ed0 100644 --- a/Source/Game/Reputation/ReputationManager.cs +++ b/Source/Game/Reputation/ReputationManager.cs @@ -292,10 +292,13 @@ namespace Game SetFactionStanding setFactionStanding = new(); setFactionStanding.BonusFromAchievementSystem = 0.0f; - int standing = faction.VisualStandingIncrease != 0 ? faction.VisualStandingIncrease : faction.Standing; + int getStandingForPacket(FactionState state) + { + return state.VisualStandingIncrease != 0 ? state.VisualStandingIncrease : state.Standing; + } if (faction != null) - setFactionStanding.Faction.Add(new FactionStandingData((int)faction.ReputationListID, standing)); + setFactionStanding.Faction.Add(new FactionStandingData((int)faction.ReputationListID, getStandingForPacket(faction))); foreach (var state in _factions.Values) { @@ -303,10 +306,7 @@ namespace Game { state.needSend = false; if (faction == null || state.ReputationListID != faction.ReputationListID) - { - standing = state.VisualStandingIncrease != 0 ? state.VisualStandingIncrease : state.Standing; - setFactionStanding.Faction.Add(new FactionStandingData((int)state.ReputationListID, standing)); - } + setFactionStanding.Faction.Add(new FactionStandingData((int)state.ReputationListID, getStandingForPacket(state))); } }