From 8b3c04bc15908b9ea664c18b079623796e7ef572 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 3 Nov 2019 16:50:04 -0500 Subject: [PATCH] Core/Currency: Implement currency to reputation conversion Port From (https://github.com/TrinityCore/TrinityCore/commit/12e17a586ef9d594e21c642c02d3a94a4b56d4ed) --- Source/Game/Entities/Player/Player.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 97095dfee..c53621d10 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -266,8 +266,8 @@ namespace Game.Entities InitRunes(); SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.Coinage), (ulong)WorldConfig.GetIntValue(WorldCfg.StartPlayerMoney)); - SetCurrency(CurrencyTypes.ApexisCrystals, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartApexisCrystals)); - SetCurrency(CurrencyTypes.JusticePoints, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartJusticePoints)); + SetCreateCurrency(CurrencyTypes.ApexisCrystals, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartApexisCrystals)); + SetCreateCurrency(CurrencyTypes.JusticePoints, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartJusticePoints)); // start with every map explored if (WorldConfig.GetBoolValue(WorldCfg.StartAllExplored)) @@ -1201,7 +1201,7 @@ namespace Game.Entities } //Currency - Money - void SetCurrency(CurrencyTypes id, uint count, bool printLog = true) + void SetCreateCurrency(CurrencyTypes id, uint count, bool printLog = true) { var playerCurrency = _currencyStorage.LookupByKey(id); if (playerCurrency == null) @@ -1234,6 +1234,16 @@ namespace Game.Entities if (!ignoreMultipliers) count *= (int)GetTotalAuraMultiplierByMiscValue(AuraType.ModCurrencyGain, (int)id); + // Currency that is immediately converted into reputation with that faction instead + FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(currency.FactionID); + if (factionEntry != null) + { + if (currency.Flags.HasAnyFlag((uint)CurrencyFlags.HighPrecision)) + count /= 100; + GetReputationMgr().ModifyReputation(factionEntry, count, true); + return; + } + uint oldTotalCount = 0; uint oldWeekCount = 0; uint oldTrackedCount = 0;