diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts similarity index 86% rename from TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts rename to TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts index 8a85114..26958ca 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -1,11 +1,12 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -19,6 +20,7 @@ export declare class GiveSptCommand implements ISptCommand { protected mailSendService: MailSendService; protected localeService: LocaleService; protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; /** * Regex to account for all these cases: * spt give "item name" 5 @@ -29,8 +31,8 @@ export declare class GiveSptCommand implements ISptCommand { */ private static commandRegex; private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts b/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/10ScopesAndTypes/types/utils/CompareUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts b/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts similarity index 86% rename from TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts rename to TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts index 8a85114..26958ca 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -1,11 +1,12 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -19,6 +20,7 @@ export declare class GiveSptCommand implements ISptCommand { protected mailSendService: MailSendService; protected localeService: LocaleService; protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; /** * Regex to account for all these cases: * spt give "item name" 5 @@ -29,8 +31,8 @@ export declare class GiveSptCommand implements ISptCommand { */ private static commandRegex; private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts b/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/11BundleLoadingSample/types/utils/CompareUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts b/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts similarity index 86% rename from TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts rename to TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts index 8a85114..26958ca 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -1,11 +1,12 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -19,6 +20,7 @@ export declare class GiveSptCommand implements ISptCommand { protected mailSendService: MailSendService; protected localeService: LocaleService; protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; /** * Regex to account for all these cases: * spt give "item name" 5 @@ -29,8 +31,8 @@ export declare class GiveSptCommand implements ISptCommand { */ private static commandRegex; private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/12ClassExtensionOverride/types/utils/CompareUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts similarity index 86% rename from TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts rename to TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts index 8a85114..26958ca 100644 --- a/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -1,11 +1,12 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -19,6 +20,7 @@ export declare class GiveSptCommand implements ISptCommand { protected mailSendService: MailSendService; protected localeService: LocaleService; protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; /** * Regex to account for all these cases: * spt give "item name" 5 @@ -29,8 +31,8 @@ export declare class GiveSptCommand implements ISptCommand { */ private static commandRegex; private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); getCommand(): string; getCommandHelp(): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; diff --git a/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/13AddTrader/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/13AddTrader/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/13AddTrader/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/13AddTrader/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/13AddTrader/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/13AddTrader/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/13AddTrader/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/13AddTrader/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/13AddTrader/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/13AddTrader/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/13AddTrader/types/services/FenceService.d.ts b/TypeScript/13AddTrader/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/13AddTrader/types/services/FenceService.d.ts +++ b/TypeScript/13AddTrader/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/13AddTrader/types/services/MailSendService.d.ts b/TypeScript/13AddTrader/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/13AddTrader/types/services/MailSendService.d.ts +++ b/TypeScript/13AddTrader/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/13AddTrader/types/utils/CompareUtil.d.ts b/TypeScript/13AddTrader/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/13AddTrader/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts b/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/14AfterDBLoadHook/types/utils/CompareUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts b/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/15HttpListenerExample/types/utils/CompareUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts b/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/16ImporterUtil/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/16ImporterUtil/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/16ImporterUtil/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/16ImporterUtil/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/16ImporterUtil/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/16ImporterUtil/types/services/FenceService.d.ts b/TypeScript/16ImporterUtil/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/16ImporterUtil/types/services/FenceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts b/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/16ImporterUtil/types/utils/CompareUtil.d.ts b/TypeScript/16ImporterUtil/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts b/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/16ImporterUtil/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/CompareUtil.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/CompareUtil.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/18CustomItemService/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/18CustomItemService/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/18CustomItemService/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/18CustomItemService/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/18CustomItemService/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/18CustomItemService/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/18CustomItemService/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/18CustomItemService/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/18CustomItemService/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/18CustomItemService/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/18CustomItemService/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/18CustomItemService/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/18CustomItemService/types/services/FenceService.d.ts b/TypeScript/18CustomItemService/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/18CustomItemService/types/services/FenceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/18CustomItemService/types/services/MailSendService.d.ts b/TypeScript/18CustomItemService/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/18CustomItemService/types/services/MailSendService.d.ts +++ b/TypeScript/18CustomItemService/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/18CustomItemService/types/utils/CompareUtil.d.ts b/TypeScript/18CustomItemService/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/18CustomItemService/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts b/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/18CustomItemService/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/19UseExternalLibraries/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/19UseExternalLibraries/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/19UseExternalLibraries/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/19UseExternalLibraries/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/19UseExternalLibraries/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts b/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/19UseExternalLibraries/types/services/MailSendService.d.ts b/TypeScript/19UseExternalLibraries/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/19UseExternalLibraries/types/services/MailSendService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/19UseExternalLibraries/types/utils/CompareUtil.d.ts b/TypeScript/19UseExternalLibraries/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts b/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/19UseExternalLibraries/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/1LogToConsole/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/1LogToConsole/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/1LogToConsole/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/1LogToConsole/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/1LogToConsole/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/1LogToConsole/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/1LogToConsole/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/1LogToConsole/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/1LogToConsole/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/1LogToConsole/types/services/MailSendService.d.ts b/TypeScript/1LogToConsole/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/1LogToConsole/types/services/MailSendService.d.ts +++ b/TypeScript/1LogToConsole/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/1LogToConsole/types/utils/CompareUtil.d.ts b/TypeScript/1LogToConsole/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/1LogToConsole/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts b/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/20CustomChatBot/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/20CustomChatBot/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/20CustomChatBot/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/20CustomChatBot/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/20CustomChatBot/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/20CustomChatBot/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/20CustomChatBot/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/20CustomChatBot/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/20CustomChatBot/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/20CustomChatBot/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/20CustomChatBot/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/20CustomChatBot/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/20CustomChatBot/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/20CustomChatBot/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/20CustomChatBot/types/services/FenceService.d.ts b/TypeScript/20CustomChatBot/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/20CustomChatBot/types/services/FenceService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/20CustomChatBot/types/services/MailSendService.d.ts b/TypeScript/20CustomChatBot/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/20CustomChatBot/types/services/MailSendService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/20CustomChatBot/types/utils/CompareUtil.d.ts b/TypeScript/20CustomChatBot/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/20CustomChatBot/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts b/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/20CustomChatBot/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/21CustomCommandoCommand/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/21CustomCommandoCommand/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/21CustomCommandoCommand/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/21CustomCommandoCommand/types/services/MailSendService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/MailSendService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/21CustomCommandoCommand/types/utils/CompareUtil.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/21CustomCommandoCommand/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts b/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/22CustomAkiCommand/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/22CustomAkiCommand/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/22CustomAkiCommand/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/22CustomAkiCommand/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/22CustomAkiCommand/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/22CustomAkiCommand/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/22CustomAkiCommand/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/22CustomAkiCommand/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts b/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/22CustomAkiCommand/types/services/MailSendService.d.ts b/TypeScript/22CustomAkiCommand/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/22CustomAkiCommand/types/services/MailSendService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/22CustomAkiCommand/types/utils/CompareUtil.d.ts b/TypeScript/22CustomAkiCommand/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/22CustomAkiCommand/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts b/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/22CustomAkiCommand/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/2EditDatabase/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/2EditDatabase/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/2EditDatabase/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/2EditDatabase/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/2EditDatabase/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/2EditDatabase/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/2EditDatabase/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/2EditDatabase/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/2EditDatabase/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/2EditDatabase/types/services/FenceService.d.ts b/TypeScript/2EditDatabase/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/2EditDatabase/types/services/FenceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/2EditDatabase/types/services/MailSendService.d.ts b/TypeScript/2EditDatabase/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/2EditDatabase/types/services/MailSendService.d.ts +++ b/TypeScript/2EditDatabase/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/2EditDatabase/types/utils/CompareUtil.d.ts b/TypeScript/2EditDatabase/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/2EditDatabase/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts b/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts b/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/3GetSptConfigFile/types/utils/CompareUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MailSendService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MailSendService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/CompareUtil.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/4UseACustomConfigFile/types/utils/CompareUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts b/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/5ReplaceMethod/types/utils/CompareUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts b/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/CompareUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/7OnLoadHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/7OnLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/7OnLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/7OnLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts b/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/7OnLoadHook/types/utils/CompareUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts b/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/8OnUpdateHook/types/utils/CompareUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array; diff --git a/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts index 7ed60b9..2de57cb 100644 --- a/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; @@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate { * Handle client/friend/request/send */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept-all + */ + acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData; /** * Handle client/friend/request/accept */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/decline + */ + declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/friend/request/cancel */ diff --git a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts index 014617e..ca5d1bd 100644 --- a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts @@ -82,7 +82,7 @@ export declare class BotLootGenerator { * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set): void; protected createWalletLoot(walletId: string): Item[][]; /** * Some items need child items to function, add them to the itemToAddChildrenTo array @@ -101,7 +101,7 @@ export declare class BotLootGenerator { * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set): void; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 diff --git a/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts index 6d8ac49..5ca8ed7 100644 --- a/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/FenceBaseAssortGenerator.d.ts @@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { HashUtil } from "@spt-aki/utils/HashUtil"; @@ -22,8 +23,9 @@ export declare class FenceBaseAssortGenerator { protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; + protected fenceService: FenceService; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, fenceService: FenceService); /** * Create base fence assorts dynamically and store in memory */ @@ -40,8 +42,6 @@ export declare class FenceBaseAssortGenerator { * @returns Penetration power of passed in item, null if it doesnt have a power */ protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number; - protected getItemPrice(itemTpl: string, items: Item[]): number; - protected getAmmoBoxPrice(items: Item[]): number; /** * Add soft inserts + armor plates to an armor * @param armor Armor item array to add mods into diff --git a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts index 7f7555b..c756725 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts @@ -92,7 +92,7 @@ export declare class BotGeneratorHelper { * @param inventory Inventory to add item+children into * @returns ItemAddedResult result object */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory, containersIdFull?: Set): ItemAddedResult; /** * Is the provided item allowed inside a container * @param slotGrid Items sub-grid we want to place item inside diff --git a/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts new file mode 100644 index 0000000..26958ca --- /dev/null +++ b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.d.ts @@ -0,0 +1,39 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected itemFilterService: ItemFilterService; + /** + * Regex to account for all these cases: + * spt give "item name" 5 + * spt give templateId 5 + * spt give en "item name in english" 5 + * spt give es "nombre en español" 5 + * spt give 5 <== this is the reply when the algo isn't sure about an item + */ + private static commandRegex; + private static maxAllowedDistance; + protected savedCommand: Map; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, itemFilterService: ItemFilterService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts similarity index 100% rename from TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/SavedCommand.d.ts rename to TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.d.ts diff --git a/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts deleted file mode 100644 index 8a85114..0000000 --- a/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; -import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/SavedCommand"; -import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; -import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; -import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; -import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; -import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; -import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocaleService } from "@spt-aki/services/LocaleService"; -import { MailSendService } from "@spt-aki/services/MailSendService"; -import { HashUtil } from "@spt-aki/utils/HashUtil"; -import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -export declare class GiveSptCommand implements ISptCommand { - protected logger: ILogger; - protected itemHelper: ItemHelper; - protected hashUtil: HashUtil; - protected jsonUtil: JsonUtil; - protected presetHelper: PresetHelper; - protected mailSendService: MailSendService; - protected localeService: LocaleService; - protected databaseServer: DatabaseServer; - /** - * Regex to account for all these cases: - * spt give "item name" 5 - * spt give templateId 5 - * spt give en "item name in english" 5 - * spt give es "nombre en español" 5 - * spt give 5 <== this is the reply when the algo isn't sure about an item - */ - private static commandRegex; - private static maxAllowedDistance; - protected savedCommand: SavedCommand; - constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); - getCommand(): string; - getCommandHelp(): string; - performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; -} diff --git a/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts new file mode 100644 index 0000000..8ec2ada --- /dev/null +++ b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.d.ts @@ -0,0 +1,38 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class ProfileSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + /** + * Regex to account for all these cases: + * spt profile level 20 + * spt profile skill metabolism 10 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer, profileHelper: ProfileHelper); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; + protected handleSkillCommand(skill: string, level: number): IProfileChangeEvent; + protected handleLevelCommand(level: number): IProfileChangeEvent; +} diff --git a/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts new file mode 100644 index 0000000..d84158a --- /dev/null +++ b/TypeScript/9RouterHooks/types/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.d.ts @@ -0,0 +1,33 @@ +import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + protected localeService: LocaleService; + protected databaseServer: DatabaseServer; + /** + * Regex to account for all these cases: + * spt trader prapor rep 100 + * spt trader mechanic spend 1000000 + */ + private static commandRegex; + protected savedCommand: SavedCommand; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService, localeService: LocaleService, databaseServer: DatabaseServer); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index 9040a7c..9195579 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; @@ -10,6 +10,7 @@ import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { CompareUtil } from "@spt-aki/utils/CompareUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil"; @@ -28,8 +29,33 @@ export declare class ItemHelper { protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected compareUtil: CompareUtil; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService, compareUtil: CompareUtil); + /** + * This method will compare two items (with all its children) and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item with all its children to compare + * @param item2 second item with all its children to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set): boolean; + /** + * This method will compare two items and see if the are equivalent. + * This method will NOT compare IDs on the items + * @param item1 first item to compare + * @param item2 second item to compare + * @param compareUpdProperties Upd properties to compare between the items + * @returns true if they are the same, false if they arent + */ + isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set): boolean; + /** + * Helper method to generate a Upd based on a template + * @param itemTemplate the item template to generate a Upd for + * @returns A Upd with all the default properties set + */ + generateUpdForItem(itemTemplate: ITemplateItem): Upd; /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl diff --git a/TypeScript/9RouterHooks/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 87461aa..0913eb5 100644 --- a/TypeScript/9RouterHooks/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest { } export interface ICancelFriendRequestData extends IBaseFriendRequest { } -export interface IBaseFriendRequest { - request_id: string; +export interface IDeclineFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { + profileId: string; } diff --git a/TypeScript/9RouterHooks/types/models/eft/dialog/IFriendRequestSendResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/dialog/IFriendRequestSendResponse.d.ts index 06c40f3..fc311eb 100644 --- a/TypeScript/9RouterHooks/types/models/eft/dialog/IFriendRequestSendResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/dialog/IFriendRequestSendResponse.d.ts @@ -1,5 +1,5 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts index 6c3c9eb..26e43ac 100644 --- a/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { id: string; aid: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/ISearchFriendResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/ISearchFriendResponse.d.ts index 96d88b2..d3cc7df 100644 --- a/TypeScript/9RouterHooks/types/models/eft/profile/ISearchFriendResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/profile/ISearchFriendResponse.d.ts @@ -1,9 +1,11 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } export interface Info { Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts index 65da29b..f17d3e4 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts @@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig { /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; allPMCsHavePlayerNameWithRandomPrefixChance: number; + /** Should secure container loot from usec.json/bear.json be added to pmc bots secure */ + addSecureContainerLootFromBotConfig: boolean; } export interface PmcTypes { usec: string; diff --git a/TypeScript/9RouterHooks/types/models/spt/dialog/ISendMessageDetails.d.ts b/TypeScript/9RouterHooks/types/models/spt/dialog/ISendMessageDetails.d.ts index 2068ede..05b3bcd 100644 --- a/TypeScript/9RouterHooks/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -30,7 +30,15 @@ export interface ISendMessageDetails { } export interface IProfileChangeEvent { _id: string; - Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + Type: ProfileChangeEventType; value: number; entity?: string; } +export declare enum ProfileChangeEventType { + TRADER_SALES_SUM = "TraderSalesSum", + TRADER_STANDING = "TraderStanding", + PROFILE_LEVEL = "ProfileLevel", + SKILL_POINTS = "SkillPoints", + EXAMINE_ALL_ITEMS = "ExamineAllItems", + UNLOCK_TRADER = "UnlockTrader" +} diff --git a/TypeScript/9RouterHooks/types/services/FenceService.d.ts b/TypeScript/9RouterHooks/types/services/FenceService.d.ts index 16c1b7f..75c4b28 100644 --- a/TypeScript/9RouterHooks/types/services/FenceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/FenceService.d.ts @@ -40,6 +40,7 @@ export declare class FenceService { protected fenceDiscountAssort: ITraderAssort; /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */ protected desiredAssortCounts: IFenceAssortGenerationValues; + protected fenceItemUpdCompareProperties: Set; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort @@ -73,6 +74,26 @@ export declare class FenceService { * @returns ITraderAssort */ getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Adds to fence assort a single item (with its children) + * @param items the items to add with all its childrens + * @param mainItem the most parent item of the array + */ + addItemsToFenceAssort(items: Item[], mainItem: Item): void; + /** + * Calculates the overall price for an item (with all its children) + * @param itemTpl the item tpl to calculate the fence price for + * @param items the items (with its children) to calculate fence price for + * @returns the fence price of the item + */ + getItemPrice(itemTpl: string, items: Item[]): number; + /** + * Calculate the overall price for an ammo box, where only one item is + * the ammo box itself and every other items are the bullets in that box + * @param items the ammo box (and all its children ammo items) + * @returns the price of the ammo box + */ + protected getAmmoBoxPrice(items: Item[]): number; /** * Adjust all items contained inside an assort by a multiplier * @param assort (clone)Assort that contains items with prices to adjust diff --git a/TypeScript/9RouterHooks/types/services/MailSendService.d.ts b/TypeScript/9RouterHooks/types/services/MailSendService.d.ts index 08752bf..e5643f9 100644 --- a/TypeScript/9RouterHooks/types/services/MailSendService.d.ts +++ b/TypeScript/9RouterHooks/types/services/MailSendService.d.ts @@ -7,7 +7,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; import { MessageType } from "@spt-aki/models/enums/MessageType"; import { Traders } from "@spt-aki/models/enums/Traders"; -import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { IProfileChangeEvent, ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; @@ -55,7 +55,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void; /** * Send a message from SYSTEM to the player with or without items with localised text * @param sessionId The session ID to send the message to @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/TypeScript/9RouterHooks/types/utils/CompareUtil.d.ts b/TypeScript/9RouterHooks/types/utils/CompareUtil.d.ts new file mode 100644 index 0000000..a5b94d5 --- /dev/null +++ b/TypeScript/9RouterHooks/types/utils/CompareUtil.d.ts @@ -0,0 +1,11 @@ +export declare class CompareUtil { + private static typesToCheckAgainst; + /** + * This function does an object comparison, equivalent to applying reflections + * and scanning for all possible properties including arrays. + * @param v1 value 1 to compare + * @param v2 value 2 to compare + * @returns true if equal, false if not + */ + recursiveCompare(v1: any, v2: any): boolean; +} diff --git a/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts b/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts index 3942ed1..b95e54a 100644 --- a/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts +++ b/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts @@ -1,9 +1,12 @@ +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { + protected maxOffersPerTemplate: number; + protected ragfairServerHelper: RagfairServerHelper; protected offersById: Map; protected offersByTemplate: Map>; protected offersByTrader: Map>; - constructor(); + constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; getOffersByTrader(traderId: string): Array;