From 60b658c6f6e4596e359e47aa75da1b3d1f32bf91 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 3 Nov 2023 16:44:15 +0000 Subject: [PATCH 1/5] Correct pmc response to ensure consistency with meme-lore --- project/assets/database/locales/server/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/assets/database/locales/server/en.json b/project/assets/database/locales/server/en.json index c3c5cc30..7b19373e 100644 --- a/project/assets/database/locales/server/en.json +++ b/project/assets/database/locales/server/en.json @@ -275,7 +275,7 @@ "pmcresponse-victim_positive_12": "Good kill, I'll get you next time", "pmcresponse-victim_positive_13": "You had good angles on me", "pmcresponse-victim_positive_14": "I'll get you next time", - "pmcresponse-victim_positive_15": "You really binted my bingos", + "pmcresponse-victim_positive_15": "You really binted my bogos :alien:", "pmcresponse-victim_positive_16": "You're a stone-cold killer. I didn't stand a chance", "pmcresponse-victim_positive_17": "Alright fair that was a good shot", "pmcresponse-victim_positive_18": "Enjoy my loot", From b808850e7e920163419c0b0572af19da636f60fc Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 3 Nov 2023 17:15:42 +0000 Subject: [PATCH 2/5] Remove duplicate mod_magazine key --- project/assets/configs/bot.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index f6f6541a..2d1bfec4 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -856,8 +856,7 @@ "mod_reciever": ["5d4405aaa4b9361e6a4e6bd3"], "mod_stock": ["5cde739cd7f00c0010373bd3"], "mod_rear_sight": ["5a0ed824fcdbcb0176308b0d"], - "mod_front_sight": ["5a0f096dfcdbcb0176308b15"], - "mod_magazine": ["6241c2c2117ad530666a5108"] + "mod_front_sight": ["5a0f096dfcdbcb0176308b15"] }, "cartridge": { "Caliber23x75": ["5e85a9f4add9fe03027d9bf1"], From 93209e4a76e955c66c18ec54329f1eb29b69d11d Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 3 Nov 2023 17:40:00 +0000 Subject: [PATCH 3/5] Add config option to force stock to spawn on a bot during weapon generation Enable it for various bot types (most bosses/raiders) --- project/assets/configs/bot.json | 29 +++++++++++++------ .../generators/BotEquipmentModGenerator.ts | 8 +++-- project/src/models/spt/config/IBotConfig.ts | 2 ++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index 2d1bfec4..0dd12781 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -432,7 +432,8 @@ "faceShieldIsActiveChancePercent": 100, "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 75, - "laserIsActiveChancePercent": 75 + "laserIsActiveChancePercent": 75, + "forceStock": true }, "bossgluhar": { "nvgIsActiveChanceDayPercent": 10, @@ -440,13 +441,15 @@ "faceShieldIsActiveChancePercent": 100, "lightIsActiveDayChancePercent": 45, "lightIsActiveNightChancePercent": 95, - "laserIsActiveChancePercent": 95 + "laserIsActiveChancePercent": 95, + "forceStock": true }, "bosskilla": { "faceShieldIsActiveChancePercent": 100, "lightIsActiveDayChancePercent": 35, "lightIsActiveNightChancePercent": 85, - "laserIsActiveChancePercent": 85 + "laserIsActiveChancePercent": 85, + "forceStock": true }, "bosskojaniy": { "faceShieldIsActiveChancePercent": 100, @@ -468,7 +471,8 @@ "faceShieldIsActiveChancePercent": 100, "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 75, - "laserIsActiveChancePercent": 75 + "laserIsActiveChancePercent": 75, + "forceStock": true }, "bossknight": { "nvgIsActiveChanceDayPercent": 10, @@ -476,21 +480,24 @@ "faceShieldIsActiveChancePercent": 100, "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 75, - "laserIsActiveChancePercent": 75 + "laserIsActiveChancePercent": 75, + "forceStock": true }, "bosszryachiy": { "nvgIsActiveChanceDayPercent": 10, "nvgIsActiveChanceNightPercent": 90, "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 85, - "laserIsActiveChancePercent": 85 + "laserIsActiveChancePercent": 85, + "forceStock": true }, "bossboar": { "nvgIsActiveChanceDayPercent": 10, "nvgIsActiveChanceNightPercent": 90, "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 85, - "laserIsActiveChancePercent": 85 + "laserIsActiveChancePercent": 85, + "forceStock": true }, "bosstest": {}, "followerbully": { @@ -547,6 +554,7 @@ "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 75, "laserIsActiveChancePercent": 75, + "forceStock": true, "weaponModLimits": { "scopeLimit": 1, "lightLaserLimit": 1 @@ -558,7 +566,8 @@ "faceShieldIsActiveChancePercent": 100, "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 75, - "laserIsActiveChancePercent": 75 + "laserIsActiveChancePercent": 75, + "forceStock": true }, "followerzryachiy": { "nvgIsActiveChanceDayPercent": 10, @@ -586,6 +595,7 @@ "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 75, "laserIsActiveChancePercent": 75, + "forceStock": true, "weaponModLimits": { "scopeLimit": 2, "lightLaserLimit": 1 @@ -616,6 +626,7 @@ "lightIsActiveDayChancePercent": 35, "lightIsActiveNightChancePercent": 95, "laserIsActiveChancePercent": 95, + "forceStock": true, "weaponModLimits": { "scopeLimit": 1, "lightLaserLimit": 1 @@ -780,7 +791,7 @@ "Backpack": 35, "FaceCover": 5 }, - "randomisedWeaponModSlots": [], + "randomisedWeaponModSlots": [], "mods": { "mod_barrel": 20, "mod_bipod": 10, diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index 673710a1..4de2393b 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -273,11 +273,13 @@ export class BotEquipmentModGenerator modSpawnChances.mod_handguard = 100; } - // If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure stock gets added - if (modSlot === "mod_stock" && modToAddTemplate._props.Slots.find(x => x._name.includes("mod_stock"))) + // If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure sub-stock gets added + // Or if mod_stock is configured to be forced on + if (modSlot === "mod_stock" && (modToAddTemplate._props.Slots.find(x => x._name.includes("mod_stock") || botEquipConfig.forceStock))) { // Stock mod can take additional stocks, could be a locking device, force 100% chance - modSpawnChances.mod_stock = 100; + const stockSlots = ["mod_stock", "mod_stock_000", "mod_stock_akms"]; + this.adjustSlotSpawnChances(modSpawnChances, stockSlots, 100); } const modId = this.hashUtil.generate(); diff --git a/project/src/models/spt/config/IBotConfig.ts b/project/src/models/spt/config/IBotConfig.ts index 7f1edbb5..035fa869 100644 --- a/project/src/models/spt/config/IBotConfig.ts +++ b/project/src/models/spt/config/IBotConfig.ts @@ -110,6 +110,8 @@ export interface EquipmentFilters weightingAdjustmentsByBotLevel: WeightingAdjustmentDetails[] /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[] + /** Should the stock mod be forced to spawn on bot */ + forceStock: boolean } export interface ModLimits From 432f77851296ef7e643736e75e99c392745b3177 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 4 Nov 2023 09:08:33 +0000 Subject: [PATCH 4/5] Make `randomiseAmmoStackSize()` and `randomiseMoneyStackSize()` not purge the entire upd object Always randomise the ammo stack size, not only if it doesnt have one --- project/src/generators/BotLootGenerator.ts | 52 +++++++++++----------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index d8bfac83..e3b6594f 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -333,7 +333,7 @@ export class BotLootGenerator { this.itemHelper.addCartridgesToAmmoBox(itemsToAdd, itemToAddTemplate); } - // make money a stack + // Make money a stack else if (this.itemHelper.isOfBaseclass(itemToAddTemplate._id, BaseClasses.MONEY)) { this.randomiseMoneyStackSize(isPmc, itemToAddTemplate, itemsToAdd[0]); @@ -374,14 +374,13 @@ export class BotLootGenerator } } - /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to * @param equipmentSlot slot to place the preset in (backpack) * @param templateInventory bots template, assault.json * @param modChances chances for mods to spawn on weapon - * @param botRole bots role, .e.g. pmcBot + * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void @@ -498,42 +497,45 @@ export class BotLootGenerator /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc is this a PMC - * @param itemTemplate item details - * @param moneyItem Money stack to randomise + * @param isPmc Is money on a PMC bot + * @param itemTemplate item details from db + * @param moneyItem Money item to randomise */ protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void { - // Only add if no upd or stack objects exist - preserves existing stack count - if (!moneyItem.upd?.StackObjectsCount) - { - // PMCs have a different stack max size - const minStackSize = itemTemplate._props.StackMinRandom; - const maxStackSize = (isPmc) - ? this.pmcConfig.dynamicLoot.moneyStackLimits[itemTemplate._id] - : itemTemplate._props.StackMaxRandom; + // PMCs have a different stack max size + const minStackSize = itemTemplate._props.StackMinRandom; + const maxStackSize = (isPmc) + ? this.pmcConfig.dynamicLoot.moneyStackLimits[itemTemplate._id] + : itemTemplate._props.StackMaxRandom; + const randomSize = this.randomUtil.getInt(minStackSize, maxStackSize); - moneyItem.upd = { "StackObjectsCount": this.randomUtil.getInt(minStackSize, maxStackSize) }; + if (!moneyItem.upd) + { + moneyItem.upd = {}; } + + moneyItem.upd.StackObjectsCount = randomSize; } /** * Randomise the size of an ammo stack - * @param isPmc is this a PMC - * @param itemTemplate item details - * @param ammoItem Ammo stack to randomise + * @param isPmc Is ammo on a PMC bot + * @param itemTemplate item details from db + * @param ammoItem Ammo item to randomise */ protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void { - // only add if no upd or stack objects exist - preserves existing stack count - if (!ammoItem.upd?.StackObjectsCount) - { - const randomSize = itemTemplate._props.StackMaxSize === 1 - ? 1 - : this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); + const randomSize = itemTemplate._props.StackMaxSize === 1 + ? 1 + : this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); - ammoItem.upd = { StackObjectsCount: randomSize }; + if (!ammoItem.upd) + { + ammoItem.upd = {}; } + + ammoItem.upd.StackObjectsCount = randomSize ; } /** From ab01e42271c8bcfa0ce0138088537f30e487c98f Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 4 Nov 2023 10:28:33 +0000 Subject: [PATCH 5/5] Call `getDynamicItemPrice()` correctly inside `getItemPrice()` --- project/src/helpers/ItemHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index ccc6357f..3cb0d8ab 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -115,7 +115,7 @@ class ItemHelper return handbookPrice; } - const dynamicPrice = this.getDynamicItemPrice[tpl]; + const dynamicPrice = this.getDynamicItemPrice(tpl); if (dynamicPrice) { return dynamicPrice;