diff --git a/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairCategoriesService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairCategoriesService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairCategoriesService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts b/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts b/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts b/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/13AddTrader/types/services/FenceService.d.ts b/TypeScript/13AddTrader/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/13AddTrader/types/services/FenceService.d.ts +++ b/TypeScript/13AddTrader/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts +++ b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/13AddTrader/types/services/LocalisationService.d.ts b/TypeScript/13AddTrader/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/13AddTrader/types/services/LocalisationService.d.ts +++ b/TypeScript/13AddTrader/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/13AddTrader/types/services/PaymentService.d.ts b/TypeScript/13AddTrader/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/13AddTrader/types/services/PaymentService.d.ts +++ b/TypeScript/13AddTrader/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/13AddTrader/types/services/RagfairCategoriesService.d.ts b/TypeScript/13AddTrader/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/13AddTrader/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairCategoriesService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts b/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairCategoriesService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts b/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts b/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts b/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts b/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts b/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts b/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts +++ b/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts b/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/16ImporterUtil/types/services/FenceService.d.ts b/TypeScript/16ImporterUtil/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/16ImporterUtil/types/services/FenceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts b/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts b/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts b/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/16ImporterUtil/types/services/RagfairCategoriesService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/16ImporterUtil/types/utils/DatabaseImporter.d.ts b/TypeScript/16ImporterUtil/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/16ImporterUtil/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairCategoriesService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/DatabaseImporter.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairCategoriesService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/DatabaseImporter.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/18CustomItemService/types/controllers/CustomizationController.d.ts b/TypeScript/18CustomItemService/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/18CustomItemService/types/controllers/CustomizationController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts b/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts b/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts b/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts b/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts +++ b/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts b/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts b/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/18CustomItemService/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts b/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts +++ b/TypeScript/18CustomItemService/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/18CustomItemService/types/services/FenceService.d.ts b/TypeScript/18CustomItemService/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/18CustomItemService/types/services/FenceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts b/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts b/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts +++ b/TypeScript/18CustomItemService/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/18CustomItemService/types/services/PaymentService.d.ts b/TypeScript/18CustomItemService/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/18CustomItemService/types/services/PaymentService.d.ts +++ b/TypeScript/18CustomItemService/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/18CustomItemService/types/services/RagfairCategoriesService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/18CustomItemService/types/utils/DatabaseImporter.d.ts b/TypeScript/18CustomItemService/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/18CustomItemService/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/18CustomItemService/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts b/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts b/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts +++ b/TypeScript/1LogToConsole/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts +++ b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/1LogToConsole/types/services/RagfairCategoriesService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts b/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts b/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/2EditDatabase/types/services/FenceService.d.ts b/TypeScript/2EditDatabase/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/2EditDatabase/types/services/FenceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts b/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts b/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts +++ b/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/2EditDatabase/types/services/RagfairCategoriesService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts b/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairCategoriesService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairCategoriesService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairCategoriesService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairCategoriesService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts b/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/7OnLoadHook/types/services/RagfairCategoriesService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairCategoriesService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts b/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts index a4ef8cf..e08a91b 100644 --- a/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts @@ -1,7 +1,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -18,7 +18,32 @@ export declare class CustomizationController { protected profileHelper: ProfileHelper; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; - wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; - buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; + wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): 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 + */ + protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; + /** + * Update output object and player profile with purchase details + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItems Clothing purchased + * @param output Client response + */ + protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void; + /** + * Update output object and player profile with purchase details for single piece of clothing + * @param sessionId Session id + * @param pmcData Player profile + * @param clothingItem Clothing item purchased + * @param output Client response + * @returns + */ + protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; } diff --git a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts index e0c8392..577375d 100644 --- a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts @@ -73,8 +73,20 @@ export declare class DialogueController { */ protected getMessagesWithAttachments(messages: Message[]): Message[]; /** - * Delete expired items. triggers when updating traders. - * @param sessionID Session id + * Delete expired items from all messages in player profile. triggers when updating traders. + * @param sessionId Session id */ - protected removeExpiredItems(sessionID: string): void; + protected removeExpiredItemsFromMessages(sessionId: string): void; + /** + * Removes expired items from a message in player profile + * @param sessionId Session id + * @param dialogueId Dialog id + */ + protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void; + /** + * Has a dialog message expired + * @param message Message to check expiry of + * @returns true or false + */ + protected messageHasExpired(message: Message): boolean; } diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index e6e0243..5a3a273 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -137,9 +137,9 @@ export declare class HideoutController { * Add generated scav case rewards to player profile * @param pmcData player profile to add rewards to * @param rewards reward items to add to profile - * @param recipieId recipie id to save into Production dict + * @param recipeId recipe id to save into Production dict */ - protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipieId: string): void; + protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void; /** * Start production of continuously created item * @param pmcData Player profile @@ -157,15 +157,15 @@ export declare class HideoutController { */ takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** - * Take recipie-type production out of hideout area and place into player inventory + * Take recipe-type production out of hideout area and place into player inventory * @param sessionID Session id - * @param recipe Completed recipie of item + * @param recipe Completed recipe of item * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update * @returns IItemEventRouterResponse */ - protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handles giving rewards stored in player profile to player after clicking 'get rewards' * @param sessionID Session id diff --git a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts index cb0c755..55e2029 100644 --- a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts @@ -53,5 +53,25 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; - endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; + endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Is extract by car + * @param extractName name of extract + * @returns true if car extract + */ + protected extractWasViaCar(extractName: string): boolean; + /** + * Handle when a player extracts using a car - Add rep to fence + * @param extractName name of the extract used + * @param pmcData Player profile + * @param sessionId Session id + */ + protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; + /** + * Update players fence trader standing value in profile + * @param pmcData Player profile + * @param fenceId Id of fence trader + * @param extractName Name of extract used + */ + protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts index fffcaa3..b94ad20 100644 --- a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts @@ -117,7 +117,35 @@ export declare class RagfairController { * @returns min/avg/max values for an item based on flea offers available */ getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; - addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * List item(s) on flea for sale + * @param pmcData Player profile + * @param offerRequest Flea list creatio offer + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Is the item to be listed on the flea valid + * @param offerRequest Client offer request + * @param errorMessage message to show to player when offer is invalid + * @returns Is offer valid + */ + protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean; + /** + * Get the handbook price in roubles for the items being listed + * @param requirements + * @returns Rouble price + */ + protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; + /** + * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * @param pmcData Player profile + * @param itemIdsFromFleaOfferRequest Ids from request + * @param errorMessage if item is not found, add error message to this parameter + * @returns Array of items from player inventory + */ + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; diff --git a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts index 2321a23..5236a12 100644 --- a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -93,9 +93,10 @@ export declare class BotGenerator { /** * Randomise the progress value of passed in skills based on the min/max value * @param skills Skills to randomise + * @param isCommonSkills Are the skills 'common' skills * @returns Skills with randomised progress values as an array */ - protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; + protected getSkillsWithRandomisedProgressValue(skills: Record, isCommonSkills: boolean): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts index f298c13..565ad32 100644 --- a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts @@ -9,6 +9,10 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +type ItemLimit = { + current: number; + max: number; +}; export declare class LootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -25,14 +29,11 @@ export declare class LootGenerator { */ createRandomLoot(options: LootRequest): LootItem[]; /** - * Construct item limit record to hold max and current item count + * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record; + protected initItemLimitCounter(limits: Record): Record; /** * Find a random item in items.json and add to result array * @param items items to choose from @@ -65,3 +66,4 @@ export declare class LootGenerator { max: number; }>, itemBlacklist: string[], result: LootItem[]): boolean; } +export {}; diff --git a/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts index aa329a9..dd9ce09 100644 --- a/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts @@ -1,12 +1,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; -declare class LookupItem { - byId: Record; - byParent: Record; +declare class LookupItem { + readonly byId: Map; + readonly byParent: Map; constructor(); } export declare class LookupCollection { - items: LookupItem; - categories: LookupItem; + readonly items: LookupItem; + readonly categories: LookupItem; constructor(); } export declare class HandbookHelper { diff --git a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts index 466b41d..fed487c 100644 --- a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts @@ -6,6 +6,7 @@ import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hide import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -36,7 +37,6 @@ export declare class HideoutHelper { static bitcoin: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; - private static generatorOffMultipler; 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); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; @@ -131,9 +131,41 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get the water filter drain rate based on hideout bonues player has + * @param pmcData Player profile + * @returns Drain rate + */ + protected getWaterFilterDrainRate(pmcData: IPmcData): number; + /** + * Get the production time in seconds for the desired production + * @param prodId Id, e.g. Water collector id + * @returns seconds to produce item + */ + protected getProductionTimeSeconds(prodId: string): number; + /** + * Create a upd object using passed in parameters + * @param stackCount + * @param resourceValue + * @param resourceUnitsConsumed + * @returns Upd + */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; + /** + * Add bitcoin object to btc production products array and set progress time + * @param btcProd Bitcoin production object + * @param coinCraftTimeSeconds Time to craft a bitcoin + */ + protected addBtcToProduction(btcProd: Production, coinCraftTimeSeconds: number): void; + /** + * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + * @param pmcData Player profile + * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @returns Amount of time elapsed in seconds + */ + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -180,6 +212,12 @@ export declare class HideoutHelper { * @returns IItemEventRouterResponse */ getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Create a single bitcoin request object + * @param pmcData Player profile + * @returns IAddItemRequestData + */ + protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** * Upgrade hideout wall from starting level to interactable level if enough time has passed * @param pmcProfile Profile to upgrade wall in diff --git a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts index b65d78d..0de950c 100644 --- a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts @@ -44,6 +44,12 @@ export declare class InRaidHelper { * @returns adjusted karma level after kills are taken into account */ calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; + /** + * Get the standing gain/loss for killing an npc + * @param victim Who was killed by player + * @returns a numerical standing gain or loss + */ + protected getStandingChangeForKill(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -79,7 +85,7 @@ export declare class InRaidHelper { * @param preRaidProfile profile to update * @param postRaidProfile profile to update inventory contents of * @param isPlayerScav Was this a p scav raid - * @returns + * @returns profile with FiR items properly tagged */ addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** @@ -107,6 +113,12 @@ export declare class InRaidHelper { * @param sessionID Session id */ deleteInventory(pmcData: IPmcData, sessionID: string): void; + /** + * Get an array of items from a profile that will be lost on death + * @param pmcProfile Profile to get items from + * @returns Array of items lost on death + */ + protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[]; /** * Get items in vest/pocket/backpack inventory containers (excluding children) * @param pmcData Player profile diff --git a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts index 9c31d78..a2ee699 100644 --- a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts @@ -84,8 +84,8 @@ export declare class InventoryHelper { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; - protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; + getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index 7cb563f..ba34062 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -120,7 +120,7 @@ declare class ItemHelper { */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** - * Recursive function that looks at every item from parameter and gets their childrens Ids + * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items * @param itemID * @returns an array of strings diff --git a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts index 28d3d23..91e71ae 100644 --- a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts @@ -45,7 +45,16 @@ export declare class ProfileHelper { * @returns updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; - isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; + /** + * Check if a nickname is used by another profile loaded by the server + * @param nicknameRequest + * @param sessionID Session id + * @returns True if already used + */ + isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; + protected profileHasInfoProperty(profile: IAkiProfile): boolean; + protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; + protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index 66175fe..bef1511 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -55,6 +55,13 @@ export declare class TraderHelper { * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; + /** + * Add standing to current standing and clamp value if it goes too low + * @param currentStanding current trader standing + * @param standingToAdd stansding to add to trader standing + * @returns current standing + added standing (clamped if needed) + */ + protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold * @param traderID trader to process diff --git a/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts index b88723c..4c7e9d6 100644 --- a/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts @@ -18,6 +18,7 @@ export declare class BundleLoader { getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; + addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { manifest: Array; 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 cbad0a6..0010ee2 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts @@ -7,6 +7,10 @@ export interface ITemplateItem { _proto: string; } export interface Props { + AllowSpawnOnLocations?: any[]; + ChangePriceCoef?: number; + FixedPrice?: boolean; + SendToClient?: boolean; Name?: string; ShortName?: string; Description?: string; @@ -102,7 +106,7 @@ export interface Props { MaskSize?: number; NoiseIntensity?: number; NoiseScale?: number; - Color?: Color; + Color?: IColor; DiffuseIntensity?: number; HasHinge?: boolean; RampPalette?: string; @@ -259,7 +263,7 @@ export interface Props { foodEffectType?: string; StimulatorBuffs?: string; effects_health?: IHealthEffect[] | Record>; - effects_damage?: any; + effects_damage?: Record; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; @@ -443,15 +447,15 @@ export interface EffectsHealthProps { value: number; } export interface EffectsDamage { - Pain: EffectDamageProps; - LightBleeding: EffectDamageProps; - HeavyBleeding: EffectDamageProps; - Contusion: EffectDamageProps; - RadExposure: EffectDamageProps; - Fracture: EffectDamageProps; - DestroyedPart: EffectDamageProps; + Pain: IEffectDamageProps; + LightBleeding: IEffectDamageProps; + HeavyBleeding: IEffectDamageProps; + Contusion: IEffectDamageProps; + RadExposure: IEffectDamageProps; + Fracture: IEffectDamageProps; + DestroyedPart: IEffectDamageProps; } -export interface EffectDamageProps { +export interface IEffectDamageProps { delay: number; duration: number; fadeOut: number; @@ -459,7 +463,7 @@ export interface EffectDamageProps { healthPenaltyMin?: number; healthPenaltyMax?: number; } -export interface Color { +export interface IColor { r: number; g: number; b: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts index 1fcfbaa..10c32f1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts @@ -82,9 +82,9 @@ export interface ISuit { tid: string; suiteId: string; isActive: boolean; - requirements: Requirements; + requirements: ISuitRequirements; } -export interface Requirements { +export interface ISuitRequirements { loyaltyLevel: number; profileLevel: number; standing: number; diff --git a/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts b/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts index c6e880a..0551c56 100644 --- a/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts @@ -56,7 +56,7 @@ export declare enum BaseClasses { AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", LOOT_CONTAINER = "566965d44bdc2d814c8b4571", - MOD_CONTAINER = "5448bf274bdc2dfc2f8b456a", + MOB_CONTAINER = "5448bf274bdc2dfc2f8b456a", SEARCHABLE_ITEM = "566168634bdc2d144c8b456c", STASH = "566abbb64bdc2d144c8b457d", SORTING_TABLE = "6050cac987d3f925bf016837", diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts index c34c11d..aff7aec 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts @@ -5,4 +5,6 @@ export interface IHttpConfig extends IBaseConfig { ip: string; port: number; logRequests: boolean; + /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ + serverImagePathOverride: Record; } diff --git a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts index a491b03..65b3ae0 100644 --- a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts @@ -25,7 +25,7 @@ export declare class BotGenerationCacheService { */ getBot(key: string): IBotBase; /** - * Remove all cached bot profiles + * Remove all cached bot profiles from memory */ clearStoredBots(): void; /** diff --git a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts index 6e0a1db..5c1560c 100644 --- a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts @@ -19,7 +19,7 @@ export declare class BotLootCacheService { protected lootCache: Record; constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** - * Remove all cached bot loot data + * Remove cached bot loot data */ clearCache(): void; /** diff --git a/TypeScript/9RouterHooks/types/services/FenceService.d.ts b/TypeScript/9RouterHooks/types/services/FenceService.d.ts index d143380..841a8ee 100644 --- a/TypeScript/9RouterHooks/types/services/FenceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/FenceService.d.ts @@ -106,6 +106,7 @@ export declare class FenceService { protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; /** * Choose an item (not mod) at random and remove from assorts + * @param assort Items to remove from */ protected removeRandomItemFromAssorts(assort: ITraderAssort): void; /** diff --git a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts index 55baa1a..1605bc9 100644 --- a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts @@ -50,6 +50,7 @@ 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; + 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 * @param pmcData Player profile @@ -66,6 +67,12 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Create a hash table for an array of items, keyed by items _id + * @param items Items to hash + * @returns Hashtable + */ + protected createItemHashTable(items: Item[]): Record; /** * Store insured items on pmc death inside insurance array in player profile * @param pmcData Player profile diff --git a/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts b/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts index f3837fe..44a4941 100644 --- a/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts +++ b/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts @@ -1,16 +1,18 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, localeService: LocaleService); + constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for diff --git a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts index ac131ea..1c9c32b 100644 --- a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts @@ -57,6 +57,13 @@ export declare class PaymentService { * @returns IItemEventRouterResponse */ addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get all money stacks in inventory and prioritse items in stash + * @param pmcData + * @param currencyTpl + * @returns Sorting money items + */ + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container diff --git a/TypeScript/9RouterHooks/types/services/RagfairCategoriesService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairCategoriesService.d.ts index 83910e5..490b0bb 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairCategoriesService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairCategoriesService.d.ts @@ -22,9 +22,9 @@ export declare class RagfairCategoriesService { protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; /** * Increment or decrement a category array - * @param offer offer to process - * @param categories categories to update - * @param increment should item be incremented or decremented + * @param offer Offer to process + * @param categories Categories to update + * @param increment (Optional) Should item be incremented or decremented */ protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; /** diff --git a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts index c09d63a..7698f07 100644 --- a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts @@ -1,6 +1,8 @@ import { OnLoad } from "../di/OnLoad"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { EncodingUtil } from "./EncodingUtil"; @@ -18,10 +20,12 @@ export declare class DatabaseImporter implements OnLoad { protected encodingUtil: EncodingUtil; protected hashUtil: HashUtil; protected importerUtil: ImporterUtil; + protected configServer: ConfigServer; private hashedFile; private valid; private filepath; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil); + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); onLoad(): Promise; /** * Read all json files in database folder and map into a json object @@ -31,5 +35,15 @@ export declare class DatabaseImporter implements OnLoad { private onReadValidate; getRoute(): string; private validateFile; - loadImages(filepath: string): void; + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + loadImages(filepath: string, routes: string[]): void; + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected getImagePathOverride(imagePath: string): string; } diff --git a/readme.md b/readme.md index 5641443..c497f0b 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Mod examples for 3.5.5 +# Mod examples for 3.5.6 A collection of example mods that perform typical actions in SPT