Core/Reputation: Fixed crash in reptutation code when PlayerStart.AllReputation is enabled in config

Port From (https://github.com/TrinityCore/TrinityCore/commit/353a71c6cd57c883722f8cd8d7897c15aad43fa2)
This commit is contained in:
hondacrx
2023-04-26 07:11:44 -04:00
parent 71cc0bb2ec
commit 8dc3afdf9b
+6 -6
View File
@@ -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)));
}
}