Added further work to circle of sacrifice area
This commit is contained in:
parent
f24318603f
commit
47fcff1338
@ -32,6 +32,7 @@ import { BackendErrorCodes } from "@spt/models/enums/BackendErrorCodes";
|
|||||||
import { BonusType } from "@spt/models/enums/BonusType";
|
import { BonusType } from "@spt/models/enums/BonusType";
|
||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
import { HideoutAreas } from "@spt/models/enums/HideoutAreas";
|
import { HideoutAreas } from "@spt/models/enums/HideoutAreas";
|
||||||
|
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
||||||
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
||||||
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
@ -1256,20 +1257,48 @@ export class HideoutController {
|
|||||||
pmcData: IPmcData,
|
pmcData: IPmcData,
|
||||||
request: IHideoutCircleOfCultistProductionStartRequestData,
|
request: IHideoutCircleOfCultistProductionStartRequestData,
|
||||||
): IItemEventRouterResponse | PromiseLike<IItemEventRouterResponse> {
|
): IItemEventRouterResponse | PromiseLike<IItemEventRouterResponse> {
|
||||||
// TODO
|
// Sparse, just has id, can get it via ItemTpl enum too
|
||||||
// Do we start a craft?
|
const cultistCraftData = this.databaseService.getHideout().production.scavRecipes[0];
|
||||||
|
|
||||||
|
const sacrificedItems: Item[] = this.getSacrificedItems(pmcData);
|
||||||
|
|
||||||
|
const circleCraftId = ItemTpl.HIDEOUTAREACONTAINER_CIRCLEOFCULTISTS_STASH_1;
|
||||||
|
|
||||||
|
this.hideoutHelper.registerCircleOfCultistProduction(sessionId, pmcData, circleCraftId, sacrificedItems);
|
||||||
|
|
||||||
|
// What items can be rewarded by completion of craft
|
||||||
|
// TODO - how do we use this? maybe this is done in a later event?
|
||||||
|
const cultistStashDbItem = this.itemHelper.getItem(circleCraftId);
|
||||||
|
const rewardItemPool = cultistStashDbItem[1]._props.Grids[0]._props.filters[0].Filter;
|
||||||
|
|
||||||
const output = this.eventOutputHolder.getOutput(sessionId);
|
const output = this.eventOutputHolder.getOutput(sessionId);
|
||||||
|
|
||||||
// Get root items inside cultist grid and remove them from inventory
|
// TODO - is this necessary?
|
||||||
|
// Do the items remain in the sacrifice window for duration of craft?
|
||||||
|
// Remove sacrified items
|
||||||
|
// for (const rootItem of inventoryRootItemsInCultistGrid) {
|
||||||
|
// this.inventoryHelper.removeItem(pmcData, rootItem._id, sessionId, output);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getSacrificedItems(pmcData: IPmcData): Item[] {
|
||||||
|
// Get root items that are in the cultist sacrifice window
|
||||||
const inventoryRootItemsInCultistGrid = pmcData.Inventory.items.filter(
|
const inventoryRootItemsInCultistGrid = pmcData.Inventory.items.filter(
|
||||||
(item) => item.slotId === "CircleOfCultistsGrid1",
|
(item) => item.slotId === "CircleOfCultistsGrid1",
|
||||||
);
|
);
|
||||||
for (const rootItem of inventoryRootItemsInCultistGrid) {
|
|
||||||
this.inventoryHelper.removeItem(pmcData, rootItem._id, sessionId, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
// Get rootitem + its children
|
||||||
|
const sacrificedItems: Item[] = [];
|
||||||
|
for (const rootItem of inventoryRootItemsInCultistGrid) {
|
||||||
|
const rootItemWithChildren = this.itemHelper.findAndReturnChildrenAsItems(
|
||||||
|
pmcData.Inventory.items,
|
||||||
|
rootItem._id,
|
||||||
|
);
|
||||||
|
sacrificedItems.push(...rootItemWithChildren);
|
||||||
|
}
|
||||||
|
return sacrificedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,6 +116,20 @@ export class HideoutHelper {
|
|||||||
pmcData.Hideout.Production[body.recipeId] = production;
|
pmcData.Hideout.Production[body.recipeId] = production;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public registerCircleOfCultistProduction(
|
||||||
|
sessionId: string,
|
||||||
|
pmcData: IPmcData,
|
||||||
|
recipeId: string,
|
||||||
|
sacrificedItems: Item[],
|
||||||
|
): void {
|
||||||
|
// TODO: hard coded 12 hour craft + no fuel use, where can we get this data
|
||||||
|
const cultistProduction = this.initProduction(recipeId, 43200, false);
|
||||||
|
cultistProduction.GivenItemsInStart = sacrificedItems;
|
||||||
|
|
||||||
|
// Add circle production to profile
|
||||||
|
pmcData.Hideout.Production[recipeId] = cultistProduction;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This convenience function initializes new Production Object
|
* This convenience function initializes new Production Object
|
||||||
* with all the constants.
|
* with all the constants.
|
||||||
|
@ -368,7 +368,7 @@ export interface Productive {
|
|||||||
SkipTime?: number;
|
SkipTime?: number;
|
||||||
/** Seconds needed to fully craft */
|
/** Seconds needed to fully craft */
|
||||||
ProductionTime?: number;
|
ProductionTime?: number;
|
||||||
GivenItemsInStart?: string[];
|
GivenItemsInStart?: Item[];
|
||||||
Interrupted?: boolean;
|
Interrupted?: boolean;
|
||||||
Code?: string;
|
Code?: string;
|
||||||
Decoded?: boolean;
|
Decoded?: boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user