From d78e51911ee1b0e5dcc199bf50410a56217afe7b Mon Sep 17 00:00:00 2001 From: Valens Date: Thu, 16 Feb 2023 13:22:45 -0500 Subject: [PATCH] Update types for AKI 3.5.1 --- src/pmc.ts | 14 +++++++++++++- types/controllers/TraderController.d.ts | 7 +++++++ types/generators/BotGenerator.d.ts | 4 +++- types/generators/PMCLootGenerator.d.ts | 14 ++++++++++++++ types/helpers/AssortHelper.d.ts | 19 +++++++++++++++---- types/helpers/QuestHelper.d.ts | 2 +- types/helpers/RagfairOfferHelper.d.ts | 17 ++++++++++++++++- types/models/spt/config/IPmcConfig.d.ts | 8 +++++++- types/models/spt/config/IRagfairConfig.d.ts | 2 ++ 9 files changed, 78 insertions(+), 9 deletions(-) diff --git a/src/pmc.ts b/src/pmc.ts index bd57541..1aad3dc 100644 --- a/src/pmc.ts +++ b/src/pmc.ts @@ -204,7 +204,19 @@ export class PMCs // PMC Weighting Start - // USEC Ammo Weighting + // PMC Armor Vest Weighting + const pmcArmorVest = JSON.parse(JSON.stringify(this.databaseServer.bots.types.usec.inventory.equipment.ArmorVest)); + + pmcArmorVest = + { + + }; + + this.databaseServer.bots.types.usec.inventory.equipment.ArmorVest = pmcArmorVest; + this.databaseServer.bots.types.bear.inventory.equipment.ArmorVest = pmcArmorVest; + + + // PMC Ammo Weighting const pmcAmmo = JSON.parse(JSON.stringify(this.databaseServer.bots.types.usec.inventory.Ammo)); pmcAmmo.Caliber127x55 = diff --git a/types/controllers/TraderController.d.ts b/types/controllers/TraderController.d.ts index b67aec9..8d6b14a 100644 --- a/types/controllers/TraderController.d.ts +++ b/types/controllers/TraderController.d.ts @@ -42,6 +42,13 @@ export declare class TraderController { * @returns array if ITraderBase objects */ getAllTraders(sessionID: string): ITraderBase[]; + /** + * Order traders by their traderId (Ttid) + * @param traderA First trader to compare + * @param traderB Second trader to compare + * @returns 1,-1 or 0 + */ + protected sortByTraderId(traderA: ITraderBase, traderB: ITraderBase): number; getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; getPurchasesData(sessionID: string, traderID: string): Record; diff --git a/types/generators/BotGenerator.d.ts b/types/generators/BotGenerator.d.ts index 9581259..8992e9e 100644 --- a/types/generators/BotGenerator.d.ts +++ b/types/generators/BotGenerator.d.ts @@ -14,12 +14,14 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; + protected timeUtil: TimeUtil; protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; @@ -32,7 +34,7 @@ export declare class BotGenerator { protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot diff --git a/types/generators/PMCLootGenerator.d.ts b/types/generators/PMCLootGenerator.d.ts index 10918e3..8dd47ef 100644 --- a/types/generators/PMCLootGenerator.d.ts +++ b/types/generators/PMCLootGenerator.d.ts @@ -1,4 +1,5 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -15,6 +16,7 @@ export declare class PMCLootGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected pocketLootPool: string[]; + protected vestLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); @@ -23,6 +25,18 @@ export declare class PMCLootGenerator { * @returns string array of tpls */ generatePMCPocketLootPool(): string[]; + /** + * Create an array of loot items a PMC can have in their vests + * @returns string array of tpls + */ + generatePMCVestLootPool(): string[]; + /** + * Check if item has a width/hide that lets it fit into a 1x2 slot + * 1x1 / 1x2 / 2x1 + * @param item Item to check size of + * @returns true if it fits + */ + protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/types/helpers/AssortHelper.d.ts b/types/helpers/AssortHelper.d.ts index 13512b2..bc66b09 100644 --- a/types/helpers/AssortHelper.d.ts +++ b/types/helpers/AssortHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { QuestStatus } from "../models/enums/QuestStatus"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; @@ -15,12 +16,22 @@ export declare class AssortHelper { /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile - * @param traderId traders id - * @param assort assort items from a trader - * @param mergedQuestAssorts An object of quest assort to quest id unlocks for all traders + * @param traderId traders id the assort belongs to + * @param traderAssorts All assort items from same trader + * @param mergedQuestAssorts Dict of quest assort to quest id unlocks for all traders * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, mergedQuestAssorts: Record>, flea?: boolean): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, traderAssorts: ITraderAssort, mergedQuestAssorts: Record>, flea?: boolean): ITraderAssort; + /** + * Get a quest id + the statuses quest can be in to unlock assort + * @param mergedQuestAssorts quest assorts to search for assort id + * @param assortId Assort to look for linked quest id + * @returns quest id + array of quest status the assort should show for + */ + protected getQuestIdAndStatusThatShowAssort(mergedQuestAssorts: Record>, assortId: string): { + questId: string; + status: QuestStatus[]; + }; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/types/helpers/QuestHelper.d.ts b/types/helpers/QuestHelper.d.ts index de7cba2..7dd32ea 100644 --- a/types/helpers/QuestHelper.d.ts +++ b/types/helpers/QuestHelper.d.ts @@ -40,7 +40,7 @@ export declare class QuestHelper { protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** - * Get status of a quest by quest id + * Get status of a quest in player profile by its id * @param pmcData Profile to search * @param questID Quest id to look up * @returns QuestStatus enum diff --git a/types/helpers/RagfairOfferHelper.d.ts b/types/helpers/RagfairOfferHelper.d.ts index 3d0d570..0e92762 100644 --- a/types/helpers/RagfairOfferHelper.d.ts +++ b/types/helpers/RagfairOfferHelper.d.ts @@ -47,7 +47,22 @@ export declare class RagfairOfferHelper { protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get offers from flea/traders specifically when building weapon preset + * @param searchRequest Search request data + * @param itemsToAdd string array of item tpls to search for + * @param traderAssorts All trader assorts player can access/buy + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Check if offer item is quest locked for current player by looking at sptQuestLocked property in traders barter_scheme + * @param offer Offer to check is quest locked + * @param traderAssorts all trader assorts for player + * @returns true if quest locked + */ + traderOfferItemQuestLocked(offer: IRagfairOffer, traderAssorts: Record): boolean; /** * Has a traders offer ran out of stock to sell to player * @param offer Offer to check stock of diff --git a/types/models/spt/config/IPmcConfig.d.ts b/types/models/spt/config/IPmcConfig.d.ts index 979122c..87098da 100644 --- a/types/models/spt/config/IPmcConfig.d.ts +++ b/types/models/spt/config/IPmcConfig.d.ts @@ -1,5 +1,8 @@ import { MinMax } from "../../common/MinMax"; export interface IPmcConfig { + vestLoot: SlotLootSettings; + pocketLoot: SlotLootSettings; + backpackLoot: SlotLootSettings; dynamicLoot: DynamicLoot; useDifficultyOverride: boolean; difficulty: string; @@ -22,8 +25,11 @@ export interface PmcTypes { usec: string; bear: string; } -export interface DynamicLoot { +export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; moneyStackLimits: Record; } +export interface DynamicLoot { + moneyStackLimits: Record; +} diff --git a/types/models/spt/config/IRagfairConfig.d.ts b/types/models/spt/config/IRagfairConfig.d.ts index 3fa04de..75357d0 100644 --- a/types/models/spt/config/IRagfairConfig.d.ts +++ b/types/models/spt/config/IRagfairConfig.d.ts @@ -30,6 +30,8 @@ export interface Reputation { } export interface Dynamic { purchasesAreFoundInRaid: boolean; + /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ + useTraderPriceForOffersIfHigher: boolean; barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number;