make stackCount an int

This commit is contained in:
CWX
2025-01-18 22:58:22 +00:00
parent bea2d1799c
commit 4f32268c02
6 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -596,7 +596,7 @@ public class BotLootGenerator(
ParentId = walletId,
Upd = new()
{
StackObjectsCount = double.Parse(chosenStackCount)
StackObjectsCount = int.Parse(chosenStackCount)
}
}
];
@@ -799,7 +799,7 @@ public class BotLootGenerator(
_itemHelper.AddUpdObjectToItem(moneyItem);
moneyItem.Upd.StackObjectsCount = double.Parse(_weightedRandomHelper.GetWeightedValue(currencyWeight));
moneyItem.Upd.StackObjectsCount = int.Parse(_weightedRandomHelper.GetWeightedValue(currencyWeight));
}
/// <summary>
+1 -1
View File
@@ -483,7 +483,7 @@ public class BotWeaponGenerator(
/// <param name="ammoTpl">Ammo type to add.</param>
/// <param name="stackSize">Size of the ammo stack to add.</param>
/// <param name="inventory">Player inventory.</param>
protected void AddAmmoToSecureContainer(int stackCount, string ammoTemplate, double stackSize, BotBaseInventory inventory)
protected void AddAmmoToSecureContainer(int stackCount, string ammoTemplate, int stackSize, BotBaseInventory inventory)
{
for (var i = 0; i < stackCount; i++)
{
+8 -8
View File
@@ -1325,7 +1325,7 @@ public class ItemHelper(
var cartridgeItemToAdd = CreateCartridges(
ammoBox[0].Id,
cartridgeTpl,
cartridgeCountToAdd ?? 0,
(int)cartridgeCountToAdd,
location,
ammoBox[0].Upd?.SpawnedInSession ?? false
);
@@ -1350,13 +1350,13 @@ public class ItemHelper(
*/
public void AddSingleStackCartridgesToAmmoBox(List<Item> ammoBox, TemplateItem ammoBoxDetails)
{
var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties.StackSlots[0].MaxCount;
var cartridgeTpl = ammoBoxDetails.Properties.StackSlots[0].Props.Filters[0].Filter[0];
var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties?.StackSlots?[0].MaxCount ?? 0;
var cartridgeTpl = ammoBoxDetails.Properties?.StackSlots?[0].Props?.Filters?[0].Filter?[0];
ammoBox.Add(
CreateCartridges(
ammoBox[0].Id,
cartridgeTpl,
ammoBoxMaxCartridgeCount ?? 0,
(int)ammoBoxMaxCartridgeCount,
0,
ammoBox[0].Upd?.SpawnedInSession ?? false
)
@@ -1495,7 +1495,7 @@ public class ItemHelper(
var remainingSpace = desiredStackCount - currentStoredCartridgeCount;
if (cartridgeCountToAdd > remainingSpace)
{
cartridgeCountToAdd = remainingSpace;
cartridgeCountToAdd = (int)remainingSpace;
}
// Add cartridge item object into items array
@@ -1603,8 +1603,8 @@ public class ItemHelper(
/// <returns>Item</returns>
public Item CreateCartridges(
string parentId,
string ammoTpl,
double stackCount,
string? ammoTpl,
int? stackCount,
double location,
bool foundInRaid = false
)
@@ -1612,7 +1612,7 @@ public class ItemHelper(
return new()
{
Id = _hashUtil.Generate(),
Template = ammoTpl,
Template = ammoTpl!,
ParentId = parentId,
SlotId = "cartridges",
Location = location,
+1 -1
View File
@@ -352,7 +352,7 @@ public class QuestHelper(
public void ChangeItemStack(
PmcData pmcData,
string itemId,
double newStackSize,
int newStackSize,
string sessionID,
ItemEventRouterResponse output)
{
+2 -2
View File
@@ -226,7 +226,7 @@ public class QuestRewardHelper(
*/
public Quest ApplyMoneyBoost(Quest quest, double bonusPercent, QuestStatusEnum questStatus)
{
var rewards = (List<Reward>)quest?.Rewards.GetType()
var rewards = (List<Reward>)quest.Rewards.GetType()
.GetProperties()
.FirstOrDefault(p => p.Name == questStatus.ToString())
.GetValue(quest.Rewards) ??
@@ -241,7 +241,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 = newCurrencyAmount;
rewardItem.Upd.StackObjectsCount = (int)newCurrencyAmount;
reward.Value = newCurrencyAmount;
}
@@ -63,7 +63,7 @@ public record Props
public double? Height { get; set; }
[JsonPropertyName("StackMaxSize")]
public double? StackMaxSize { get; set; }
public int? StackMaxSize { get; set; }
[JsonPropertyName("Rarity")]
public string? Rarity { get; set; }