diff --git a/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts index 581c980..862c029 100644 --- a/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index 0136961..b23ccf7 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -1,7 +1,9 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; @@ -17,6 +19,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; @@ -26,8 +29,18 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to + */ + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; + /** + * Add the logged in players name to PMC name pool + * @param pmcProfile + */ + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** * Blank out the "test" mail message from prapor */ diff --git a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts index 59061c7..b57eb40 100644 --- a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts @@ -18,10 +18,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -34,7 +36,7 @@ export declare class QuestController { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -58,6 +60,22 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** * Look for an accepted quest inside player profile, return matching diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index 5caac53..36a919f 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts index f97efc6..fee4d44 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -153,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts b/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts b/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts index ae25ebe..5b937ca 100644 --- a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts @@ -57,7 +57,7 @@ export declare class BotEquipmentModGenerator { * @param weapon Weapon to add mods to * @param modPool Pool of compatible mods to attach to weapon * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on + * @param parentTemplate Weapon which mods will be generated on * @param modSpawnChances Mod spawn chances * @param ammoTpl Ammo tpl to use when generating magazines/cartridges * @param botRole Role of bot weapon is generated for @@ -66,7 +66,26 @@ export declare class BotEquipmentModGenerator { * @param botEquipmentRole role of bot when accessing bot.json equipment config settings * @returns Weapon + mods array */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; /** * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon diff --git a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts index dba8eb3..338cd5c 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts @@ -119,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts index 740805b..d9ce968 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts @@ -1,7 +1,7 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -30,17 +30,13 @@ export declare class BotGeneratorHelper { upd?: Upd; }; /** - * Get the chance for the light or laser to be set as active on weapon, default to 50% if no bot/equip settings found - * @param botRole role of bot with weapon + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null * @returns Percent chance to be active */ - protected getLightLaserActiveChance(botRole: string): number; - /** - * Get the chance for the faceshield to be set as enabled, default to 75% if no bot/equip settings found - * @param botRole role of bot with faceshield - * @returns Percent chance to be active - */ - protected getFaceShieldActiveChance(botRole: string): number; + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for diff --git a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts index 05f8217..aa329a9 100644 --- a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts @@ -36,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 36ad1cf..9639923 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -192,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index 363a9e1..6bd1444 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -68,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @param itemToRepair item to update durability details * @param itemToRepairDetails db details of item to repair * @param isArmor Is item being repaired a piece of armor diff --git a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts index 2a8f0b7..218a461 100644 --- a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData diff --git a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts index 3861abd..c3915c6 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -29,11 +30,12 @@ export declare class TraderAssortHelper { protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index 0dc93e8..0baf7d8 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -53,19 +53,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +120,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..02c4b41 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: 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 37b2d61..246a5b8 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/1LogToConsole/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/1LogToConsole/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index e17992c..4b1a621 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -69,6 +69,7 @@ export interface EquipmentFilters { weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts index 8342c99..a6b79b0 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts @@ -3,8 +3,10 @@ export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts index 6724ad1..adf59ff 100644 --- a/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts @@ -47,7 +47,7 @@ export declare class BotEquipmentModPoolService { * @param itemTpl items tpl to look up mods for * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value */ - getModsFoGearSlot(itemTpl: string): Record; + getModsForGearSlot(itemTpl: string): Record; /** * Get mods for a weapon by its tpl * @param itemTpl Weapons tpl to look up mods for diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index f8919f1..cb20500 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -93,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts index 1154160..4474129 100644 --- a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts @@ -30,7 +30,7 @@ export declare class InsuranceService { insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts +++ b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts index 3bd94b5..cf0459c 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts b/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts index 80f5487..ac765ff 100644 --- a/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts +++ b/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts @@ -1,3 +1,4 @@ +import { BotHelper } from "../helpers/BotHelper"; import { Config } from "../models/eft/common/IGlobals"; import { Inventory } from "../models/eft/common/tables/IBotType"; import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; @@ -9,11 +10,12 @@ export declare class SeasonalEventService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected localisationService: LocalisationService; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected seasonalEventConfig: ISeasonalEventConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); protected get events(): Record; - get christmasEventItems(): string[]; + protected get christmasEventItems(): string[]; /** * Get an array of christmas items found in bots inventories as loot * @returns array @@ -37,7 +39,7 @@ export declare class SeasonalEventService { */ protected getEventBotGear(eventName: string): Record>>; /** - * Get the dates each seasonal event starts and ends + * Get the dates each seasonal event starts and ends at * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; @@ -48,8 +50,9 @@ export declare class SeasonalEventService { /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param globalConfig globals.json diff --git a/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts index ed400da..0c39aa8 100644 --- a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts @@ -21,6 +21,17 @@ export declare class DatabaseImporter extends OnLoad { */ protected hydrateDatabase(filepath: string): Promise; getRoute(): string; - loadRecursive(filepath: string): Promise; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; }