From 1098a9d869396064f2686c7238521de384151737 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 10 Mar 2024 14:13:08 +0000 Subject: [PATCH] Fixed wallets not having money stacks in them Increased chance of money in wallets some lint fixes --- project/assets/configs/bot.json | 2 +- project/src/generators/BotLootGenerator.ts | 7 ++++--- project/src/helpers/InventoryHelper.ts | 10 ++++++++-- project/src/services/LocaleService.ts | 2 +- project/src/services/ProfileFixerService.ts | 4 +++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index 03b38bd8..d5b2ac55 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -2498,7 +2498,7 @@ "default": 16 }, "walletLoot": { - "chancePercent": 35, + "chancePercent": 45, "itemCount": { "min": 1, "max": 3 diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index d056b258..c7ef731e 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -403,7 +403,7 @@ export class BotLootGenerator ...this.botGeneratorHelper.generateExtraPropertiesForItem(itemToAddTemplate, botRole), }]; - // Is Simple-Wallet + // Is Simple-Wallet / WZ wallet if (this.botConfig.walletLoot.walletTplPool.includes(weightedItemTpl)) { const addCurrencyToWallet = this.randomUtil.getChance100(this.botConfig.walletLoot.chancePercent); @@ -429,14 +429,15 @@ export class BotLootGenerator containerGrid, itemToAdd, itemWithChildrenToAdd[0]._id, + "main", ); } - itemWithChildrenToAdd.push(...itemsToAdd.flatMap((x) => x)); + itemWithChildrenToAdd.push(...itemsToAdd.flatMap((moneyStack) => moneyStack)); } } } - + // Some items (ammBox/ammo) need extra changes this.addRequiredChildItemsToParent(itemToAddTemplate, itemWithChildrenToAdd, isPmc, botRole); // Attempt to add item to container(s) diff --git a/project/src/helpers/InventoryHelper.ts b/project/src/helpers/InventoryHelper.ts index 64da9edc..d1752992 100644 --- a/project/src/helpers/InventoryHelper.ts +++ b/project/src/helpers/InventoryHelper.ts @@ -324,8 +324,14 @@ export class InventoryHelper * @param containerFS2D Container grid to add item to * @param itemWithChildren Item to add to grid * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" */ - public placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string): void + public placeItemInContainer( + containerFS2D: number[][], + itemWithChildren: Item[], + containerId: string, + desiredSlotId = "hideout", + ): void { // Get x/y size of item const rootItemAdded = itemWithChildren[0]; @@ -355,7 +361,7 @@ export class InventoryHelper } // Store details for object, incuding container item will be placed in rootItemAdded.parentId = containerId; - rootItemAdded.slotId = "hideout"; + rootItemAdded.slotId = desiredSlotId; rootItemAdded.location = { x: findSlotResult.x, y: findSlotResult.y, diff --git a/project/src/services/LocaleService.ts b/project/src/services/LocaleService.ts index 40abff69..685b3d26 100644 --- a/project/src/services/LocaleService.ts +++ b/project/src/services/LocaleService.ts @@ -149,7 +149,7 @@ export class LocaleService return "cz"; } - // BSG map De to GE some reason + // BSG map DE to GE some reason if (platformLocale.language === "de") { return "ge"; diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 2aa3e4d6..8095ec14 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -867,7 +867,9 @@ export class ProfileFixerService // Get items placed in root of stash // TODO: extend to other areas / sub items - const inventoryItemsToCheck = pmcProfile.Inventory.items.filter((x) => ["hideout", "main"].includes(x.slotId)); + const inventoryItemsToCheck = pmcProfile.Inventory.items.filter((item) => + ["hideout", "main"].includes(item.slotId) + ); if (!inventoryItemsToCheck) { return;