diff --git a/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairLinkedItemService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairLinkedItemService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairLinkedItemService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts b/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts +++ b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts b/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/13AddTrader/types/services/RagfairLinkedItemService.d.ts b/TypeScript/13AddTrader/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/13AddTrader/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts b/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairLinkedItemService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts b/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairLinkedItemService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts b/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts b/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/16ImporterUtil/types/services/ItemBaseClassService.d.ts b/TypeScript/16ImporterUtil/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/16ImporterUtil/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/16ImporterUtil/types/services/RagfairLinkedItemService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ItemBaseClassService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairLinkedItemService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ItemBaseClassService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairLinkedItemService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts b/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts index 39c8e90..46ea7a1 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts b/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/18CustomItemService/types/services/RagfairLinkedItemService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts b/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts +++ b/TypeScript/18CustomItemService/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts index 39c8e90..46ea7a1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/1LogToConsole/types/services/RagfairLinkedItemService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts b/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts index 39c8e90..46ea7a1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/2EditDatabase/types/services/RagfairLinkedItemService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts b/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index 39c8e90..46ea7a1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairLinkedItemService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index 39c8e90..46ea7a1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairLinkedItemService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts b/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairLinkedItemService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairLinkedItemService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts b/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/7OnLoadHook/types/services/RagfairLinkedItemService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts b/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairLinkedItemService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts b/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts index e08a91b..8735cae 100644 --- a/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts @@ -16,16 +16,34 @@ export declare class CustomizationController { protected saveServer: SaveServer; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; + protected readonly clothingIds: { + lowerParentId: string; + upperParentId: string; + }; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); + /** + * Get purchasable clothing items from trader that match players side (usec/bear) + * @param traderID trader to look up clothing for + * @param sessionID Session id + * @returns ISuit array + */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; + /** Equip one to many clothing items to player */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Purchase/unlock a clothing item from a trader + * @param pmcData Player profile + * @param buyClothingRequest Request object + * @param sessionId Session id + * @returns IItemEventRouterResponse + */ buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse; protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit; /** * Has an outfit been purchased by a player * @param suitId clothing id * @param sessionID Session id - * @returns true/false + * @returns true if purchased already */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index 5a3a273..dd4235f 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -176,7 +176,7 @@ export declare class HideoutController { */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Start area production for item + * Start area production for item by adding production to profiles' Hideout.Production array * @param pmcData Player profile * @param request Start production request * @param sessionID Session id diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index 23ca135..70c1dab 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -3,7 +3,6 @@ import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; @@ -18,7 +17,6 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; -import { LocaleService } from "../services/LocaleService"; import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,14 +30,12 @@ export declare class InraidController { protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; - protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected playerScavGenerator: PlayerScavGenerator; - protected notificationSendHelper: NotificationSendHelper; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; @@ -48,7 +44,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -97,7 +93,6 @@ export declare class InraidController { * @param offraidData post-raid data of raid */ protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; - protected sendLostInsuranceMessage(sessionID: string): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts b/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts index 9bc6594..cf8d81a 100644 --- a/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts @@ -1,8 +1,9 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -37,6 +38,7 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; @@ -44,12 +46,12 @@ export declare class InventoryController { protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId diff --git a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts index 565ad32..30da765 100644 --- a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Preset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -65,5 +75,39 @@ export declare class LootGenerator { current: number; max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: Preset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; diff --git a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts index 1f00e38..898bf8e 100644 --- a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts @@ -19,6 +19,13 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + /** + * Create basic message context template + * @param templateId + * @param messageType + * @param maxStoreTime + * @returns + */ createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts index fed487c..c718865 100644 --- a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts @@ -39,6 +39,13 @@ export declare class HideoutHelper { static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add production to profiles' Hideout.Production array + * @param pmcData Profile to add production to + * @param body Production request + * @param sessionID Session id + * @returns client response + */ registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convenience function initializes new Production Object @@ -61,6 +68,16 @@ export declare class HideoutHelper { * @param sessionID Session id */ updatePlayerHideout(sessionID: string): void; + /** + * Get various properties that will be passed to hideout update-related functions + * @param pmcData Player profile + * @returns Properties + */ + protected getHideoutProperties(pmcData: IPmcData): { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }; /** * Update progress timer for water collector * @param pmcData profile to update diff --git a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts index a2ee699..d0bc8ea 100644 --- a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts @@ -128,6 +128,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts index bf7aeb6..251d7ca 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts @@ -27,7 +27,7 @@ export declare class RagfairSellHelper { */ protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** - * Determine if the offer being listed will be sold + * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell * @param itemSellCount count of items to sell * @returns Array of purchases of item(s) listed diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts index f2dc57f..46ea7a1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts @@ -377,7 +377,7 @@ export interface Props { ExplosionEffectType?: string; LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; - RandomLootSettings: IRandomLootSettings; + RandomLootSettings?: IRandomLootSettings; } export interface IHealthEffect { type: string; @@ -413,8 +413,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..4aba484 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts @@ -26,6 +26,7 @@ export interface AirdropChancePercent { export interface AirdropLoot { presetCount?: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..b4af825 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,24 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ diff --git a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts index 7ddf679..32fffba 100644 --- a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts @@ -1,6 +1,7 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; +import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; @@ -26,10 +28,12 @@ export declare class InsuranceService { protected dialogueHelper: DialogueHelper; protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; + protected localeService: LocaleService; + protected notificationSendHelper: NotificationSendHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; @@ -50,6 +54,11 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Send a message to player informing them gear was lost + * @param sessionID Session id + */ + sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure diff --git a/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts b/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts index d7bc4bc..43fe451 100644 --- a/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts @@ -14,6 +14,7 @@ export declare class ItemBaseClassService { constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Create cache and store inside ItemBaseClassService + * Store a dict of an items tpl to the base classes it and its parents have */ hydrateItemBaseClassCache(): void; /** diff --git a/TypeScript/9RouterHooks/types/services/RagfairLinkedItemService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairLinkedItemService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts index 8b68bc4..d3f56c6 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts @@ -33,6 +33,10 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; + /** + * Add placeholder values for the new sealed weapon containers + */ + protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts b/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts index fc0b05d..806071f 100644 --- a/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array;