From 4f8b926ad5667011b39c8c98543f28249e1427a3 Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 26 Aug 2024 13:55:42 +0100 Subject: [PATCH] Removed `isFunctional` limit on reward item filter --- project/src/models/eft/hideout/IHideoutArea.ts | 6 +++--- .../src/models/eft/hideout/IHideoutProduction.ts | 8 ++++++-- project/src/services/CircleOfCultistService.ts | 14 +++++++------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/project/src/models/eft/hideout/IHideoutArea.ts b/project/src/models/eft/hideout/IHideoutArea.ts index 47b885e7..f8617103 100644 --- a/project/src/models/eft/hideout/IHideoutArea.ts +++ b/project/src/models/eft/hideout/IHideoutArea.ts @@ -1,3 +1,4 @@ +import { IRequirementBase } from "@spt/models/eft/hideout/IHideoutProduction"; import { BonusSkillType } from "@spt/models/enums/BonusSkillType"; import { BonusType } from "@spt/models/enums/BonusType"; @@ -57,13 +58,12 @@ export interface IStageImprovementRequirement { type: string; } -export interface IStageRequirement { +export interface IStageRequirement extends IRequirementBase { areaType?: number; requiredLevel?: number; - type: string; templateId?: string; count?: number; - isEncoded: false; + isEncoded?: false; isFunctional?: boolean; traderId?: string; loyaltyLevel?: number; diff --git a/project/src/models/eft/hideout/IHideoutProduction.ts b/project/src/models/eft/hideout/IHideoutProduction.ts index 5daa3a5d..dc0b9a16 100644 --- a/project/src/models/eft/hideout/IHideoutProduction.ts +++ b/project/src/models/eft/hideout/IHideoutProduction.ts @@ -1,3 +1,4 @@ +import { inherits } from "util"; import { MinMax } from "@spt/models/common/MinMax"; export interface IHideoutProductionData { @@ -21,18 +22,21 @@ export interface IHideoutProduction { productionLimitCount: number; } -export interface Requirement { +export interface Requirement extends IRequirementBase { templateId?: string; count?: number; isEncoded?: boolean; isFunctional?: boolean; - type: string; areaType?: number; requiredLevel?: number; resource?: number; questId?: string; } +export interface IRequirementBase { + type: string; +} + export type IScavRecipe = { _id: string; requirements: Requirement[]; diff --git a/project/src/services/CircleOfCultistService.ts b/project/src/services/CircleOfCultistService.ts index b950d755..dfa14075 100644 --- a/project/src/services/CircleOfCultistService.ts +++ b/project/src/services/CircleOfCultistService.ts @@ -6,7 +6,7 @@ import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { Item } from "@spt/models/eft/common/tables/IItem"; import { IStageRequirement } from "@spt/models/eft/hideout/IHideoutArea"; import { IHideoutCircleOfCultistProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutCircleOfCultistProductionStartRequestData"; -import { Requirement } from "@spt/models/eft/hideout/IHideoutProduction"; +import { IRequirementBase, Requirement } from "@spt/models/eft/hideout/IHideoutProduction"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; @@ -262,7 +262,7 @@ export class CircleOfCultistService { const nextStageDbData = dbArea.stages[currentStageLevel + 1]; if (nextStageDbData) { // Next stage exists, gather up requirements and add to pool - const itemRequirements = this.getNonFunctionalItemRequirements(nextStageDbData.requirements); + const itemRequirements = this.getItemRequirements(nextStageDbData.requirements); for (const rewardToAdd of itemRequirements) { rewardPool.add(rewardToAdd.templateId); } @@ -278,7 +278,7 @@ export class CircleOfCultistService { (recipe) => !recipe.locked || playerUnlockedRecipes.includes(recipe._id), ); for (const recipe of playerAccessibleRecipes) { - const itemRequirements = this.getNonFunctionalItemRequirements(recipe.requirements); + const itemRequirements = this.getItemRequirements(recipe.requirements); for (const requirement of itemRequirements) { rewardPool.add(requirement.templateId); } @@ -291,7 +291,7 @@ export class CircleOfCultistService { const scavCaseCrafts = this.databaseService.getHideout().scavcase; for (const craft of scavCaseCrafts) { // Find the item requirements from each craft - const itemRequirements = this.getNonFunctionalItemRequirements(craft.Requirements); + const itemRequirements = this.getItemRequirements(craft.Requirements); for (const requirement of itemRequirements) { // Add tpl to reward pool rewardPool.add(requirement.templateId); @@ -303,11 +303,11 @@ export class CircleOfCultistService { } /** - * Iterate over passed in hideout requirements and return the Item + nonfunctional requirements + * Iterate over passed in hideout requirements and return the Item * @param requirements Requirements to iterate over * @returns Array of item requirements */ - protected getNonFunctionalItemRequirements(requirements: IStageRequirement[] | Requirement[]) { - return requirements.filter((requirement) => requirement.type === "Item" && !requirement.isFunctional); + protected getItemRequirements(requirements: IRequirementBase[]): (IStageRequirement | Requirement)[] { + return requirements.filter((requirement) => requirement.type === "Item"); } }