Removed unnecessary ??

This commit is contained in:
Chomp
2025-07-25 20:09:07 +01:00
parent 8a7690e13b
commit b1aa8f0942
4 changed files with 7 additions and 7 deletions
@@ -506,7 +506,7 @@ public class BotInventoryGenerator(
}
// Roll dice on equipment item
var shouldSpawn = randomUtil.GetChance100(spawnChance ?? 0);
var shouldSpawn = randomUtil.GetChance100(spawnChance.Value);
if (shouldSpawn && settings.RootEquipmentPool.Any())
{
TemplateItem? pickedItemDb = null;
@@ -804,9 +804,9 @@ public class ItemHelper(
return rootAndChildren;
}
while (remainingCount.Value != 0)
while (remainingCount > 0)
{
var amount = Math.Min(remainingCount ?? 0, maxStackSize ?? 0);
var amount = Math.Min(remainingCount.Value, maxStackSize ?? 0);
var newStackClone = cloner.Clone(itemToSplit);
newStackClone.Id = new MongoId();
@@ -845,13 +845,13 @@ public class ItemHelper(
return result;
}
while (remainingCount.Value != 0)
while (remainingCount > 0)
{
// Clone item and make IDs unique
var itemWithChildrenClone = cloner.Clone(itemWithChildren).ReplaceIDs().ToList();
// Set stack count to new value
var amount = Math.Min(remainingCount ?? 0, maxStackSize ?? 0);
var amount = Math.Min(remainingCount.Value, maxStackSize ?? 0);
itemWithChildrenClone[0].Upd.StackObjectsCount = amount;
remainingCount -= amount;
result.Add(itemWithChildrenClone);
@@ -245,7 +245,7 @@ public class TradeHelper(
{
var offerClone = cloner.Clone(offerItems);
// Handle stackable items that have a max stack size limit
var itemCountToSend = Math.Min(itemMaxStackSize ?? 0, itemsToSendRemaining ?? 0);
var itemCountToSend = Math.Min(itemMaxStackSize ?? 0, itemsToSendRemaining.Value);
offerClone.FirstOrDefault().Upd.StackObjectsCount = itemCountToSend;
// Prevent any collisions
@@ -356,7 +356,7 @@ public class PaymentService(
var itemAmount = profileMoneyItem.Upd.StackObjectsCount;
if (leftToPay >= itemAmount)
{
leftToPay -= itemAmount ?? 0;
leftToPay -= itemAmount.Value;
inventoryHelper.RemoveItem(pmcData, profileMoneyItem.Id, sessionID, output);
}
else