diff --git a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs index 6c4a38e6..c68f8f2c 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs @@ -1255,8 +1255,7 @@ public class HideoutController( if ( paymentHelper.IsMoneyTpl(item.inventoryItem.Template) - && item.inventoryItem.Upd is not null - && item.inventoryItem.Upd.StackObjectsCount is not null + && item.inventoryItem.Upd?.StackObjectsCount != null && item.inventoryItem.Upd.StackObjectsCount > item.requestedItem.Count ) { diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs index 42c34e28..a94e4b88 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs @@ -48,39 +48,35 @@ public class TraderHelper( } /// - /// Get a trader base object, update profile to reflect players current standing in profile + /// Get a trader base object, update profile to reflect players current standing in profile (if session id provided) /// when trader not found in profile /// - /// Traders Id to get - /// Players id + /// Traders Id to return base of + /// OPTIONAL - Players id /// Trader base - public TraderBase? GetTrader(string traderID, MongoId sessionID) + public TraderBase? GetTrader(MongoId traderId, MongoId? sessionId = null) { - if (traderID == "ragfair") + if (sessionId is not null) { - return new TraderBase { Currency = CurrencyType.RUB }; + var pmcData = profileHelper.GetPmcProfile(sessionId.Value); + if (pmcData == null) + { + throw new Exception(serverLocalisationService.GetText("trader-unable_to_find_profile_with_id", sessionId)); + } + + // Profile has traderInfo dict (profile beyond creation stage) but no requested trader in profile + if (pmcData?.TradersInfo != null && !(pmcData?.TradersInfo?.ContainsKey(traderId) ?? false)) + { + // Add trader values to profile + ResetTrader(sessionId.Value, traderId); + LevelUp(traderId, pmcData); + } } - var traderIdMongo = new MongoId(traderID); - - var pmcData = profileHelper.GetPmcProfile(sessionID); - if (pmcData == null) - { - throw new Exception(serverLocalisationService.GetText("trader-unable_to_find_profile_with_id", sessionID)); - } - - // Profile has traderInfo dict (profile beyond creation stage) but no requested trader in profile - if (pmcData?.TradersInfo != null && !(pmcData?.TradersInfo?.ContainsKey(traderIdMongo) ?? false)) - { - // Add trader values to profile - ResetTrader(sessionID, traderIdMongo); - LevelUp(traderIdMongo, pmcData); - } - - var traderBase = databaseService.GetTrader(traderIdMongo).Base; + var traderBase = databaseService.GetTrader(traderId)?.Base; if (traderBase == null) { - logger.Error(serverLocalisationService.GetText("trader-unable_to_find_trader_by_id", traderID)); + logger.Error(serverLocalisationService.GetText("trader-unable_to_find_trader_by_id", traderId.ToString())); } return traderBase; diff --git a/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs b/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs index 72badc6c..1f9a9551 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs @@ -49,11 +49,20 @@ public static partial class ProgramStatics } // Public Static Getters + + /// + /// What type of release is this + /// + /// public static EntryType ENTRY_TYPE() { return BuildType; } + /// + /// Server is running in debug mode + /// + /// public static bool DEBUG() { return _debug; @@ -64,6 +73,10 @@ public static partial class ProgramStatics return _compiled; } + /// + /// Are mods enable for the server + /// + /// public static bool MODS() { return _mods; @@ -79,6 +92,10 @@ public static partial class ProgramStatics return Commit; } + /// + /// Timestamp of server build date + /// + /// public static double BUILD_TIME() { return BuildTime;