Updated production recipe interface to match live
This commit is contained in:
parent
b209c0728c
commit
471c606e12
@ -7,7 +7,7 @@ import { ICustomizationItem } from "@spt/models/eft/common/tables/ICustomization
|
|||||||
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
||||||
import { IGetItemPricesResponse } from "@spt/models/eft/game/IGetItemPricesResponse";
|
import { IGetItemPricesResponse } from "@spt/models/eft/game/IGetItemPricesResponse";
|
||||||
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
||||||
import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction";
|
import { IHideoutProductionData } from "@spt/models/eft/hideout/IHideoutProduction";
|
||||||
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
||||||
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
||||||
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
@ -115,11 +115,11 @@ export class DataCallbacks {
|
|||||||
return this.httpResponse.getBody(this.databaseService.getHideout().areas);
|
return this.httpResponse.getBody(this.databaseService.getHideout().areas);
|
||||||
}
|
}
|
||||||
|
|
||||||
public gethideoutProduction(
|
public getHideoutProduction(
|
||||||
url: string,
|
url: string,
|
||||||
info: IEmptyRequestData,
|
info: IEmptyRequestData,
|
||||||
sessionID: string,
|
sessionID: string,
|
||||||
): IGetBodyResponseData<IHideoutProduction[]> {
|
): IGetBodyResponseData<IHideoutProductionData> {
|
||||||
return this.httpResponse.getBody(this.databaseService.getHideout().production);
|
return this.httpResponse.getBody(this.databaseService.getHideout().production);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ export class GameController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const craft of this.databaseService.getHideout().production) {
|
for (const craft of this.databaseService.getHideout().production.recipes) {
|
||||||
// Only adjust crafts ABOVE the override
|
// Only adjust crafts ABOVE the override
|
||||||
craft.productionTime = Math.min(craft.productionTime, overrideSeconds);
|
craft.productionTime = Math.min(craft.productionTime, overrideSeconds);
|
||||||
}
|
}
|
||||||
@ -517,7 +517,11 @@ export class GameController {
|
|||||||
protected setAllDbItemsAsSellableOnFlea(): void {
|
protected setAllDbItemsAsSellableOnFlea(): void {
|
||||||
const dbItems = Object.values(this.databaseService.getItems());
|
const dbItems = Object.values(this.databaseService.getItems());
|
||||||
for (const item of dbItems) {
|
for (const item of dbItems) {
|
||||||
if (item._type === "Item" && !item._props?.CanSellOnRagfair && !this.ragfairConfig.dynamic.blacklist.custom.includes(item._id)) {
|
if (
|
||||||
|
item._type === "Item" &&
|
||||||
|
!item._props?.CanSellOnRagfair &&
|
||||||
|
!this.ragfairConfig.dynamic.blacklist.custom.includes(item._id)
|
||||||
|
) {
|
||||||
item._props.CanSellOnRagfair = true;
|
item._props.CanSellOnRagfair = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,11 +567,11 @@ export class HideoutController {
|
|||||||
// Find the recipe of the production
|
// Find the recipe of the production
|
||||||
const recipe = this.databaseService
|
const recipe = this.databaseService
|
||||||
.getHideout()
|
.getHideout()
|
||||||
.production.find((production) => production._id === body.recipeId);
|
.production.recipes.find((production) => production._id === body.recipeId);
|
||||||
|
|
||||||
// Find the actual amount of items we need to remove because body can send weird data
|
// Find the actual amount of items we need to remove because body can send weird data
|
||||||
const recipeRequirementsClone = this.cloner.clone(
|
const recipeRequirementsClone = this.cloner.clone(
|
||||||
recipe.requirements.filter((i) => i.type === "Item" || i.type === "Tool"),
|
recipe.requirements.filter((r) => r.type === "Item" || r.type === "Tool"),
|
||||||
);
|
);
|
||||||
|
|
||||||
const output = this.eventOutputHolder.getOutput(sessionID);
|
const output = this.eventOutputHolder.getOutput(sessionID);
|
||||||
@ -733,7 +733,7 @@ export class HideoutController {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
const recipe = hideoutDb.production.find((r) => r._id === request.recipeId);
|
const recipe = hideoutDb.production.recipes.find((r) => r._id === request.recipeId);
|
||||||
if (recipe) {
|
if (recipe) {
|
||||||
this.handleRecipe(sessionID, recipe, pmcData, request, output);
|
this.handleRecipe(sessionID, recipe, pmcData, request, output);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ export class HideoutHelper {
|
|||||||
): IItemEventRouterResponse {
|
): IItemEventRouterResponse {
|
||||||
const recipe = this.databaseService
|
const recipe = this.databaseService
|
||||||
.getHideout()
|
.getHideout()
|
||||||
.production.find((production) => production._id === body.recipeId);
|
.production.recipes.find((production) => production._id === body.recipeId);
|
||||||
if (!recipe) {
|
if (!recipe) {
|
||||||
this.logger.error(this.localisationService.getText("hideout-missing_recipe_in_db", body.recipeId));
|
this.logger.error(this.localisationService.getText("hideout-missing_recipe_in_db", body.recipeId));
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ export class HideoutHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other recipes not covered by above
|
// Other recipes not covered by above
|
||||||
const recipe = recipes.find((r) => r._id === prodId);
|
const recipe = recipes.recipes.find((r) => r._id === prodId);
|
||||||
if (!recipe) {
|
if (!recipe) {
|
||||||
this.logger.error(this.localisationService.getText("hideout-missing_recipe_for_area", prodId));
|
this.logger.error(this.localisationService.getText("hideout-missing_recipe_for_area", prodId));
|
||||||
|
|
||||||
@ -564,7 +564,9 @@ export class HideoutHelper {
|
|||||||
): number {
|
): number {
|
||||||
const globalSkillsDb = this.databaseService.getGlobals().config.SkillsSettings;
|
const globalSkillsDb = this.databaseService.getGlobals().config.SkillsSettings;
|
||||||
|
|
||||||
const recipe = this.databaseService.getHideout().production.find((production) => production._id === recipeId);
|
const recipe = this.databaseService
|
||||||
|
.getHideout()
|
||||||
|
.production.recipes.find((production) => production._id === recipeId);
|
||||||
if (!recipe) {
|
if (!recipe) {
|
||||||
this.logger.error(this.localisationService.getText("hideout-missing_recipe_in_db", recipeId));
|
this.logger.error(this.localisationService.getText("hideout-missing_recipe_in_db", recipeId));
|
||||||
|
|
||||||
@ -756,7 +758,10 @@ export class HideoutHelper {
|
|||||||
* @returns seconds to produce item
|
* @returns seconds to produce item
|
||||||
*/
|
*/
|
||||||
protected getTotalProductionTimeSeconds(prodId: string): number {
|
protected getTotalProductionTimeSeconds(prodId: string): number {
|
||||||
return this.databaseService.getHideout().production.find((prod) => prod._id === prodId)?.productionTime ?? 0;
|
return (
|
||||||
|
this.databaseService.getHideout().production.recipes.find((prod) => prod._id === prodId)?.productionTime ??
|
||||||
|
0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -835,7 +840,7 @@ export class HideoutHelper {
|
|||||||
const btcProd = pmcData.Hideout.Production[HideoutHelper.bitcoinFarm];
|
const btcProd = pmcData.Hideout.Production[HideoutHelper.bitcoinFarm];
|
||||||
const bitcoinProdData = this.databaseService
|
const bitcoinProdData = this.databaseService
|
||||||
.getHideout()
|
.getHideout()
|
||||||
.production.find((production) => production._id === HideoutHelper.bitcoinProductionId);
|
.production.recipes.find((production) => production._id === HideoutHelper.bitcoinProductionId);
|
||||||
const coinSlotCount = this.getBTCSlots(pmcData);
|
const coinSlotCount = this.getBTCSlots(pmcData);
|
||||||
|
|
||||||
// Full on bitcoins, halt progress
|
// Full on bitcoins, halt progress
|
||||||
@ -963,7 +968,7 @@ export class HideoutHelper {
|
|||||||
protected getBTCSlots(pmcData: IPmcData): number {
|
protected getBTCSlots(pmcData: IPmcData): number {
|
||||||
const bitcoinProductions = this.databaseService
|
const bitcoinProductions = this.databaseService
|
||||||
.getHideout()
|
.getHideout()
|
||||||
.production.find((production) => production._id === HideoutHelper.bitcoinFarm);
|
.production.recipes.find((production) => production._id === HideoutHelper.bitcoinFarm);
|
||||||
const productionSlots = bitcoinProductions?.productionLimitCount || 3; // Default to 3 if none found
|
const productionSlots = bitcoinProductions?.productionLimitCount || 3; // Default to 3 if none found
|
||||||
const hasManagementSkillSlots = this.profileHelper.hasEliteSkillLevel(SkillTypes.HIDEOUT_MANAGEMENT, pmcData);
|
const hasManagementSkillSlots = this.profileHelper.hasEliteSkillLevel(SkillTypes.HIDEOUT_MANAGEMENT, pmcData);
|
||||||
const managementSlotsCount = this.getEliteSkillAdditionalBitcoinSlotCount() || 2;
|
const managementSlotsCount = this.getEliteSkillAdditionalBitcoinSlotCount() || 2;
|
||||||
|
@ -966,7 +966,7 @@ export class QuestHelper {
|
|||||||
): void {
|
): void {
|
||||||
// Get hideout crafts and find those that match by areatype/required level/end product tpl - hope for just one match
|
// Get hideout crafts and find those that match by areatype/required level/end product tpl - hope for just one match
|
||||||
const hideoutProductions = this.databaseService.getHideout().production;
|
const hideoutProductions = this.databaseService.getHideout().production;
|
||||||
const matchingProductions = hideoutProductions.filter(
|
const matchingProductions = hideoutProductions.recipes.filter(
|
||||||
(prod) =>
|
(prod) =>
|
||||||
prod.areaType === Number.parseInt(craftUnlockReward.traderId) &&
|
prod.areaType === Number.parseInt(craftUnlockReward.traderId) &&
|
||||||
prod.requirements.some((requirement) => requirement.questId === questDetails._id) &&
|
prod.requirements.some((requirement) => requirement.questId === questDetails._id) &&
|
||||||
@ -1121,7 +1121,7 @@ export class QuestHelper {
|
|||||||
public getMailItemRedeemTimeHoursForProfile(pmcData: IPmcData): number {
|
public getMailItemRedeemTimeHoursForProfile(pmcData: IPmcData): number {
|
||||||
const value = this.questConfig.mailRedeemTimeHours[pmcData.Info.GameVersion];
|
const value = this.questConfig.mailRedeemTimeHours[pmcData.Info.GameVersion];
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return this.questConfig.mailRedeemTimeHours["default"];
|
return this.questConfig.mailRedeemTimeHours.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
import { MinMax } from "@spt/models/common/MinMax";
|
||||||
|
|
||||||
|
export interface IHideoutProductionData {
|
||||||
|
recipes: IHideoutProduction[];
|
||||||
|
scavRecipes: IScavRecipe[];
|
||||||
|
cultistRecipes: ICultistRecipe[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface IHideoutProduction {
|
export interface IHideoutProduction {
|
||||||
_id: string;
|
_id: string;
|
||||||
areaType: number;
|
areaType: number;
|
||||||
@ -24,3 +32,20 @@ export interface Requirement {
|
|||||||
resource?: number;
|
resource?: number;
|
||||||
questId?: string;
|
questId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type IScavRecipe = {
|
||||||
|
_id: string;
|
||||||
|
requirements: Requirement[];
|
||||||
|
productionTime: number;
|
||||||
|
endProducts: IEndProducts;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface IEndProducts {
|
||||||
|
Common: MinMax;
|
||||||
|
Rare: MinMax;
|
||||||
|
Superrare: MinMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ICultistRecipe = {
|
||||||
|
_id: string;
|
||||||
|
};
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
||||||
import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction";
|
import { IHideoutProductionData } from "@spt/models/eft/hideout/IHideoutProduction";
|
||||||
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
||||||
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
||||||
import { IQteData } from "@spt/models/eft/hideout/IQteData";
|
import { IQteData } from "@spt/models/eft/hideout/IQteData";
|
||||||
|
|
||||||
export interface IHideout {
|
export interface IHideout {
|
||||||
areas: IHideoutArea[];
|
areas: IHideoutArea[];
|
||||||
production: IHideoutProduction[];
|
production: IHideoutProductionData;
|
||||||
scavcase: IHideoutScavCase[];
|
scavcase: IHideoutScavCase[];
|
||||||
settings: IHideoutSettingsBase;
|
settings: IHideoutSettingsBase;
|
||||||
qte: IQteData[];
|
qte: IQteData[];
|
||||||
|
@ -4,7 +4,7 @@ import { IGlobals } from "@spt/models/eft/common/IGlobals";
|
|||||||
import { ICustomizationItem } from "@spt/models/eft/common/tables/ICustomizationItem";
|
import { ICustomizationItem } from "@spt/models/eft/common/tables/ICustomizationItem";
|
||||||
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
||||||
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
||||||
import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction";
|
import { IHideoutProductionData } from "@spt/models/eft/hideout/IHideoutProduction";
|
||||||
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
||||||
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
||||||
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
@ -83,8 +83,8 @@ export class DataStaticRouter extends StaticRouter {
|
|||||||
info: any,
|
info: any,
|
||||||
sessionID: string,
|
sessionID: string,
|
||||||
output: string,
|
output: string,
|
||||||
): Promise<IGetBodyResponseData<IHideoutProduction[]>> => {
|
): Promise<IGetBodyResponseData<IHideoutProductionData>> => {
|
||||||
return this.dataCallbacks.gethideoutProduction(url, info, sessionID);
|
return this.dataCallbacks.getHideoutProduction(url, info, sessionID);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
new RouteAction(
|
new RouteAction(
|
||||||
|
Loading…
Reference in New Issue
Block a user