mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 05:50:44 -05:00
Added craft clone system to hideout config
Create lootbox crafts with it Auto-unlock some crafts on server start
This commit is contained in:
parent
cdae576361
commit
85158a0f8a
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user