Removed isFunctional limit on reward item filter

This commit is contained in:
Dev 2024-08-26 13:55:42 +01:00
parent 98b19ff1db
commit 4f8b926ad5
3 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,4 @@
import { IRequirementBase } from "@spt/models/eft/hideout/IHideoutProduction";
import { BonusSkillType } from "@spt/models/enums/BonusSkillType"; import { BonusSkillType } from "@spt/models/enums/BonusSkillType";
import { BonusType } from "@spt/models/enums/BonusType"; import { BonusType } from "@spt/models/enums/BonusType";
@ -57,13 +58,12 @@ export interface IStageImprovementRequirement {
type: string; type: string;
} }
export interface IStageRequirement { export interface IStageRequirement extends IRequirementBase {
areaType?: number; areaType?: number;
requiredLevel?: number; requiredLevel?: number;
type: string;
templateId?: string; templateId?: string;
count?: number; count?: number;
isEncoded: false; isEncoded?: false;
isFunctional?: boolean; isFunctional?: boolean;
traderId?: string; traderId?: string;
loyaltyLevel?: number; loyaltyLevel?: number;

View File

@ -1,3 +1,4 @@
import { inherits } from "util";
import { MinMax } from "@spt/models/common/MinMax"; import { MinMax } from "@spt/models/common/MinMax";
export interface IHideoutProductionData { export interface IHideoutProductionData {
@ -21,18 +22,21 @@ export interface IHideoutProduction {
productionLimitCount: number; productionLimitCount: number;
} }
export interface Requirement { export interface Requirement extends IRequirementBase {
templateId?: string; templateId?: string;
count?: number; count?: number;
isEncoded?: boolean; isEncoded?: boolean;
isFunctional?: boolean; isFunctional?: boolean;
type: string;
areaType?: number; areaType?: number;
requiredLevel?: number; requiredLevel?: number;
resource?: number; resource?: number;
questId?: string; questId?: string;
} }
export interface IRequirementBase {
type: string;
}
export type IScavRecipe = { export type IScavRecipe = {
_id: string; _id: string;
requirements: Requirement[]; requirements: Requirement[];

View File

@ -6,7 +6,7 @@ import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { Item } from "@spt/models/eft/common/tables/IItem";
import { IStageRequirement } from "@spt/models/eft/hideout/IHideoutArea"; import { IStageRequirement } from "@spt/models/eft/hideout/IHideoutArea";
import { IHideoutCircleOfCultistProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutCircleOfCultistProductionStartRequestData"; 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 { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -262,7 +262,7 @@ export class CircleOfCultistService {
const nextStageDbData = dbArea.stages[currentStageLevel + 1]; const nextStageDbData = dbArea.stages[currentStageLevel + 1];
if (nextStageDbData) { if (nextStageDbData) {
// Next stage exists, gather up requirements and add to pool // 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) { for (const rewardToAdd of itemRequirements) {
rewardPool.add(rewardToAdd.templateId); rewardPool.add(rewardToAdd.templateId);
} }
@ -278,7 +278,7 @@ export class CircleOfCultistService {
(recipe) => !recipe.locked || playerUnlockedRecipes.includes(recipe._id), (recipe) => !recipe.locked || playerUnlockedRecipes.includes(recipe._id),
); );
for (const recipe of playerAccessibleRecipes) { for (const recipe of playerAccessibleRecipes) {
const itemRequirements = this.getNonFunctionalItemRequirements(recipe.requirements); const itemRequirements = this.getItemRequirements(recipe.requirements);
for (const requirement of itemRequirements) { for (const requirement of itemRequirements) {
rewardPool.add(requirement.templateId); rewardPool.add(requirement.templateId);
} }
@ -291,7 +291,7 @@ export class CircleOfCultistService {
const scavCaseCrafts = this.databaseService.getHideout().scavcase; const scavCaseCrafts = this.databaseService.getHideout().scavcase;
for (const craft of scavCaseCrafts) { for (const craft of scavCaseCrafts) {
// Find the item requirements from each craft // Find the item requirements from each craft
const itemRequirements = this.getNonFunctionalItemRequirements(craft.Requirements); const itemRequirements = this.getItemRequirements(craft.Requirements);
for (const requirement of itemRequirements) { for (const requirement of itemRequirements) {
// Add tpl to reward pool // Add tpl to reward pool
rewardPool.add(requirement.templateId); 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 * @param requirements Requirements to iterate over
* @returns Array of item requirements * @returns Array of item requirements
*/ */
protected getNonFunctionalItemRequirements(requirements: IStageRequirement[] | Requirement[]) { protected getItemRequirements(requirements: IRequirementBase[]): (IStageRequirement | Requirement)[] {
return requirements.filter((requirement) => requirement.type === "Item" && !requirement.isFunctional); return requirements.filter((requirement) => requirement.type === "Item");
} }
} }