diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs index d7e72aeb..99a92129 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs @@ -542,7 +542,7 @@ public class InsuranceController( /// Attachment count to remove protected double GetAttachmentCountToRemove(Dictionary weightedAttachmentByPrice, string? traderId) { - var removeCount = 0; + const int removeCount = 0; if (_randomUtil.GetChance100(_insuranceConfig.ChanceNoAttachmentsTakenPercent)) { diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs index 9641d013..69fbbf17 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs @@ -313,9 +313,9 @@ public class BotEquipmentModGenerator( // Get lowest and highest plate classes available for this armor var minMaxArmorPlateClass = GetMinMaxArmorPlateClass(platesFromDb.ToList()); - // Increment plate class level in attempt to get useable plate + // Increment plate class level in attempt to get usable plate var findCompatiblePlateAttempts = 0; - var maxAttempts = 3; + const int maxAttempts = 3; for (var i = 0; i < maxAttempts; i++) { var chosenArmorPlateLevelDouble = int.Parse(chosenArmorPlateLevelString) + 1; @@ -832,16 +832,16 @@ public class BotEquipmentModGenerator( var isMount = _itemHelper.IsOfBaseclass(itemTplWithKeysToSort, BaseClasses.MOUNT); HashSet sortedKeys = []; - var modRecieverKey = "mod_reciever"; - var modMount001Key = "mod_mount_001"; - var modGasBlockKey = "mod_gas_block"; - var modPistolGrip = "mod_pistol_grip"; - var modStockKey = "mod_stock"; - var modBarrelKey = "mod_barrel"; - var modHandguardKey = "mod_handguard"; - var modMountKey = "mod_mount"; - var modScopeKey = "mod_scope"; - var modScope000Key = "mod_scope_000"; + const string modRecieverKey = "mod_reciever"; + const string modMount001Key = "mod_mount_001"; + const string modGasBlockKey = "mod_gas_block"; + const string modPistolGrip = "mod_pistol_grip"; + const string modStockKey = "mod_stock"; + const string modBarrelKey = "mod_barrel"; + const string modHandguardKey = "mod_handguard"; + const string modMountKey = "mod_mount"; + const string modScopeKey = "mod_scope"; + const string modScope000Key = "mod_scope_000"; // Mounts are a special case, they need scopes first before more mounts if (isMount) diff --git a/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs index 666694e6..4e1daac5 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs @@ -216,7 +216,7 @@ public class PlayerScavGenerator( /// IBotType object protected BotType ConstructBotBaseTemplate(string botTypeForLoot) { - var baseScavType = "assault"; + const string baseScavType = "assault"; var asssaultBase = _cloner.Clone(_botHelper.GetBotTemplate(baseScavType)); // Loot bot is same as base bot, return base with no modification diff --git a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs index 10f2f6d5..b1d93338 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs @@ -133,7 +133,7 @@ public class RepeatableQuestGenerator( var maxBodyPartsDifficulty = eliminationConfig.MinKills / bodyPartsConfig.MinProbability(); // maxDistDifficulty is defined by 2, this could be a tuning parameter if we don't like the reward generation - var maxDistDifficulty = 2; + const int maxDistDifficulty = 2; var maxKillDifficulty = eliminationConfig.MaxKills; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs index 95ee7cdc..d4daeb61 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs @@ -70,7 +70,7 @@ public class BotHelper( /// bot type to add to friendly list public void AddBotToFriendlyList(DifficultyCategories difficultySettings, string typeToAdd) { - var friendlyBotTypesKey = "FRIENDLY_BOT_TYPES"; + const string friendlyBotTypesKey = "FRIENDLY_BOT_TYPES"; // Null guard if (difficultySettings.Mind[friendlyBotTypesKey] is null) @@ -88,7 +88,7 @@ public class BotHelper( /// bot type to add to revenge list public void AddBotToRevengeList(DifficultyCategories difficultySettings, string[] typesToAdd) { - var revengePropKey = "REVENGE_BOT_TYPES"; + const string revengePropKey = "REVENGE_BOT_TYPES"; // Nothing to add if (typesToAdd is null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs index 328629dc..a8e7de84 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs @@ -98,7 +98,7 @@ public class HandbookHelper( var handbookItem = _databaseService.GetHandbook().Items?.FirstOrDefault(item => item.Id == tpl); if (handbookItem is null) { - var newValue = 0; + const int newValue = 0; if (!_handbookPriceCache.Items.ById.TryAdd(tpl, newValue)) { diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs index 1cb93fd7..4cbc4bd9 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs @@ -913,7 +913,7 @@ public class HideoutHelper( var globalSkillsDb = _databaseService.GetGlobals().Configuration.SkillsSettings; // 100 resources last 8 hrs 20 min, 100/8.33/60/60 = 0.00333 - var filterDrainRate = 0.00333; + const double filterDrainRate = 0.00333d; var hideoutManagementConsumptionBonus = GetSkillBonusMultipliedBySkillLevel( pmcData, diff --git a/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs index eb7ae2f5..d6782866 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs @@ -1028,7 +1028,7 @@ public class QuestHelper( var clientQuestsClone = _cloner.Clone(GetClientQuests(sessionID)); // Must be gathered prior to applyQuestReward() & failQuests() - var newQuestState = QuestStatusEnum.Success; + const QuestStatusEnum newQuestState = QuestStatusEnum.Success; UpdateQuestState(pmcData, newQuestState, completedQuestId); var questRewards = _questRewardHelper.ApplyQuestReward( pmcData, diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs index 6b55fe3d..16f09b1d 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs @@ -275,7 +275,7 @@ public class TradeHelper( IncrementCirculateSoldToTraderCounter(profileWithItemsToSell, profileToReceiveMoney, sellRequest); } - var pattern = @"\s+"; + const string pattern = @"\s+"; // Find item in inventory and remove it foreach (var itemToBeRemoved in sellRequest.Items) @@ -320,7 +320,7 @@ public class TradeHelper( ProcessSellTradeRequestData sellRequest ) { - var circulateQuestId = "6663149f1d3ec95634095e75"; + const string circulateQuestId = "6663149f1d3ec95634095e75"; var activeCirculateQuest = profileToReceiveMoney.Quests.FirstOrDefault( quest => quest.QId == circulateQuestId && quest.Status == QuestStatusEnum.Started ); diff --git a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs index 16004c7a..29d88a04 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs @@ -63,7 +63,7 @@ public class ConfigServer } // Get all filepaths - var filepath = "./Assets/configs/"; + const string filepath = "./Assets/configs/"; var files = _fileUtil.GetFiles(filepath); // Add file content to result diff --git a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs index cbc0bf0d..c00d5be5 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs @@ -550,7 +550,7 @@ public class LocationLifecycleService pmcData.CarExtractCounts[extractName] ); - var fenceId = Traders.FENCE; + const string fenceId = Traders.FENCE; pmcData.TradersInfo[fenceId].Standing = newFenceStanding; // Check if new standing has leveled up trader @@ -583,7 +583,7 @@ public class LocationLifecycleService pmcData.CoopExtractCounts[extractName] ); - var fenceId = Traders.FENCE; + const string fenceId = Traders.FENCE; pmcData.TradersInfo[fenceId].Standing = newFenceStanding; // Check if new standing has leveled up trader @@ -607,7 +607,7 @@ public class LocationLifecycleService */ protected double GetFenceStandingAfterExtract(PmcData pmcData, double baseGain, double extractCount) { - var fenceId = Traders.FENCE; + const string fenceId = Traders.FENCE; var fenceStanding = pmcData.TradersInfo[fenceId].Standing; // get standing after taking extract x times, x.xx format, gain from extract can be no smaller than 0.01 @@ -823,7 +823,7 @@ public class LocationLifecycleService // Must occur AFTER experience is set and stats copied over pmcProfile.Stats.Eft.TotalSessionExperience = 0; - var fenceId = Traders.FENCE; + const string fenceId = Traders.FENCE; // Clamp fence standing var currentFenceStanding = postRaidProfile.TradersInfo[fenceId].Standing; diff --git a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs index bf7fedd5..711f19cd 100644 --- a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs +++ b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs @@ -53,7 +53,7 @@ public class HideoutCraftQuestIdGenerator( // Figure out our source and target directories var projectDir = Directory.GetParent("./").Parent.Parent.Parent.Parent.Parent; - var productionPath = "Libraries\\SPTarkov.Server.Assets\\Assets\\database\\hideout\\production.json"; + const string productionPath = "Libraries\\SPTarkov.Server.Assets\\Assets\\database\\hideout\\production.json"; var productionFilePath = Path.Combine(projectDir.FullName, productionPath); var updatedProductionJson = _jsonUtil.Serialize(_databaseServer.GetTables().Hideout.Production, true); diff --git a/Tools/ItemTplGenerator/ItemTplGenerator.cs b/Tools/ItemTplGenerator/ItemTplGenerator.cs index 9b778b60..0842064c 100644 --- a/Tools/ItemTplGenerator/ItemTplGenerator.cs +++ b/Tools/ItemTplGenerator/ItemTplGenerator.cs @@ -304,7 +304,7 @@ public class ItemTplGenerator( private bool IsValidItem(TemplateItem item) { - var shrapnelId = "5943d9c186f7745a13413ac9"; + const string shrapnelId = "5943d9c186f7745a13413ac9"; if (item.Type != "Item") {