diff --git a/Libraries/Core/Controllers/HideoutController.cs b/Libraries/Core/Controllers/HideoutController.cs
index 9819d6a6..a4f5b138 100644
--- a/Libraries/Core/Controllers/HideoutController.cs
+++ b/Libraries/Core/Controllers/HideoutController.cs
@@ -483,7 +483,10 @@ public class HideoutController(
_inventoryHelper.RemoveItemByCount(pmcData, itemToDelete.Id, requiredCount, sessionID, output);
// Tools don't have a count
- if (requirement.Type != "Tool") requirement.Count -= (int)itemToDelete.Count;
+ if (requirement.Type != "Tool")
+ {
+ requirement.Count -= (int)itemToDelete.Count;
+ }
}
return output;
@@ -731,7 +734,7 @@ public class HideoutController(
if (hoursCrafting / _hideoutConfig.HoursForSkillCrafting >= 1)
{
// Spent enough time crafting to get a bonus xp multiplier
- var multiplierCrafting = Math.Floor((double)hoursCrafting / _hideoutConfig.HoursForSkillCrafting);
+ var multiplierCrafting = Math.Floor(hoursCrafting.Value / _hideoutConfig.HoursForSkillCrafting);
craftingExpAmount += (int)(1 * multiplierCrafting);
hoursCrafting -= _hideoutConfig.HoursForSkillCrafting * multiplierCrafting;
}
diff --git a/Libraries/Core/Controllers/ProfileController.cs b/Libraries/Core/Controllers/ProfileController.cs
index 32d7dd42..176b48a7 100644
--- a/Libraries/Core/Controllers/ProfileController.cs
+++ b/Libraries/Core/Controllers/ProfileController.cs
@@ -82,9 +82,9 @@ public class ProfileController(
Nickname = pmc.Info.Nickname,
HasPassword = profile.ProfileInfo.Password != "",
Side = pmc.Info.Side,
- CurrentLevel = (int)pmc.Info.Level,
+ CurrentLevel = pmc.Info.Level,
CurrentExperience = pmc.Info.Experience ?? 0,
- PreviousExperience = currlvl == 0 ? 0 : _profileHelper.GetExperience((int)currlvl),
+ PreviousExperience = currlvl == 0 ? 0 : _profileHelper.GetExperience(currlvl.Value),
NextLevel = xpToNextLevel,
MaxLevel = maxLvl,
Edition = profile.ProfileInfo?.Edition ?? "",
diff --git a/Libraries/Core/Controllers/RagfairController.cs b/Libraries/Core/Controllers/RagfairController.cs
index 84898738..926cb4bb 100644
--- a/Libraries/Core/Controllers/RagfairController.cs
+++ b/Libraries/Core/Controllers/RagfairController.cs
@@ -176,7 +176,7 @@ public class RagfairController
if (searchRequest.BuildCount == 0)
{
var start = searchRequest.Page * searchRequest.Limit;
- var end = (int)Math.Min((double)((searchRequest.Page + 1) * searchRequest.Limit), result.Offers.Count);
+ var end = Math.Min((searchRequest.Page.Value + 1) * searchRequest.Limit.Value, result.Offers.Count);
result.Offers = result.Offers.Slice(start.Value, end - start.Value);
}
diff --git a/Libraries/Core/Controllers/WeatherController.cs b/Libraries/Core/Controllers/WeatherController.cs
index 89490566..24aaa952 100644
--- a/Libraries/Core/Controllers/WeatherController.cs
+++ b/Libraries/Core/Controllers/WeatherController.cs
@@ -53,9 +53,9 @@ public class WeatherController(
///
public GetLocalWeatherResponseData GenerateLocal(string sessionId)
{
- var result = new GetLocalWeatherResponseData()
+ var result = new GetLocalWeatherResponseData
{
- Season = (int)_seasonalEventService.GetActiveWeatherSeason(),
+ Season = _seasonalEventService.GetActiveWeatherSeason(),
Weather = []
};
diff --git a/Libraries/Core/Generators/BotGenerator.cs b/Libraries/Core/Generators/BotGenerator.cs
index acb12fc9..76de71c9 100644
--- a/Libraries/Core/Generators/BotGenerator.cs
+++ b/Libraries/Core/Generators/BotGenerator.cs
@@ -463,27 +463,27 @@ public class BotGenerator(
{
Hydration = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)healthObj.Hydration.Min, (int)healthObj.Hydration.Max),
+ Current = _randomUtil.GetDouble(healthObj.Hydration.Min.Value, healthObj.Hydration.Max.Value),
Maximum = healthObj.Hydration.Max
},
Energy = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)healthObj.Energy.Min, (int)healthObj.Energy.Max),
+ Current = _randomUtil.GetDouble(healthObj.Energy.Min.Value, healthObj.Energy.Max.Value),
Maximum = healthObj.Energy.Max
},
Temperature = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)healthObj.Temperature.Min, (int)healthObj.Temperature.Max),
+ Current = _randomUtil.GetDouble(healthObj.Temperature.Min.Value, healthObj.Temperature.Max.Value),
Maximum = healthObj.Temperature.Max
},
- BodyParts = new Dictionary()
+ BodyParts = new Dictionary
{
{
"Head", new BodyPartHealth
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.Head.Min, (int)bodyParts.Head.Max),
+ Current = _randomUtil.GetDouble(bodyParts.Head.Min.Value, bodyParts.Head.Max.Value),
Maximum = Math.Round(bodyParts.Head.Max ?? 0)
}
}
@@ -493,7 +493,7 @@ public class BotGenerator(
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.Chest.Min, (int)bodyParts.Chest.Max),
+ Current = _randomUtil.GetDouble(bodyParts.Chest.Min.Value, bodyParts.Chest.Max.Value),
Maximum = Math.Round(bodyParts.Chest.Max ?? 0)
}
}
@@ -503,7 +503,7 @@ public class BotGenerator(
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.Stomach.Min, (int)bodyParts.Stomach.Max),
+ Current = _randomUtil.GetDouble(bodyParts.Stomach.Min.Value, bodyParts.Stomach.Max.Value),
Maximum = Math.Round(bodyParts.Stomach.Max ?? 0)
}
}
@@ -513,7 +513,7 @@ public class BotGenerator(
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.LeftArm.Min, (int)bodyParts.LeftArm.Max),
+ Current = _randomUtil.GetDouble(bodyParts.LeftArm.Min.Value, bodyParts.LeftArm.Max.Value),
Maximum = Math.Round(bodyParts.LeftArm.Max ?? 0)
}
}
@@ -523,7 +523,7 @@ public class BotGenerator(
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.RightArm.Min, (int)bodyParts.RightArm.Max),
+ Current = _randomUtil.GetDouble(bodyParts.RightArm.Min.Value, bodyParts.RightArm.Max.Value),
Maximum = Math.Round(bodyParts.RightArm.Max ?? 0)
}
}
@@ -533,7 +533,7 @@ public class BotGenerator(
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.LeftLeg.Min, (int)bodyParts.LeftLeg.Max),
+ Current = _randomUtil.GetDouble(bodyParts.LeftLeg.Min.Value, bodyParts.LeftLeg.Max.Value),
Maximum = Math.Round(bodyParts.LeftLeg.Max ?? 0)
}
}
@@ -543,13 +543,13 @@ public class BotGenerator(
{
Health = new CurrentMinMax
{
- Current = _randomUtil.GetInt((int)bodyParts.RightLeg.Min, (int)bodyParts.RightLeg.Max),
+ Current = _randomUtil.GetDouble(bodyParts.RightLeg.Min.Value, bodyParts.RightLeg.Max.Value),
Maximum = Math.Round(bodyParts.RightLeg.Max ?? 0)
}
}
}
},
- UpdateTime = 0, // 0 for pscav too
+ UpdateTime = 0, // 0 for player-scav too
Immortal = false
};
@@ -557,7 +557,7 @@ public class BotGenerator(
}
///
- /// Sum up body parts max hp values, return the bodypart collection with lowest value
+ /// Sum up body parts max hp values, return the bodyPart collection with lowest value
///
/// Body parts to sum up
/// Lowest hp collection
@@ -629,7 +629,7 @@ public class BotGenerator(
var skillToAdd = new BaseSkill
{
Id = kvp.Key,
- Progress = _randomUtil.GetInt((int)skill.Min, (int)skill.Max)
+ Progress = _randomUtil.GetDouble(skill.Min.Value, skill.Max.Value)
};
// Common skills have additional props
diff --git a/Libraries/Core/Generators/LocationLootGenerator.cs b/Libraries/Core/Generators/LocationLootGenerator.cs
index 749cf011..378397ed 100644
--- a/Libraries/Core/Generators/LocationLootGenerator.cs
+++ b/Libraries/Core/Generators/LocationLootGenerator.cs
@@ -422,8 +422,8 @@ public class LocationLootGenerator(
? [chosenItemWithChildren.Items[0]] // Strip children from parent
: chosenItemWithChildren.Items;
var itemSize = GetItemSize(items);
- var width = (int)itemSize.Width;
- var height = (int)itemSize.Height;
+ var width = itemSize.Width;
+ var height = itemSize.Height;
// look for open slot to put chosen item into
var result = _containerHelper.FindSlotForItem(containerMap, width, height);
@@ -555,7 +555,7 @@ public class LocationLootGenerator(
///
/// Container to get possible loot for
/// staticLoot.json
- /// ProbabilityObjectArray of item tpls + probabilty
+ /// ProbabilityObjectArray of item tpls + probability
protected ProbabilityObjectArray GetPossibleLootItemsForContainer(
string containerTypeId,
Dictionary staticLootDist)
@@ -899,7 +899,7 @@ public class LocationLootGenerator(
var stackCount =
itemTemplate.Properties.StackMaxSize == 1
? 1
- : _randomUtil.GetInt((int)itemTemplate.Properties.StackMinRandom, (int)itemTemplate.Properties.StackMaxRandom);
+ : _randomUtil.GetInt(itemTemplate.Properties.StackMinRandom.Value, itemTemplate.Properties.StackMaxRandom.Value);
itemWithMods.Add(
new Item
@@ -997,7 +997,7 @@ public class LocationLootGenerator(
// Edge case - some ammos e.g. flares or M406 grenades shouldn't be stacked
var stackCount = itemTemplate.Properties.StackMaxSize == 1
? 1
- : _randomUtil.GetInt((int)itemTemplate.Properties.StackMinRandom, (int)itemTemplate.Properties.StackMaxRandom);
+ : _randomUtil.GetInt(itemTemplate.Properties.StackMinRandom.Value, itemTemplate.Properties.StackMaxRandom.Value);
rootItem.Upd = new Upd { StackObjectsCount = stackCount };
}
diff --git a/Libraries/Core/Generators/LootGenerator.cs b/Libraries/Core/Generators/LootGenerator.cs
index 1bd38fe9..ab022e0d 100644
--- a/Libraries/Core/Generators/LootGenerator.cs
+++ b/Libraries/Core/Generators/LootGenerator.cs
@@ -264,7 +264,7 @@ public class LootGenerator(
var armorDetails = _itemHelper.GetItem(armorItem.Template).Value;
var armorClass = armorDetails.Properties.ArmorClass;
- return options.ArmorLevelWhitelist.Contains((int)armorClass.Value);
+ return options.ArmorLevelWhitelist.Contains(armorClass.Value);
}
return false;
@@ -341,11 +341,11 @@ public class LootGenerator(
if (options.ItemStackLimits.TryGetValue(item.Id, out var itemLimits))
{
- min = itemLimits.Min;
+ min = (int?)itemLimits.Min;
max = (int?)itemLimits.Max;
}
- return _randomUtil.GetInt((int)(min ?? 1), max ?? 1);
+ return _randomUtil.GetInt((min ?? 1), max ?? 1);
}
///
diff --git a/Libraries/Core/Generators/RagfairOfferGenerator.cs b/Libraries/Core/Generators/RagfairOfferGenerator.cs
index 94619ed0..a9999746 100644
--- a/Libraries/Core/Generators/RagfairOfferGenerator.cs
+++ b/Libraries/Core/Generators/RagfairOfferGenerator.cs
@@ -138,7 +138,7 @@ public class RagfairOfferGenerator(
User = CreateUserDataForFleaOffer(userID, isTrader),
Root = items[0].Id,
Items = itemsClone,
- ItemsCost = Math.Round((double)handbookHelper.GetTemplatePrice(items[0].Template)), // Handbook price
+ ItemsCost = Math.Round(handbookHelper.GetTemplatePrice(items[0].Template)), // Handbook price
Requirements = offerRequirements,
RequirementsCost = Math.Round(singleItemListingPrice),
SummaryCost = roubleListingPrice,
@@ -316,8 +316,7 @@ public class RagfairOfferGenerator(
return (long)databaseService.GetTrader(userID).Base.NextResupply;
// Generated fake-player offer
- return (long)Math.Round(
- (double)(time + randomUtil.GetInt((int)ragfairConfig.Dynamic.EndTimeSeconds.Min, (int)ragfairConfig.Dynamic.EndTimeSeconds.Max))
+ return (long)Math.Round(time + randomUtil.GetDouble(ragfairConfig.Dynamic.EndTimeSeconds.Min.Value, ragfairConfig.Dynamic.EndTimeSeconds.Max.Value)
);
}
@@ -374,9 +373,9 @@ public class RagfairOfferGenerator(
// Limit to 1 offer when processing expired - like-for-like replacement
var offerCount = isExpiredOffer
? 1
- : randomUtil.GetInt((int)config.OfferItemCount.Min, (int)config.OfferItemCount.Max);
+ : randomUtil.GetDouble(config.OfferItemCount.Min.Value, config.OfferItemCount.Max.Value);
- /* TODO: ???????
+ /* //TODO: ???????
if (ProgramStatics.DEBUG && !ProgramStatics.COMPILED) {
offerCount = 2;
}
diff --git a/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs b/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs
index 71cec268..8107b376 100644
--- a/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs
+++ b/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs
@@ -117,8 +117,8 @@ public class RepeatableQuestRewardGenerator(
{
rewards.Success.Add(chosenWeapon.Value.Key);
- // Subtract price of preset from item budget so we dont give player too much stuff
- itemRewardBudget -= (int)chosenWeapon.Value.Value;
+ // Subtract price of preset from item budget so we don't give player too much stuff
+ itemRewardBudget -= chosenWeapon.Value.Value;
rewardIndex++;
}
}
@@ -293,9 +293,7 @@ public class RepeatableQuestRewardGenerator(
return Math.Floor(
effectiveDifficulty *
_mathUtil.Interp1(pmcLevel, levelsConfig, roublesConfig) *
- _randomUtil.GetDouble((double)(1 - rewardSpreadConfig), (double)(1 + rewardSpreadConfig)) ??
- 0
- );
+ _randomUtil.GetDouble((1d - rewardSpreadConfig.Value), 1d + rewardSpreadConfig.Value) ?? 0);
}
private Dictionary GetRewardableItemsFromPoolWithinBudget(List itemPool,
diff --git a/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs
index b8ffb5a1..727a7c8e 100644
--- a/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs
+++ b/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs
@@ -24,14 +24,14 @@ public class BarrelInvetoryMagGen(
public void Process(InventoryMagGen inventoryMagGen)
{
// Can't be done by _props.ammoType as grenade launcher shoots grenades with ammoType of "buckshot"
- double? randomisedAmmoStackSize = null;
+ double? randomisedAmmoStackSize;
if (inventoryMagGen.GetAmmoTemplate().Properties.StackMaxRandom == 1)
- // doesnt stack
+ // Doesn't stack
randomisedAmmoStackSize = _randomUtil.GetInt(3, 6);
else
randomisedAmmoStackSize = _randomUtil.GetInt(
- (int)inventoryMagGen.GetAmmoTemplate().Properties.StackMinRandom,
- (int)inventoryMagGen.GetAmmoTemplate().Properties.StackMaxRandom
+ inventoryMagGen.GetAmmoTemplate().Properties.StackMinRandom.Value,
+ inventoryMagGen.GetAmmoTemplate().Properties.StackMaxRandom.Value
);
_botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots(
diff --git a/Libraries/Core/Helpers/BotGeneratorHelper.cs b/Libraries/Core/Helpers/BotGeneratorHelper.cs
index aa05deee..f57fe100 100644
--- a/Libraries/Core/Helpers/BotGeneratorHelper.cs
+++ b/Libraries/Core/Helpers/BotGeneratorHelper.cs
@@ -174,9 +174,9 @@ public class BotGeneratorHelper(
if (_randomUtil.GetChance100(randomizationValues.ChanceMaxResourcePercent)) return maxResource;
- return _randomUtil.GetInt(
- (int)_randomUtil.GetPercentOfValue(randomizationValues.ResourcePercent, maxResource, 0),
- (int)maxResource
+ return _randomUtil.GetDouble(
+ _randomUtil.GetPercentOfValue(randomizationValues.ResourcePercent, maxResource, 0),
+ maxResource
);
}
diff --git a/Libraries/Core/Helpers/BotHelper.cs b/Libraries/Core/Helpers/BotHelper.cs
index 0a78a701..a3740587 100644
--- a/Libraries/Core/Helpers/BotHelper.cs
+++ b/Libraries/Core/Helpers/BotHelper.cs
@@ -102,7 +102,7 @@ public class BotHelper(
public bool RollChanceToBePmc(MinMax botConvertMinMax)
{
- return _randomUtil.GetChance100(_randomUtil.GetInt((int)botConvertMinMax.Min, (int)botConvertMinMax.Max));
+ return _randomUtil.GetChance100(_randomUtil.GetDouble(botConvertMinMax.Min.Value, botConvertMinMax.Max.Value));
}
protected Dictionary GetPmcConversionValuesForLocation(string location)
diff --git a/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs b/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs
index 77cf935d..7575ccac 100644
--- a/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs
+++ b/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs
@@ -63,7 +63,7 @@ public class BotWeaponGeneratorHelper(
/// Numerical value of magazine count
public int GetRandomizedMagazineCount(GenerationData magCounts)
{
- return (int)_weightedRandomHelper.GetWeightedValue(magCounts.Weights);
+ return (int)_weightedRandomHelper.GetWeightedValue(magCounts.Weights);
}
///
diff --git a/Libraries/Core/Helpers/ItemHelper.cs b/Libraries/Core/Helpers/ItemHelper.cs
index 587e73cf..477d1cfc 100644
--- a/Libraries/Core/Helpers/ItemHelper.cs
+++ b/Libraries/Core/Helpers/ItemHelper.cs
@@ -1168,17 +1168,17 @@ public class ItemHelper(
// Calculating child ExtraSize
if (itemTemplate.Properties.ExtraSizeForceAdd ?? false)
{
- forcedUp += (int)itemTemplate.Properties.ExtraSizeUp;
- forcedDown += (int)itemTemplate.Properties.ExtraSizeDown;
- forcedLeft += (int)itemTemplate.Properties.ExtraSizeLeft;
- forcedRight += (int)itemTemplate.Properties.ExtraSizeRight;
+ forcedUp += itemTemplate.Properties.ExtraSizeUp.Value;
+ forcedDown += itemTemplate.Properties.ExtraSizeDown.Value;
+ forcedLeft += itemTemplate.Properties.ExtraSizeLeft.Value;
+ forcedRight += itemTemplate.Properties.ExtraSizeRight.Value;
}
else
{
- sizeUp = sizeUp < itemTemplate.Properties.ExtraSizeUp ? (int)itemTemplate.Properties.ExtraSizeUp : sizeUp;
- sizeDown = sizeDown < itemTemplate.Properties.ExtraSizeDown ? (int)itemTemplate.Properties.ExtraSizeDown : sizeDown;
- sizeLeft = sizeLeft < itemTemplate.Properties.ExtraSizeLeft ? (int)itemTemplate.Properties.ExtraSizeLeft : sizeLeft;
- sizeRight = sizeRight < itemTemplate.Properties.ExtraSizeRight ? (int)itemTemplate.Properties.ExtraSizeRight : sizeRight;
+ sizeUp = sizeUp < itemTemplate.Properties.ExtraSizeUp ? itemTemplate.Properties.ExtraSizeUp.Value : sizeUp;
+ sizeDown = sizeDown < itemTemplate.Properties.ExtraSizeDown ? itemTemplate.Properties.ExtraSizeDown.Value : sizeDown;
+ sizeLeft = sizeLeft < itemTemplate.Properties.ExtraSizeLeft ? itemTemplate.Properties.ExtraSizeLeft.Value : sizeLeft;
+ sizeRight = sizeRight < itemTemplate.Properties.ExtraSizeRight ? itemTemplate.Properties.ExtraSizeRight.Value : sizeRight;
}
}
@@ -1379,11 +1379,11 @@ public class ItemHelper(
(int)magazineCartridgeMaxCount
);
- if (magazineWithChildCartridges.Count() > 1) _logger.Warning($"Magazine {magTemplate.Name} already has cartridges defined, this may cause issues");
+ if (magazineWithChildCartridges.Count > 1) _logger.Warning($"Magazine {magTemplate.Name} already has cartridges defined, this may cause issues");
// Loop over cartridge count and add stacks to magazine
- double? currentStoredCartridgeCount = 0;
- var location = 0;
+ int currentStoredCartridgeCount = 0;
+ int location = 0;
while (currentStoredCartridgeCount < desiredStackCount)
{
// Get stack size of cartridges
@@ -1392,7 +1392,7 @@ public class ItemHelper(
// Ensure we don't go over the max stackCount size
var remainingSpace = desiredStackCount - currentStoredCartridgeCount;
- if (cartridgeCountToAdd > remainingSpace) cartridgeCountToAdd = (int)remainingSpace;
+ if (cartridgeCountToAdd > remainingSpace) cartridgeCountToAdd = remainingSpace;
// Add cartridge item object into items array
magazineWithChildCartridges.Add(
@@ -1405,7 +1405,7 @@ public class ItemHelper(
)
);
- currentStoredCartridgeCount += cartridgeCountToAdd;
+ currentStoredCartridgeCount += cartridgeCountToAdd.Value;
location++;
}
@@ -1797,8 +1797,8 @@ public class ItemHelper(
return ammoItemTemplate.Properties?.StackMaxSize == 1
? 1
: _randomUtil.GetInt(
- (int?)ammoItemTemplate.Properties?.StackMinRandom ?? 1,
- Math.Min((int?)ammoItemTemplate.Properties?.StackMaxRandom ?? 1, maxLimit)
+ ammoItemTemplate.Properties?.StackMinRandom ?? 1,
+ Math.Min(ammoItemTemplate.Properties?.StackMaxRandom ?? 1, maxLimit)
);
}
diff --git a/Libraries/Core/Helpers/QuestRewardHelper.cs b/Libraries/Core/Helpers/QuestRewardHelper.cs
index eded86c0..cb5459ff 100644
--- a/Libraries/Core/Helpers/QuestRewardHelper.cs
+++ b/Libraries/Core/Helpers/QuestRewardHelper.cs
@@ -152,7 +152,7 @@ public class QuestRewardHelper(
// Add % bonus to existing StackObjectsCount
var rewardItem = reward.Items[0];
var newCurrencyAmount = Math.Floor((rewardItem.Upd.StackObjectsCount ?? 0) * (1 + bonusPercent / 100));
- rewardItem.Upd.StackObjectsCount = (int)newCurrencyAmount;
+ rewardItem.Upd.StackObjectsCount = newCurrencyAmount;
reward.Value = newCurrencyAmount;
}
diff --git a/Libraries/Core/Helpers/TraderHelper.cs b/Libraries/Core/Helpers/TraderHelper.cs
index 95c40908..433497ef 100644
--- a/Libraries/Core/Helpers/TraderHelper.cs
+++ b/Libraries/Core/Helpers/TraderHelper.cs
@@ -31,7 +31,7 @@ public class TraderHelper(
)
{
protected TraderConfig _traderConfig = _configServer.GetConfig();
- protected Dictionary _highestTraderPriceItems = new();
+ protected Dictionary _highestTraderPriceItems = new();
protected List _gameVersions = [GameEditions.EDGE_OF_DARKNESS, GameEditions.UNHEARD];
@@ -449,9 +449,7 @@ public class TraderHelper(
/// highest rouble cost for item
public double GetHighestTraderPriceRouble(string tpl)
{
- if (_highestTraderPriceItems is not null) return (double)_highestTraderPriceItems[tpl];
-
- if (_highestTraderPriceItems is null) _highestTraderPriceItems = new Dictionary();
+ if (_highestTraderPriceItems is not null) return _highestTraderPriceItems[tpl];
// Init dict and fill
foreach (var traderName in Traders.TradersDictionary)
@@ -463,7 +461,7 @@ public class TraderHelper(
var traderAssorts = _databaseService.GetTrader(traderName.Value).Assort;
if (traderAssorts is null) continue;
- // Get all item assorts that have parentid of hideout (base item and not a mod of other item)
+ // Get all item assorts that have parentId of hideout (base item and not a mod of other item)
foreach (var item in traderAssorts.Items.Where(x => x.ParentId == "hideout"))
{
// Get barter scheme (contains cost of item)
@@ -475,11 +473,14 @@ public class TraderHelper(
: _handbookHelper.InRUB(barterScheme.Count ?? 1, barterScheme.Template);
// Existing price smaller in dict than current iteration, overwrite
- if ((_highestTraderPriceItems[item.Template] ?? 0) < roubleAmount) _highestTraderPriceItems[item.Template] = (int)roubleAmount;
+ if (_highestTraderPriceItems[item.Template] < roubleAmount)
+ {
+ _highestTraderPriceItems[item.Template] = roubleAmount.Value;
+ }
}
}
- return (double)_highestTraderPriceItems[tpl];
+ return _highestTraderPriceItems[tpl];
}
///
@@ -489,14 +490,14 @@ public class TraderHelper(
/// Rouble price
public double GetHighestSellToTraderPrice(string tpl)
{
- // Find highest trader price for item
+ // Find largest trader price for item
var highestPrice = 1; // Default price
foreach (var trader in Traders.TradersDictionary)
{
// Get trader and check buy category allows tpl
var traderBase = _databaseService.GetTrader(trader.Value).Base;
- // Skip traders that dont sell
+ // Skip traders that don't sell
if (traderBase is null || !_itemHelper.IsOfBaseclasses(tpl, traderBase.ItemsBuy.Category)) continue;
// Get loyalty level details player has achieved with this trader
diff --git a/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs
index 86a56460..4126f9a8 100644
--- a/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs
+++ b/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs
@@ -154,11 +154,14 @@ public record Info
public string? LowerNickname { get; set; }
public string? Side { get; set; }
public bool? SquadInviteRestriction { get; set; }
+
+ // Confirmed in client
public int? PrestigeLevel { get; set; }
public string? Voice { get; set; }
public int? Level { get; set; }
- ///Experience the bot has gained
+ //Experience the bot has gained
+ // Confirmed in client
public int? Experience { get; set; }
public List? Bans { get; set; }
@@ -166,6 +169,7 @@ public record Info
public long? BannedUntil { get; set; }
public bool? IsStreamerModeAvailable { get; set; }
+ // Confirmed in client
[JsonConverter(typeof(StringToNumberFactoryConverter))]
public int? RegistrationDate { get; set; }
diff --git a/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs b/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs
index 87093ae0..1d61b18c 100644
--- a/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs
+++ b/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs
@@ -1119,10 +1119,10 @@ public record Props
public string? RepairType { get; set; }
[JsonPropertyName("StackMinRandom")]
- public double? StackMinRandom { get; set; }
+ public int? StackMinRandom { get; set; }
[JsonPropertyName("StackMaxRandom")]
- public double? StackMaxRandom { get; set; }
+ public int? StackMaxRandom { get; set; }
[JsonPropertyName("ammoType")]
public string? AmmoType { get; set; }
diff --git a/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs b/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs
index 4d493b70..7b2648f4 100644
--- a/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs
+++ b/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs
@@ -59,6 +59,7 @@ public record RagfairOffer
[JsonPropertyName("buyRestrictionMax")]
public int? BuyRestrictionMax { get; set; }
+ // Confirmed in client
[JsonPropertyName("buyRestrictionCurrent")]
public int? BuyRestrictionCurrent { get; set; }
diff --git a/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs b/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs
index aed4c9c8..e42f6846 100644
--- a/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs
+++ b/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs
@@ -1,3 +1,4 @@
+using Core.Models.Enums;
using System.Text.Json.Serialization;
namespace Core.Models.Spt.Weather;
@@ -5,7 +6,7 @@ namespace Core.Models.Spt.Weather;
public record GetLocalWeatherResponseData
{
[JsonPropertyName("season")]
- public int? Season { get; set; }
+ public Season? Season { get; set; }
[JsonPropertyName("weather")]
public List? Weather { get; set; }
diff --git a/Libraries/Core/Services/AirdropService.cs b/Libraries/Core/Services/AirdropService.cs
index 1917a8cb..103140d0 100644
--- a/Libraries/Core/Services/AirdropService.cs
+++ b/Libraries/Core/Services/AirdropService.cs
@@ -95,7 +95,7 @@ public class AirdropService(
{
Id = _hashUtil.Generate(),
Template = "", // picked later
- Upd = new Upd()
+ Upd = new Upd
{
SpawnedInSession = true,
StackObjectsCount = 1
diff --git a/Libraries/Core/Services/CircleOfCultistService.cs b/Libraries/Core/Services/CircleOfCultistService.cs
index a232d9c4..1ed9d9d8 100644
--- a/Libraries/Core/Services/CircleOfCultistService.cs
+++ b/Libraries/Core/Services/CircleOfCultistService.cs
@@ -176,7 +176,7 @@ public class CircleOfCultistService(
protected CircleCraftDetails GetCircleCraftingInfo(
double rewardAmountRoubles,
CultistCircleSettings circleConfig,
- DirectRewardSettings directRewardSettings = null
+ DirectRewardSettings? directRewardSettings = null
)
{
var result = new CircleCraftDetails
@@ -580,7 +580,7 @@ public class CircleOfCultistService(
var settings = _hideoutConfig.CultistCircle.CurrencyRewards[itemTpl];
// What % of the pool remaining should be rewarded as chosen currency
- var percentOfPoolToUse = _randomUtil.GetInt((int)settings.Min, (int)settings.Max);
+ var percentOfPoolToUse = _randomUtil.GetDouble(settings.Min.Value, settings.Max.Value);
// Rouble amount of pool we want to reward as currency
var roubleAmountToFill = _randomUtil.GetPercentOfValue(percentOfPoolToUse, rewardPoolRemaining);
@@ -602,7 +602,7 @@ public class CircleOfCultistService(
///
/// Session id
/// Profile of player who will be getting the rewards
- /// Do we return bonus items (hideout/task items)
+ /// Do we return bonus items (hideout/task items)
/// Circle config
/// Array of tpls
protected List GetCultistCircleRewardPool(
diff --git a/Libraries/Core/Services/FenceService.cs b/Libraries/Core/Services/FenceService.cs
index 7f5c3f48..eb0b2f62 100644
--- a/Libraries/Core/Services/FenceService.cs
+++ b/Libraries/Core/Services/FenceService.cs
@@ -157,9 +157,9 @@ public class FenceService(
// We may need to find an alternative to nodes: delete root.location;
root.Location = null;
- var createAssort = new CreateFenceAssortsResult()
+ var createAssort = new CreateFenceAssortsResult
{ SptItems = [], BarterScheme = new Dictionary>>(), LoyalLevelItems = new Dictionary() };
- createAssort.BarterScheme[root.Id] = [[new BarterScheme() { Count = cost, Template = Money.ROUBLES }]];
+ createAssort.BarterScheme[root.Id] = [[new BarterScheme { Count = cost, Template = Money.ROUBLES }]];
createAssort.SptItems.Add(clonedItems);
createAssort.LoyalLevelItems[root.Id] = 1;
@@ -470,7 +470,7 @@ public class FenceService(
var stackSize = rootItemToAdjust.Upd?.StackObjectsCount ?? 1;
// Get a random count of the chosen item to remove if its > 1
- var itemCountToRemove = randomUtil.GetInt(1, (int)stackSize);
+ var itemCountToRemove = randomUtil.GetDouble(1, stackSize);
// Check if we're removing all or just part of the item
var isEntireStackToBeRemoved = Math.Abs(itemCountToRemove - stackSize) < 0.1;
@@ -571,10 +571,10 @@ public class FenceService(
*/
protected void CreateInitialFenceAssortGenerationValues()
{
- var result = new FenceAssortGenerationValues()
+ var result = new FenceAssortGenerationValues
{
- Normal = new GenerationAssortValues() { Item = 0, WeaponPreset = 0, EquipmentPreset = 0 },
- Discount = new GenerationAssortValues() { Item = 0, WeaponPreset = 0, EquipmentPreset = 0 }
+ Normal = new GenerationAssortValues { Item = 0, WeaponPreset = 0, EquipmentPreset = 0 },
+ Discount = new GenerationAssortValues { Item = 0, WeaponPreset = 0, EquipmentPreset = 0 }
};
result.Normal.Item = traderConfig.Fence.AssortSize;
@@ -610,7 +610,7 @@ public class FenceService(
*/
protected TraderAssort CreateFenceAssortSkeleton()
{
- return new TraderAssort()
+ return new TraderAssort
{
Items = [],
BarterScheme = new Dictionary>>(),
@@ -626,7 +626,7 @@ public class FenceService(
*/
protected CreateFenceAssortsResult CreateAssorts(GenerationAssortValues itemCounts, int loyaltyLevel)
{
- var result = new CreateFenceAssortsResult()
+ var result = new CreateFenceAssortsResult
{ SptItems = [], BarterScheme = new Dictionary>>(), LoyalLevelItems = new Dictionary() };
var baseFenceAssortClone = _cloner.Clone(databaseService.GetTrader(Traders.FENCE).Assort);
@@ -960,7 +960,7 @@ public class FenceService(
assorts.BarterScheme[presetWithChildrenClone[0].Id] =
[
[
- new BarterScheme()
+ new BarterScheme
{
Template = Money.ROUBLES,
Count = Math.Round(itemPrice)
@@ -1017,7 +1017,7 @@ public class FenceService(
assorts.BarterScheme[presetWithChildrenClone[0].Id] =
[
[
- new BarterScheme()
+ new BarterScheme
{
Template = Money.ROUBLES,
Count = Math.Round(itemPrice)
@@ -1079,7 +1079,7 @@ public class FenceService(
itemHelper.AddUpdObjectToItem(modItemToAdjust);
if (modItemToAdjust.Upd.Repairable == null)
- modItemToAdjust.Upd.Repairable = new UpdRepairable()
+ modItemToAdjust.Upd.Repairable = new UpdRepairable
{
Durability = modItemDbDetails.Properties.MaxDurability,
MaxDurability = modItemDbDetails.Properties.MaxDurability
@@ -1094,7 +1094,7 @@ public class FenceService(
modItemToAdjust.SlotId == "mod_equipment_000" &&
modItemToAdjust.Upd.Repairable.Durability < modItemDbDetails.Properties.MaxDurability)
// Is damaged
- modItemToAdjust.Upd.FaceShield = new UpdFaceShield() { Hits = randomUtil.GetInt(1, 3) };
+ modItemToAdjust.Upd.FaceShield = new UpdFaceShield { Hits = randomUtil.GetInt(1, 3) };
}
}
@@ -1181,8 +1181,8 @@ public class FenceService(
return itemDbDetails.Properties.StackMaxSize == 1
? 1
: randomUtil.GetInt(
- (int)itemDbDetails.Properties.StackMinRandom,
- (int)itemDbDetails.Properties.StackMaxRandom
+ itemDbDetails.Properties.StackMinRandom.Value,
+ itemDbDetails.Properties.StackMaxRandom.Value
);
}
@@ -1258,7 +1258,7 @@ public class FenceService(
// Randomise hp resource of med items
if (itemDetails.Properties.MaxHpResource != null && (itemDetails.Properties.MaxHpResource ?? 0) > 0)
- itemToAdjust.Upd.MedKit = new UpdMedKit()
+ itemToAdjust.Upd.MedKit = new UpdMedKit
{ HpResource = randomUtil.GetInt(1, (int)itemDetails.Properties.MaxHpResource) };
// Randomise armor durability
@@ -1273,7 +1273,7 @@ public class FenceService(
itemDetails,
traderConfig.Fence.ArmorMaxDurabilityPercentMinMax
);
- itemToAdjust.Upd.Repairable = new UpdRepairable()
+ itemToAdjust.Upd.Repairable = new UpdRepairable
{ Durability = values.Durability, MaxDurability = values.MaxDurability };
return;
@@ -1285,12 +1285,12 @@ public class FenceService(
var weaponDurabilityLimits = traderConfig.Fence.WeaponDurabilityPercentMinMax;
var maxDuraMin = weaponDurabilityLimits.Max.Min / 100 * itemDetails.Properties.MaxDurability;
var maxDuraMax = weaponDurabilityLimits.Max.Max / 100 * itemDetails.Properties.MaxDurability;
- var chosenMaxDurability = randomUtil.GetInt((int)maxDuraMin, (int)maxDuraMax);
+ var chosenMaxDurability = randomUtil.GetDouble(maxDuraMin.Value, maxDuraMax.Value);
var currentDuraMin = weaponDurabilityLimits.Current.Min / 100 * itemDetails.Properties.MaxDurability;
var currentDuraMax = weaponDurabilityLimits.Current.Max / 100 * itemDetails.Properties.MaxDurability;
var currentDurability = Math.Min(
- randomUtil.GetInt((int)currentDuraMin, (int)currentDuraMax),
+ randomUtil.GetDouble(currentDuraMin.Value, currentDuraMax.Value),
chosenMaxDurability
);
@@ -1304,7 +1304,7 @@ public class FenceService(
{
itemToAdjust.Upd.RepairKit = new UpdRepairKit
{
- Resource = randomUtil.GetInt(1, (int)itemDetails.Properties.MaxRepairResource)
+ Resource = randomUtil.GetDouble(1, itemDetails.Properties.MaxRepairResource.Value)
};
return;
@@ -1316,7 +1316,7 @@ public class FenceService(
{
itemToAdjust.Upd.Key = new UpdKey
{
- NumberOfUsages = randomUtil.GetInt(0, (int)itemDetails.Properties.MaximumNumberOfUsage - 1)
+ NumberOfUsages = randomUtil.GetInt(0, itemDetails.Properties.MaximumNumberOfUsage.Value - 1)
};
return;
@@ -1326,7 +1326,7 @@ public class FenceService(
if ((itemDetails.Properties.MaxResource ?? 0) > 0)
{
var resourceMax = itemDetails.Properties.MaxResource;
- var resourceCurrent = randomUtil.GetInt(1, (int)itemDetails.Properties.MaxResource);
+ var resourceCurrent = randomUtil.GetInt(1, itemDetails.Properties.MaxResource.Value);
itemToAdjust.Upd.Resource = new UpdResource
{ Value = resourceMax - resourceCurrent, UnitsConsumed = resourceCurrent };
@@ -1334,9 +1334,9 @@ public class FenceService(
}
/**
- * Generate a randomised current and max durabiltiy value for an armor item
+ * Generate a randomised current and max durability value for an armor item
* @param itemDetails Item to create values for
- * @param equipmentDurabilityLimits Max durabiltiy percent min/max values
+ * @param equipmentDurabilityLimits Max durability percent min/max values
* @returns Durability + MaxDurability values
*/
protected UpdRepairable GetRandomisedArmorDurabilityValues(
@@ -1346,16 +1346,16 @@ public class FenceService(
{
var maxDuraMin = equipmentDurabilityLimits.Max.Min / 100 * itemDetails.Properties.MaxDurability;
var maxDuraMax = equipmentDurabilityLimits.Max.Max / 100 * itemDetails.Properties.MaxDurability;
- var chosenMaxDurability = randomUtil.GetInt((int)maxDuraMin, (int)maxDuraMax);
+ var chosenMaxDurability = randomUtil.GetDouble(maxDuraMin.Value, maxDuraMax.Value);
var currentDuraMin = equipmentDurabilityLimits.Current.Min / 100 * itemDetails.Properties.MaxDurability;
var currentDuraMax = equipmentDurabilityLimits.Current.Max / 100 * itemDetails.Properties.MaxDurability;
var chosenCurrentDurability = Math.Min(
- randomUtil.GetInt((int)currentDuraMin, (int)currentDuraMax),
+ randomUtil.GetDouble(currentDuraMin.Value, currentDuraMax.Value),
chosenMaxDurability
);
- return new UpdRepairable() { Durability = chosenCurrentDurability, MaxDurability = chosenMaxDurability };
+ return new UpdRepairable { Durability = chosenCurrentDurability, MaxDurability = chosenMaxDurability };
}
/**
@@ -1380,8 +1380,8 @@ public class FenceService(
public long GetNextFenceUpdateTimestamp()
{
var time = timeUtil.GetTimeStamp();
- var UpdateSeconds = GetFenceRefreshTime();
- return time + UpdateSeconds;
+ var updateSeconds = GetFenceRefreshTime();
+ return time + updateSeconds;
}
/**
diff --git a/Libraries/Core/Services/InsuranceService.cs b/Libraries/Core/Services/InsuranceService.cs
index 6e2dcab5..4abd00b9 100644
--- a/Libraries/Core/Services/InsuranceService.cs
+++ b/Libraries/Core/Services/InsuranceService.cs
@@ -1,4 +1,4 @@
-using Core.Helpers;
+using Core.Helpers;
using SptCommon.Annotations;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
@@ -162,7 +162,7 @@ public class InsuranceService(
var traderMinReturnAsSeconds = trader.Insurance.MinReturnHour * TimeUtil.OneHourAsSeconds;
var traderMaxReturnAsSeconds = trader.Insurance.MaxReturnHour * TimeUtil.OneHourAsSeconds;
- var randomisedReturnTimeSeconds = _randomUtil.GetInt((int)traderMinReturnAsSeconds, (int)traderMaxReturnAsSeconds);
+ var randomisedReturnTimeSeconds = _randomUtil.GetDouble(traderMinReturnAsSeconds.Value, traderMaxReturnAsSeconds.Value);
// Check for Mark of The Unheard in players special slots (only slot item can fit)
var globals = _databaseService.GetGlobals();
@@ -173,14 +173,14 @@ public class InsuranceService(
);
if (hasMarkOfUnheard)
// Reduce return time by globals multipler value
- randomisedReturnTimeSeconds *= (int)globals.Configuration.Insurance.CoefOfHavingMarkOfUnknown;
+ randomisedReturnTimeSeconds *= globals.Configuration.Insurance.CoefOfHavingMarkOfUnknown.Value;
// EoD has 30% faster returns
var editionModifier = globals.Configuration.Insurance.EditionSendingMessageTime[pmcData.Info.GameVersion];
- if (editionModifier is not null) randomisedReturnTimeSeconds *= (int)editionModifier.Multiplier;
+ if (editionModifier is not null) randomisedReturnTimeSeconds *= editionModifier.Multiplier.Value;
// Calculate the final return time based on our bonus percent
- var finalReturnTimeSeconds = randomisedReturnTimeSeconds * (1.0 - insuranceReturnTimeBonusPercent);
+ var finalReturnTimeSeconds = randomisedReturnTimeSeconds * (1d - insuranceReturnTimeBonusPercent);
return _timeUtil.GetTimeStamp() + finalReturnTimeSeconds;
}
diff --git a/Libraries/Core/Services/LocationLifecycleService.cs b/Libraries/Core/Services/LocationLifecycleService.cs
index baf8fc46..6520a7e0 100644
--- a/Libraries/Core/Services/LocationLifecycleService.cs
+++ b/Libraries/Core/Services/LocationLifecycleService.cs
@@ -530,6 +530,8 @@ public class LocationLifecycleService
_traderHelper.LevelUp(fenceId, pmcData);
pmcData.TradersInfo[fenceId].LoyaltyLevel = Math.Max((int)pmcData.TradersInfo[fenceId].LoyaltyLevel, 1);
+ _logger.Debug($"COOP extract: {extractName} used");
+
// Copy updated fence rep values into scav profile to ensure consistency
var scavData = _profileHelper.GetScavProfile(sessionId);
scavData.TradersInfo[fenceId].Standing = pmcData.TradersInfo[fenceId].Standing;
@@ -1004,7 +1006,7 @@ public class LocationLifecycleService
MessageType.BTR_ITEMS_DELIVERY,
messageId,
items,
- (int)messageStoreTime
+ messageStoreTime
);
}
diff --git a/Libraries/Core/Services/MailSendService.cs b/Libraries/Core/Services/MailSendService.cs
index 5e446815..c7909ee6 100644
--- a/Libraries/Core/Services/MailSendService.cs
+++ b/Libraries/Core/Services/MailSendService.cs
@@ -81,7 +81,7 @@ public class MailSendService(
if (items?.Count > 0)
{
details.Items.AddRange(items);
- details.ItemsMaxStorageLifetimeSeconds = (long?)maxStorageTimeSeconds;
+ details.ItemsMaxStorageLifetimeSeconds = maxStorageTimeSeconds;
}
if (systemData is not null)
diff --git a/Libraries/Core/Services/PaymentService.cs b/Libraries/Core/Services/PaymentService.cs
index 44e9bf4f..5edea5da 100644
--- a/Libraries/Core/Services/PaymentService.cs
+++ b/Libraries/Core/Services/PaymentService.cs
@@ -82,7 +82,7 @@ public class PaymentService(
}
// Track the total amount of all currencies.
- var totalCurrencyAmount = 0;
+ var totalCurrencyAmount = 0d;
// Loop through each type of currency involved in the trade.
foreach (var currencyTpl in currencyAmounts)
@@ -90,10 +90,10 @@ public class PaymentService(
if (currencyTpl.Value <= 0) continue;
var currencyAmount = currencyTpl.Value;
- totalCurrencyAmount += (int)currencyAmount;
+ totalCurrencyAmount += currencyAmount.Value;
// Find money stacks in inventory and remove amount needed + update output object to inform client of changes
- AddPaymentToOutput(pmcData, currencyTpl.Key, (int)currencyAmount, sessionID, output);
+ AddPaymentToOutput(pmcData, currencyTpl.Key, currencyAmount.Value, sessionID, output);
// If there are warnings, exit early.
if (output.Warnings?.Count > 0) return;
@@ -255,8 +255,8 @@ public class PaymentService(
foreach (var moneyStack in moneyItemsInInventory) moneyStack.Upd ??= new Upd { StackObjectsCount = 1 };
var amountAvailable = moneyItemsInInventory.Aggregate(
- 0,
- (accumulator, item) => (int)(accumulator + item.Upd.StackObjectsCount)
+ 0d,
+ (accumulator, item) => (accumulator + item.Upd.StackObjectsCount.Value)
);
// If no money in inventory or amount is not enough we return false
@@ -264,7 +264,7 @@ public class PaymentService(
{
_logger.Error(
_localisationService.GetText(
- "payment-not_enough_money_to_complete_transation",
+ "payment-not_enough_money_to_complete_transation", // Typo, needs locale updated if fixed
new
{
amountToPay = amountToPay,
@@ -274,7 +274,7 @@ public class PaymentService(
);
_httpResponseUtil.AppendErrorToOutput(
output,
- _localisationService.GetText("payment-not_enough_money_to_complete_transation_short", amountToPay),
+ _localisationService.GetText("payment-not_enough_money_to_complete_transation_short", amountToPay), // Typo, needs locale updated if fixed
BackendErrorCodes.UnknownTradingError
);
diff --git a/Libraries/Core/Services/TraderPurchasePersisterService.cs b/Libraries/Core/Services/TraderPurchasePersisterService.cs
index 17bce8f1..0b3f43f7 100644
--- a/Libraries/Core/Services/TraderPurchasePersisterService.cs
+++ b/Libraries/Core/Services/TraderPurchasePersisterService.cs
@@ -121,7 +121,7 @@ public class TraderPurchasePersisterService(
var purchaseDetails = purchaseKvP.Value;
var resetTimeForItem =
purchaseDetails.PurchaseTimestamp +
- _randomUtil.GetInt((int)traderUpdateDetails.Seconds.Min, (int)traderUpdateDetails.Seconds.Max);
+ _randomUtil.GetDouble(traderUpdateDetails.Seconds.Min.Value, traderUpdateDetails.Seconds.Max.Value);
if (resetTimeForItem < _timeUtil.GetTimeStamp())
{
// Item was purchased far enough in past a trader refresh would have occured, remove purchase record from profile
diff --git a/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs b/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs
index f5ea79ea..2bfaded4 100644
--- a/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs
+++ b/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs
@@ -173,7 +173,7 @@ public class ProbabilityObjectArray : List>
for (var i = 0; i < drawCount; i++)
{
var rand = Random.Shared.NextDouble();
- var randomIndex = (int)probCumsum.FindIndex((x) => x > rand);
+ var randomIndex = probCumsum.FindIndex((x) => x > rand);
// We cannot put Math.random() directly in the findIndex because then it draws anew for each of its iteration
if (removeAfterDraw || neverRemoveWhitelist.Contains(totals.keyArray[randomIndex]))
{
diff --git a/Libraries/Core/Utils/RandomUtil.cs b/Libraries/Core/Utils/RandomUtil.cs
index d943a5d7..a2c5065a 100644
--- a/Libraries/Core/Utils/RandomUtil.cs
+++ b/Libraries/Core/Utils/RandomUtil.cs
@@ -1,4 +1,3 @@
-using System.Security.Cryptography;
using SptCommon.Annotations;
using Core.Models.Utils;
using Core.Utils.Cloners;