diff --git a/project/assets/configs/hideout.json b/project/assets/configs/hideout.json index a4d9d652..2e6ae009 100644 --- a/project/assets/configs/hideout.json +++ b/project/assets/configs/hideout.json @@ -207,5 +207,139 @@ "5696686a4bdc2da3298b456a": { "min": 20, "max": 50 }, "5d235b4d86f7742e017bc88a": { "min": 20, "max": 40 } } - } + }, + "hideoutCraftsToAdd": [ + { + "craftIdToCopy": "66582be04de4820934746cea", + "craftOutputTpl": "665829424de4820934746ce6", + "requirements": [ + { + "templateId": "5c07df7f0db834001b73588a", + "type": "Tool" + }, + { + "templateId": "544fb5454bdc2df8738b456a", + "type": "Tool" + }, + { + "templateId": "66582889efd94e2d665b14a2", + "count": 1, + "isFunctional": false, + "isEncoded": false, + "isSpawnedInSession": false, + "type": "Item" + } + ] + }, + { + "craftIdToCopy": "66582be04de4820934746cea", + "craftOutputTpl": "6658291eefd94e2d665b14a4", + "requirements": [ + { + "templateId": "5c07df7f0db834001b73588a", + "type": "Tool" + }, + { + "templateId": "544fb5454bdc2df8738b456a", + "type": "Tool" + }, + { + "templateId": "6658285190486915542256c4", + "count": 1, + "isFunctional": false, + "isEncoded": false, + "isSpawnedInSession": false, + "type": "Item" + } + ] + }, + { + "craftIdToCopy": "66582be04de4820934746cea", + "craftOutputTpl": "665829a6efd94e2d665b14a8", + "requirements": [ + { + "templateId": "5c07df7f0db834001b73588a", + "type": "Tool" + }, + { + "templateId": "544fb5454bdc2df8738b456a", + "type": "Tool" + }, + { + "templateId": "665828f490486915542256c6", + "count": 1, + "isFunctional": false, + "isEncoded": false, + "isSpawnedInSession": false, + "type": "Item" + } + ] + }, + { + "craftIdToCopy": "66582be04de4820934746cea", + "craftOutputTpl": "665886abdaadd1069736c539", + "requirements": [ + { + "templateId": "5c07df7f0db834001b73588a", + "type": "Tool" + }, + { + "templateId": "544fb5454bdc2df8738b456a", + "type": "Tool" + }, + { + "templateId": "66588bb047fbd536a674240e", + "count": 1, + "isFunctional": false, + "isEncoded": false, + "isSpawnedInSession": false, + "type": "Item" + } + ] + }, + { + "craftIdToCopy": "66582be04de4820934746cea", + "craftOutputTpl": "6658876e146af22739040fad", + "requirements": [ + { + "templateId": "5c07df7f0db834001b73588a", + "type": "Tool" + }, + { + "templateId": "544fb5454bdc2df8738b456a", + "type": "Tool" + }, + { + "templateId": "66588b514de4820934746dc6", + "count": 1, + "isFunctional": false, + "isEncoded": false, + "isSpawnedInSession": false, + "type": "Item" + } + ] + }, + { + "craftIdToCopy": "66582be04de4820934746cea", + "craftOutputTpl": "6658892e6e007c6f33662002", + "requirements": [ + { + "templateId": "5c07df7f0db834001b73588a", + "type": "Tool" + }, + { + "templateId": "544fb5454bdc2df8738b456a", + "type": "Tool" + }, + { + "templateId": "66588ba291f6e93c4c06efef", + "count": 1, + "isFunctional": false, + "isEncoded": false, + "isSpawnedInSession": false, + "type": "Item" + } + ] + } + ] } diff --git a/project/src/models/spt/config/IHideoutConfig.ts b/project/src/models/spt/config/IHideoutConfig.ts index 01349c79..00d2f76a 100644 --- a/project/src/models/spt/config/IHideoutConfig.ts +++ b/project/src/models/spt/config/IHideoutConfig.ts @@ -1,4 +1,5 @@ import { MinMax } from "@spt/models/common/MinMax"; +import { IRequirement } from "@spt/models/eft/hideout/IHideoutProduction"; import { IBaseConfig, IRunIntervalValues } from "@spt/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { @@ -14,6 +15,13 @@ export interface IHideoutConfig extends IBaseConfig { /** Only process a profiles hideout crafts when it has been active in the last x minutes */ updateProfileHideoutWhenActiveWithinMinutes: number; cultistCircle: ICultistCircleSettings; + hideoutCraftsToAdd: IHIdeoutCraftToAdd[]; +} + +export interface IHIdeoutCraftToAdd { + requirements: IRequirement[]; + craftIdToCopy: string; + craftOutputTpl: string; } export interface ICultistCircleSettings { diff --git a/project/src/services/PostDbLoadService.ts b/project/src/services/PostDbLoadService.ts index e43eb84a..afbe1e78 100644 --- a/project/src/services/PostDbLoadService.ts +++ b/project/src/services/PostDbLoadService.ts @@ -19,12 +19,14 @@ import { ItemBaseClassService } from "@spt/services/ItemBaseClassService"; import { LocalisationService } from "@spt/services/LocalisationService"; import { OpenZoneService } from "@spt/services/OpenZoneService"; import { SeasonalEventService } from "@spt/services/SeasonalEventService"; +import { HashUtil } from "@spt/utils/HashUtil"; import type { ICloner } from "@spt/utils/cloners/ICloner"; import { inject, injectable } from "tsyringe"; @injectable() export class PostDbLoadService { protected coreConfig: ICoreConfig; + protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; protected hideoutConfig: IHideoutConfig; @@ -35,6 +37,7 @@ export class PostDbLoadService { constructor( @inject("PrimaryLogger") protected logger: ILogger, + @inject("HashUtil") protected hashUtil: HashUtil, @inject("DatabaseService") protected databaseService: DatabaseService, @inject("LocalisationService") protected localisationService: LocalisationService, @inject("CustomLocationWaveService") protected customLocationWaveService: CustomLocationWaveService, @@ -105,6 +108,10 @@ export class PostDbLoadService { this.adjustHideoutCraftTimes(this.hideoutConfig.overrideCraftTimeSeconds); this.adjustHideoutBuildTimes(this.hideoutConfig.overrideBuildTimeSeconds); + this.unlockHideoutLootCrateCrafts(); + + this.cloneExistingCraftsAndAddNew(); + this.removePraporTestMessage(); this.validateQuestAssortUnlocksExist(); @@ -125,6 +132,36 @@ export class PostDbLoadService { this.addCustomItemPresetsToGlobals(); } + protected unlockHideoutLootCrateCrafts() { + const hideoutLootBoxCraftIds = [ + "66582be04de4820934746cea", + "6745925da9c9adf0450d5bca", + "67449c79268737ef6908d636", + ]; + + for (const craftId of hideoutLootBoxCraftIds) { + const recipe = this.databaseService.getHideout().production.recipes.find((craft) => craft._id === craftId); + if (recipe) { + recipe.locked = false; + } + } + } + + protected cloneExistingCraftsAndAddNew() { + const hideoutCraftDb = this.databaseService.getHideout().production; + const craftsToAdd = this.hideoutConfig.hideoutCraftsToAdd; + for (const craftToAdd of craftsToAdd) { + const clonedCraft = this.cloner.clone( + hideoutCraftDb.recipes.find((x) => x._id === craftToAdd.craftIdToCopy), + ); + clonedCraft._id = this.hashUtil.generate(); + clonedCraft.requirements = craftToAdd.requirements; + clonedCraft.endProduct = craftToAdd.craftOutputTpl; + + hideoutCraftDb.recipes.push(clonedCraft); + } + } + protected adjustMinReserveRaiderSpawnChance(): void { // Get reserve base.json const reserveBase = this.databaseService.getLocation(ELocationName.RESERVE).base;