3.8.1-DEV (#25)

Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Reviewed-on: #25
This commit is contained in:
chomp 2024-05-04 19:20:31 +00:00
parent 36f643f3a6
commit 2b69963163
1531 changed files with 12367 additions and 3030 deletions

View File

@ -1,4 +1,4 @@
# Mod examples for v3.8.0 # Mod examples for v3.8.1
A collection of example mods that perform typical actions in SPT A collection of example mods that perform typical actions in SPT

View File

@ -13,7 +13,7 @@ This project is designed to streamline the initial setup process for building an
## **NodeJS Setup** ## **NodeJS Setup**
Before you begin, ensure to install NodeJS version `v18.15.0`, which has been tested thoroughly with our mod templates and build scripts. Download it from the [official NodeJS website](https://nodejs.org/). Before you begin, ensure to install NodeJS version `v20.11.1`, which has been tested thoroughly with our mod templates and build scripts. Download it from the [official NodeJS website](https://nodejs.org/).
After installation, it's advised to reboot your system. After installation, it's advised to reboot your system.

View File

@ -2,6 +2,7 @@ import { BotController } from "@spt-aki/controllers/BotController";
import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Difficulties } from "@spt-aki/models/eft/common/tables/IBotType";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class BotCallbacks { export declare class BotCallbacks {
@ -19,6 +20,11 @@ export declare class BotCallbacks {
* @returns string * @returns string
*/ */
getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string;
/**
* Handle singleplayer/settings/bot/difficulties
* @returns dictionary of every bot and its diffiulty settings
*/
getAllBotDifficulties(url: string, info: IEmptyRequestData, sessionID: string): Record<string, Difficulties>;
/** /**
* Handle client/game/bot/generate * Handle client/game/bot/generate
* @returns IGetBodyResponseData * @returns IGetBodyResponseData

View File

@ -1,7 +1,7 @@
import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { DialogueController } from "@spt-aki/controllers/DialogueController";
import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { OnUpdate } from "@spt-aki/di/OnUpdate";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; 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 { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer";
import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest";
import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest";
@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate {
* Handle client/friend/request/send * Handle client/friend/request/send
*/ */
sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>; sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>;
/**
* Handle client/friend/request/accept-all
*/
acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData;
/** /**
* Handle client/friend/request/accept * Handle client/friend/request/accept
*/ */
acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>; acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
/**
* Handle client/friend/request/decline
*/
declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
/** /**
* Handle client/friend/request/cancel * Handle client/friend/request/cancel
*/ */

View File

@ -39,11 +39,6 @@ export declare class InraidCallbacks {
* @returns JSON as string * @returns JSON as string
*/ */
getRaidMenuSettings(): string; getRaidMenuSettings(): string;
/**
* Handle singleplayer/settings/weapon/durability
* @returns
*/
getWeaponDurability(): string;
/** /**
* Handle singleplayer/airdrop/config * Handle singleplayer/airdrop/config
* @returns JSON as string * @returns JSON as string

View File

@ -51,12 +51,14 @@ export declare class BotController {
getBotCoreDifficulty(): IBotCore; getBotCoreDifficulty(): IBotCore;
/** /**
* Get bot difficulty settings * Get bot difficulty settings
* adjust PMC settings to ensure they engage the correct bot types * Adjust PMC settings to ensure they engage the correct bot types
* @param type what bot the server is requesting settings for * @param type what bot the server is requesting settings for
* @param diffLevel difficulty level server requested settings for * @param diffLevel difficulty level server requested settings for
* @param ignoreRaidSettings should raid settings chosen pre-raid be ignored
* @returns Difficulty object * @returns Difficulty object
*/ */
getBotDifficulty(type: string, diffLevel: string): Difficulty; getBotDifficulty(type: string, diffLevel: string, ignoreRaidSettings?: boolean): Difficulty;
getAllBotDifficulties(): Record<string, any>;
/** /**
* Generate bot profiles and store in cache * Generate bot profiles and store in cache
* @param sessionId Session id * @param sessionId Session id

View File

@ -28,7 +28,7 @@ export declare class BuildController {
saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void;
/** Handle client/builds/delete*/ /** Handle client/builds/delete*/
removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; removeBuild(sessionID: string, request: IRemoveBuildRequestData): void;
protected removePlayerBuild(id: string, sessionID: string): void; protected removePlayerBuild(idToRemove: string, sessionID: string): void;
/** /**
* Handle client/builds/magazine/save * Handle client/builds/magazine/save
*/ */

View File

@ -29,6 +29,7 @@ import { GiftService } from "@spt-aki/services/GiftService";
import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { OpenZoneService } from "@spt-aki/services/OpenZoneService"; import { OpenZoneService } from "@spt-aki/services/OpenZoneService";
import { ProfileActivityService } from "@spt-aki/services/ProfileActivityService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
@ -55,6 +56,7 @@ export declare class GameController {
protected itemBaseClassService: ItemBaseClassService; protected itemBaseClassService: ItemBaseClassService;
protected giftService: GiftService; protected giftService: GiftService;
protected raidTimeAdjustmentService: RaidTimeAdjustmentService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService;
protected profileActivityService: ProfileActivityService;
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected httpConfig: IHttpConfig; protected httpConfig: IHttpConfig;
@ -65,12 +67,14 @@ export declare class GameController {
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, profileActivityService: ProfileActivityService, applicationContext: ApplicationContext, configServer: ConfigServer);
load(): void; load(): void;
/** /**
* Handle client/game/start * Handle client/game/start
*/ */
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
protected adjustHideoutCraftTimes(): void;
protected adjustHideoutBuildTimes(): void;
protected adjustLocationBotValues(): void; protected adjustLocationBotValues(): void;
/** /**
* Out of date/incorrectly made trader mods forget this data * Out of date/incorrectly made trader mods forget this data

View File

@ -34,6 +34,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { FenceService } from "@spt-aki/services/FenceService"; import { FenceService } from "@spt-aki/services/FenceService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { PlayerService } from "@spt-aki/services/PlayerService"; import { PlayerService } from "@spt-aki/services/PlayerService";
import { ProfileActivityService } from "@spt-aki/services/ProfileActivityService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
@ -57,13 +58,14 @@ export declare class HideoutController {
protected hideoutHelper: HideoutHelper; protected hideoutHelper: HideoutHelper;
protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected profileActivityService: ProfileActivityService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected fenceService: FenceService; protected fenceService: FenceService;
/** Key used in TaskConditionCounters array */ /** Key used in TaskConditionCounters array */
protected static nameTaskConditionCountersCrafting: string; protected static nameTaskConditionCountersCrafting: string;
protected hideoutConfig: IHideoutConfig; protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, profileActivityService: ProfileActivityService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService);
/** /**
* Handle HideoutUpgrade event * Handle HideoutUpgrade event
* Start a hideout area upgrade * Start a hideout area upgrade

View File

@ -18,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { MailSendService } from "@spt-aki/services/MailSendService"; import { MailSendService } from "@spt-aki/services/MailSendService";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil";
@ -38,10 +39,11 @@ export declare class InsuranceController {
protected paymentService: PaymentService; protected paymentService: PaymentService;
protected insuranceService: InsuranceService; protected insuranceService: InsuranceService;
protected mailSendService: MailSendService; protected mailSendService: MailSendService;
protected ragfairPriceService: RagfairPriceService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
protected roubleTpl: string; protected roubleTpl: string;
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer);
/** /**
* Process insurance items of all profiles prior to being given back to the player through the mail service. * Process insurance items of all profiles prior to being given back to the player through the mail service.
* *
@ -145,7 +147,7 @@ export declare class InsuranceController {
*/ */
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void; protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
/** /**
* Sorts the attachment items by their max price in descending order. * Sorts the attachment items by their dynamic price in descending order.
* *
* @param attachments The array of attachments items. * @param attachments The array of attachments items.
* @returns An array of items enriched with their max price and common locale-name. * @returns An array of items enriched with their max price and common locale-name.
@ -220,6 +222,6 @@ export declare class InsuranceController {
} }
interface EnrichedItem extends Item { interface EnrichedItem extends Item {
name: string; name: string;
maxPrice: number; dynamicPrice: number;
} }
export {}; export {};

View File

@ -44,6 +44,11 @@ export declare class LauncherController {
protected formatID(timeStamp: number, counter: number): string; protected formatID(timeStamp: number, counter: number): string;
changeUsername(info: IChangeRequestData): string; changeUsername(info: IChangeRequestData): string;
changePassword(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string;
/**
* Handle launcher requesting profile be wiped
* @param info IRegisterData
* @returns Session id
*/
wipe(info: IRegisterData): string; wipe(info: IRegisterData): string;
getCompatibleTarkovVersion(): string; getCompatibleTarkovVersion(): string;
/** /**

View File

@ -75,10 +75,11 @@ export declare class MatchController {
protected sendCoopTakenFenceMessage(sessionId: string): void; protected sendCoopTakenFenceMessage(sessionId: string): void;
/** /**
* Handle when a player extracts using a coop extract - add rep to fence * Handle when a player extracts using a coop extract - add rep to fence
* @param sessionId Session/player id
* @param pmcData Profile * @param pmcData Profile
* @param extractName Name of extract taken * @param extractName Name of extract taken
*/ */
protected handleCoopExtract(pmcData: IPmcData, extractName: string): void; protected handleCoopExtract(sessionId: string, pmcData: IPmcData, extractName: string): void;
/** /**
* Was extract by car * Was extract by car
* @param extractName name of extract * @param extractName name of extract

View File

@ -187,12 +187,12 @@ export declare class BotEquipmentModGenerator {
*/ */
protected getRandomModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; protected getRandomModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string;
/** /**
* Log errors if mod is not compatible with slot * Check if mod exists in db + is for a required slot
* @param modToAdd template of mod to check * @param modToAdd Db template of mod to check
* @param slotAddedToTemplate slot the item will be placed in * @param slotAddedToTemplate Slot object the item will be placed as child into
* @param modSlot slot the mod will fill * @param modSlot Slot the mod will fill
* @param parentTemplate template of the mods being added * @param parentTemplate Db template of the mods being added
* @param botRole * @param botRole Bots wildspawntype (assault/pmcBot etc)
* @returns true if valid * @returns true if valid
*/ */
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean; protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean;

View File

@ -80,9 +80,10 @@ export declare class BotGenerator {
* @param botJsonTemplate x.json from database * @param botJsonTemplate x.json from database
* @param botGenerationDetails * @param botGenerationDetails
* @param botRole role of bot e.g. assault * @param botRole role of bot e.g. assault
* @param sessionId profile session id
* @returns Nickname for bot * @returns Nickname for bot
*/ */
protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId?: string): string;
/** /**
* Log the number of PMCs generated to the debug console * Log the number of PMCs generated to the debug console
* @param output Generated bot array, ready to send to client * @param output Generated bot array, ready to send to client

View File

@ -82,7 +82,7 @@ export declare class BotLootGenerator {
* @param totalValueLimitRub Total value of loot allowed in roubles * @param totalValueLimitRub Total value of loot allowed in roubles
* @param isPmc Is bot being generated for a pmc * @param isPmc Is bot being generated for a pmc
*/ */
protected addLootFromPool(pool: Record<string, number>, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; protected addLootFromPool(pool: Record<string, number>, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set<string>): void;
protected createWalletLoot(walletId: string): Item[][]; protected createWalletLoot(walletId: string): Item[][];
/** /**
* Some items need child items to function, add them to the itemToAddChildrenTo array * 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 botRole bots role .e.g. pmcBot
* @param isPmc are we generating for a pmc * @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<string>): void;
/** /**
* Hydrate item limit array to contain items that have a limit for a specific bot type * Hydrate item limit array to contain items that have a limit for a specific bot type
* All values are set to 0 * All values are set to 0

View File

@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { FenceService } from "@spt-aki/services/FenceService";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
@ -22,14 +23,25 @@ export declare class FenceBaseAssortGenerator {
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
protected seasonalEventService: SeasonalEventService; protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected fenceService: FenceService;
protected traderConfig: ITraderConfig; 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 * Create base fence assorts dynamically and store in memory
*/ */
generateFenceBaseAssorts(): void; generateFenceBaseAssorts(): void;
protected getItemPrice(itemTpl: string, items: Item[]): number; /**
protected getAmmoBoxPrice(items: Item[]): number; * Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit
* @param rootItemDb Ammo box or ammo item from items.db
* @returns True if penetration value is above limit set in config
*/
protected isAmmoAbovePenetrationLimit(rootItemDb: ITemplateItem): boolean;
/**
* Get the penetration power value of an ammo, works with ammo boxes and raw ammos
* @param rootItemDb Ammo box or ammo item from items.db
* @returns Penetration power of passed in item, null if it doesnt have a power
*/
protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number;
/** /**
* Add soft inserts + armor plates to an armor * Add soft inserts + armor plates to an armor
* @param armor Armor item array to add mods into * @param armor Armor item array to add mods into

View File

@ -41,10 +41,10 @@ export declare class LootGenerator {
*/ */
createRandomLoot(options: LootRequest): LootItem[]; createRandomLoot(options: LootRequest): LootItem[];
/** /**
* Filter armor items by their main plates protection level * Filter armor items by their front plates protection level - top if its a helmet
* @param armor Armor preset * @param armor Armor preset to check
* @param options Loot request options * @param options Loot request options - armor level etc
* @returns True item passes checks * @returns True if item has desired armor level
*/ */
protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean;
/** /**
@ -74,13 +74,13 @@ export declare class LootGenerator {
protected getRandomisedStackCount(item: ITemplateItem, options: LootRequest): number; protected getRandomisedStackCount(item: ITemplateItem, options: LootRequest): number;
/** /**
* Find a random item in items.json and add to result array * Find a random item in items.json and add to result array
* @param globalDefaultPresets presets to choose from * @param presetPool Presets to choose from
* @param itemTypeCounts item limit counts * @param itemTypeCounts Item limit counts
* @param itemBlacklist items to skip * @param itemBlacklist Items to skip
* @param result array to add found preset to * @param result Array to add chosen preset to
* @returns true if preset was valid and added to pool * @returns true if preset was valid and added to pool
*/ */
protected findAndAddRandomPresetToLoot(globalDefaultPresets: IPreset[], itemTypeCounts: Record<string, { protected findAndAddRandomPresetToLoot(presetPool: IPreset[], itemTypeCounts: Record<string, {
current: number; current: number;
max: number; max: number;
}>, itemBlacklist: string[], result: LootItem[]): boolean; }>, itemBlacklist: string[], result: LootItem[]): boolean;

View File

@ -58,7 +58,7 @@ export declare class RepeatableQuestRewardGenerator {
* @param minPrice The minimum priced item to include * @param minPrice The minimum priced item to include
* @returns True if any items remain in `rewardItems`, false otherwise * @returns True if any items remain in `rewardItems`, false otherwise
*/ */
protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): ITemplateItem[];
/** /**
* Get a randomised number a reward items stack size should be based on its handbook price * Get a randomised number a reward items stack size should be based on its handbook price
* @param item Reward item to get stack size for * @param item Reward item to get stack size for

View File

@ -92,7 +92,7 @@ export declare class BotGeneratorHelper {
* @param inventory Inventory to add item+children into * @param inventory Inventory to add item+children into
* @returns ItemAddedResult result object * @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<string>): ItemAddedResult;
/** /**
* Is the provided item allowed inside a container * Is the provided item allowed inside a container
* @param slotGrid Items sub-grid we want to place item inside * @param slotGrid Items sub-grid we want to place item inside

View File

@ -0,0 +1,20 @@
import { IChatCommand, ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand";
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot";
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 { MailSendService } from "@spt-aki/services/MailSendService";
export declare abstract class AbstractDialogueChatBot implements IDialogueChatBot {
protected logger: ILogger;
protected mailSendService: MailSendService;
protected chatCommands: IChatCommand[] | ICommandoCommand[];
constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[] | ICommandoCommand[]);
/**
* @deprecated As of v3.7.6. Use registerChatCommand.
*/
registerCommandoCommand(chatCommand: IChatCommand | ICommandoCommand): void;
registerChatCommand(chatCommand: IChatCommand | ICommandoCommand): void;
abstract getChatBot(): IUserDialogInfo;
protected abstract getUnrecognizedCommandMessage(): string;
handleMessage(sessionId: string, request: ISendMessageRequest): string;
}

View File

@ -1,6 +1,10 @@
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
export interface ICommandoCommand { /**
* @deprecated As of v3.7.6. Use IChatCommand. Will be removed in v3.9.0.
*/
export type ICommandoCommand = IChatCommand;
export interface IChatCommand {
getCommandPrefix(): string; getCommandPrefix(): string;
getCommandHelp(command: string): string; getCommandHelp(command: string): string;
getCommands(): Set<string>; getCommands(): Set<string>;

View File

@ -1,9 +1,9 @@
import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand";
import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
export declare class SptCommandoCommands implements ICommandoCommand { export declare class SptCommandoCommands implements IChatCommand {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected sptCommands: ISptCommand[]; protected sptCommands: ISptCommand[];
constructor(configServer: ConfigServer, sptCommands: ISptCommand[]); constructor(configServer: ConfigServer, sptCommands: ISptCommand[]);

View File

@ -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<string, SavedCommand>;
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;
}

View File

@ -0,0 +1,6 @@
export declare class SavedCommand {
quantity: number;
potentialItemNames: string[];
locale: string;
constructor(quantity: number, potentialItemNames: string[], locale: string);
}

View File

@ -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;
}

View File

@ -1,20 +1,32 @@
import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand";
import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; 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 { MailSendService } from "@spt-aki/services/MailSendService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export declare class GiveSptCommand implements ISptCommand { export declare class TraderSptCommand implements ISptCommand {
protected logger: ILogger; protected logger: ILogger;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected presetHelper: PresetHelper; protected presetHelper: PresetHelper;
protected mailSendService: MailSendService; protected mailSendService: MailSendService;
constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, 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; getCommand(): string;
getCommandHelp(): string; getCommandHelp(): string;
performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string;

View File

@ -1,15 +1,10 @@
import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { AbstractDialogueChatBot } from "@spt-aki/helpers/Dialogue/AbstractDialogueChatBot";
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { MailSendService } from "@spt-aki/services/MailSendService"; import { MailSendService } from "@spt-aki/services/MailSendService";
export declare class CommandoDialogueChatBot implements IDialogueChatBot { export declare class CommandoDialogueChatBot extends AbstractDialogueChatBot {
protected logger: ILogger; constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[]);
protected mailSendService: MailSendService;
protected commandoCommands: ICommandoCommand[];
constructor(logger: ILogger, mailSendService: MailSendService, commandoCommands: ICommandoCommand[]);
registerCommandoCommand(commandoCommand: ICommandoCommand): void;
getChatBot(): IUserDialogInfo; getChatBot(): IUserDialogInfo;
handleMessage(sessionId: string, request: ISendMessageRequest): string; protected getUnrecognizedCommandMessage(): string;
} }

View File

@ -162,7 +162,7 @@ export declare class HideoutHelper {
* @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted * @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update

View File

@ -17,7 +17,7 @@ export declare class HttpServerHelper {
constructor(configServer: ConfigServer); constructor(configServer: ConfigServer);
getMimeText(key: string): string; getMimeText(key: string): string;
/** /**
* Combine ip and port into url * Combine ip and port into address
* @returns url * @returns url
*/ */
buildUrl(): string; buildUrl(): string;

View File

@ -1,7 +1,7 @@
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; 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 { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; 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 { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocaleService } from "@spt-aki/services/LocaleService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { CompareUtil } from "@spt-aki/utils/CompareUtil";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil";
@ -28,8 +29,33 @@ export declare class ItemHelper {
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected localeService: LocaleService; protected localeService: LocaleService;
protected compareUtil: CompareUtil;
protected readonly defaultInvalidBaseTypes: string[]; 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<string>): 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<string>): 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 * 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 * @param {string} tpl the template id / tpl
@ -363,10 +389,11 @@ export declare class ItemHelper {
* Chose a randomly weighted cartridge that fits * Chose a randomly weighted cartridge that fits
* @param caliber Desired caliber * @param caliber Desired caliber
* @param staticAmmoDist Cartridges and thier weights * @param staticAmmoDist Cartridges and thier weights
* @param fallbackCartridgeTpl If a cartridge cannot be found in the above staticAmmoDist param, use this instead
* @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @param cartridgeWhitelist OPTIONAL whitelist for cartridges
* @returns Tpl of cartridge * @returns Tpl of cartridge
*/ */
protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, cartridgeWhitelist?: string[]): string; protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, fallbackCartridgeTpl: string, cartridgeWhitelist?: string[]): string;
/** /**
* Create a basic cartrige object * Create a basic cartrige object
* @param parentId container cartridges will be placed in * @param parentId container cartridges will be placed in
@ -401,7 +428,7 @@ export declare class ItemHelper {
addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record<string, number>, requiredOnly?: boolean): Item[]; addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record<string, number>, requiredOnly?: boolean): Item[];
/** /**
* Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter
* @param possibleTpls Tpls to randomply choose from * @param possibleTpls Tpls to randomly choose from
* @param incompatibleModTpls Incompatible tpls to not allow * @param incompatibleModTpls Incompatible tpls to not allow
* @returns Chosen tpl or null * @returns Chosen tpl or null
*/ */

View File

@ -1,4 +1,5 @@
import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals";
import { BaseClasses } from "@spt-aki/models/enums/BaseClasses";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
@ -27,6 +28,13 @@ export declare class PresetHelper {
*/ */
getDefaultEquipmentPresets(): Record<string, IPreset>; getDefaultEquipmentPresets(): Record<string, IPreset>;
isPreset(id: string): boolean; isPreset(id: string): boolean;
/**
* Checks to see if the preset is of the given base class.
* @param id The id of the preset
* @param baseClass The BaseClasses enum to check against
* @returns True if the preset is of the given base class, false otherwise
*/
isPresetBaseClass(id: string, baseClass: BaseClasses): boolean;
hasPreset(templateId: string): boolean; hasPreset(templateId: string): boolean;
getPreset(id: string): IPreset; getPreset(id: string): IPreset;
getAllPresets(): IPreset[]; getAllPresets(): IPreset[];

View File

@ -109,6 +109,9 @@ export interface GenerationWeightingItems {
grenades: GenerationData; grenades: GenerationData;
healing: GenerationData; healing: GenerationData;
drugs: GenerationData; drugs: GenerationData;
food: GenerationData;
drink: GenerationData;
currency: GenerationData;
stims: GenerationData; stims: GenerationData;
backpackLoot: GenerationData; backpackLoot: GenerationData;
pocketLoot: GenerationData; pocketLoot: GenerationData;

View File

@ -145,6 +145,7 @@ export interface IQuestReward {
target?: string; target?: string;
items?: Item[]; items?: Item[];
loyaltyLevel?: number; loyaltyLevel?: number;
/** Hideout area id */
traderId?: string; traderId?: string;
unknown?: boolean; unknown?: boolean;
findInRaid?: boolean; findInRaid?: boolean;

View File

@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest {
} }
export interface ICancelFriendRequestData extends IBaseFriendRequest { export interface ICancelFriendRequestData extends IBaseFriendRequest {
} }
export interface IBaseFriendRequest { export interface IDeclineFriendRequestData extends IBaseFriendRequest {
request_id: string; }
export interface IBaseFriendRequest {
profileId: string;
} }

View File

@ -1,5 +1,5 @@
export interface IFriendRequestSendResponse { export interface IFriendRequestSendResponse {
status: number; status: number;
requestid: string; requestId: string;
retryAfter: number; retryAfter: number;
} }

View File

@ -1,5 +1,5 @@
import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; 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 { export interface IGetOtherProfileResponse {
id: string; id: string;
aid: number; aid: number;

View File

@ -1,9 +1,11 @@
export interface ISearchFriendResponse { export interface ISearchFriendResponse {
_id: string; _id: string;
aid: number;
Info: Info; Info: Info;
} }
export interface Info { export interface Info {
Nickname: string; Nickname: string;
Side: string; Side: string;
Level: number; Level: number;
MemberCategory: number;
} }

View File

@ -216,3 +216,7 @@ export declare enum Ammo26x75 {
WHITE_FLARE = "62389bc9423ed1685422dc57", WHITE_FLARE = "62389bc9423ed1685422dc57",
YELLOW_FLARE = "62389be94d5d474bf712e709" YELLOW_FLARE = "62389be94d5d474bf712e709"
} }
export declare enum Ammo68x51 {
SIG_FMJ = "6529302b8c26af6326029fb7",
SIG_HYBRID = "6529243824cbe3c74a05e5c1"
}

View File

@ -1,5 +1,6 @@
export declare enum Weapons127x55 { export declare enum Weapons127x55 {
ASH_12 = "5cadfbf7ae92152ac412eeef" ASH_12 = "5cadfbf7ae92152ac412eeef",
RSH_12 = "633ec7c2a6918cb895019c6c"
} }
export declare enum Weapons86x70 { export declare enum Weapons86x70 {
MK_18 = "5fc22d7c187fea44d52eda44", MK_18 = "5fc22d7c187fea44d52eda44",
@ -7,14 +8,20 @@ export declare enum Weapons86x70 {
} }
export declare enum Weapons9x39 { export declare enum Weapons9x39 {
AS_VAL = "57c44b372459772d2b39b8ce", AS_VAL = "57c44b372459772d2b39b8ce",
VSS_VINTOREZ = "57838ad32459774a17445cd2" VSS_VINTOREZ = "57838ad32459774a17445cd2",
KBP_9A_91 = "644674a13d52156624001fbc",
VSK_94 = "645e0c6b3b381ede770e1cc9"
} }
export declare enum Weapons762x54R { export declare enum Weapons762x54R {
SVDS = "5c46fbd72e2216398b5a8c9c", SVDS = "5c46fbd72e2216398b5a8c9c",
MP_18 = "61f7c9e189e6fb1a5e3ea78d", MP_18 = "61f7c9e189e6fb1a5e3ea78d",
MOSIN_INFANTRY = "5bfd297f0db834001a669119", MOSIN_INFANTRY = "5bfd297f0db834001a669119",
MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1",
SV_98 = "55801eed4bdc2d89578b4588" SV_98 = "55801eed4bdc2d89578b4588",
AVT_40 = "6410733d5dd49d77bd07847e",
SVT_40 = "643ea5b23db6f9f57107d9fd",
PKM = "64637076203536ad5600c990",
PKP = "64ca3d3954fc657e230529cc"
} }
export declare enum Weapons762x51 { export declare enum Weapons762x51 {
VPO_101 = "5c501a4d2e221602b412b540", VPO_101 = "5c501a4d2e221602b412b540",
@ -46,7 +53,9 @@ export declare enum Weapons762x39 {
AKMSN = "5abcbc27d8ce8700182eceeb", AKMSN = "5abcbc27d8ce8700182eceeb",
MK47_MUTANT = "606587252535c57a13424cfd", MK47_MUTANT = "606587252535c57a13424cfd",
RD_704 = "628a60ae6b1d481ff772e9c8", RD_704 = "628a60ae6b1d481ff772e9c8",
VPO_136 = "59e6152586f77473dc057aa1" VPO_136 = "59e6152586f77473dc057aa1",
RPD = "6513ef33e06849f06c0957ca",
RPDN = "65268d8ecb944ff1e90ea385"
} }
export declare enum Weapons762x35 { export declare enum Weapons762x35 {
MCX = "5fbcc1d9016cce60e8341ab3" MCX = "5fbcc1d9016cce60e8341ab3"
@ -61,7 +70,9 @@ export declare enum Weapons556x45 {
M4A1 = "5447a9cd4bdc2dbd208b4567", M4A1 = "5447a9cd4bdc2dbd208b4567",
SCARL_BLACK = "6184055050224f204c1da540", SCARL_BLACK = "6184055050224f204c1da540",
SCARL_FDE = "618428466ef05c2ce828f218", SCARL_FDE = "618428466ef05c2ce828f218",
TX15_DML = "5d43021ca4b9362eab4b5e25" TX15_DML = "5d43021ca4b9362eab4b5e25",
AUG_A1 = "62e7c4fba689e8c9c50dfc38",
AUG_A3 = "63171672192e68c5460cebc5"
} }
export declare enum Weapons545x39 { export declare enum Weapons545x39 {
AK_105 = "5ac66d9b5acfc4001633997a", AK_105 = "5ac66d9b5acfc4001633997a",
@ -75,7 +86,8 @@ export declare enum Weapons545x39 {
AKS_74UN = "583990e32459771419544dd2", AKS_74UN = "583990e32459771419544dd2",
SAG_AK = "628b5638ad252a16da6dd245", SAG_AK = "628b5638ad252a16da6dd245",
SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", SAG_AK_SHORT = "628b9c37a733087d0d7fe84b",
RPK_16 = "5beed0f50db834001c062b12" RPK_16 = "5beed0f50db834001c062b12",
AK_12 = "6499849fc93611967b034949"
} }
export declare enum Weapons57x28FN { export declare enum Weapons57x28FN {
FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", FN_57_BLACK = "5d3eb3b0a4b93615055e84d2",
@ -97,7 +109,8 @@ export declare enum Weapons9x33R {
CR_50DS = "61a4c8884f95bc3b2c5dc96f" CR_50DS = "61a4c8884f95bc3b2c5dc96f"
} }
export declare enum Weapons9x21 { export declare enum Weapons9x21 {
SR_1MP = "59f98b4986f7746f546d2cef" SR_1MP = "59f98b4986f7746f546d2cef",
SR_2M = "62e14904c2699c0ec93adc47"
} }
export declare enum Weapons9x19 { export declare enum Weapons9x19 {
GLOCK_17 = "5a7ae0c351dfba0017554310", GLOCK_17 = "5a7ae0c351dfba0017554310",
@ -115,7 +128,8 @@ export declare enum Weapons9x19 {
PP_19_01 = "59984ab886f7743e98271174", PP_19_01 = "59984ab886f7743e98271174",
SAIGA_9 = "59f9cabd86f7743a10721f46", SAIGA_9 = "59f9cabd86f7743a10721f46",
STM_9 = "60339954d62c9b14ed777c06", STM_9 = "60339954d62c9b14ed777c06",
VECTOR_9MM = "5fc3f2d5900b1d5091531e57" VECTOR_9MM = "5fc3f2d5900b1d5091531e57",
GLOCK_19X = "63088377b5cd696784087147"
} }
export declare enum Weapons9x18 { export declare enum Weapons9x18 {
APB = "5abccb7dd8ce87001773e277", APB = "5abccb7dd8ce87001773e277",
@ -149,3 +163,10 @@ export declare enum Weapons20Gauge {
export declare enum Weapons23x75 { export declare enum Weapons23x75 {
KS_23M = "5e848cc2988a8701445df1e8" KS_23M = "5e848cc2988a8701445df1e8"
} }
export declare enum Weapons68x51 {
MCX_SPEAR = "65290f395ae2ae97b80fdf2d"
}
export declare enum Weapons40x46 {
M32A1 = "6275303a9f372d6ea97f9ec7",
FN40GL = "5e81ebcd8e146c7080625e15"
}

View File

@ -7,6 +7,9 @@ export interface IBotLootCache {
specialItems: Record<string, number>; specialItems: Record<string, number>;
healingItems: Record<string, number>; healingItems: Record<string, number>;
drugItems: Record<string, number>; drugItems: Record<string, number>;
foodItems: Record<string, number>;
drinkItems: Record<string, number>;
currencyItems: Record<string, number>;
stimItems: Record<string, number>; stimItems: Record<string, number>;
grenadeItems: Record<string, number>; grenadeItems: Record<string, number>;
} }
@ -20,5 +23,8 @@ export declare enum LootCacheType {
HEALING_ITEMS = "HealingItems", HEALING_ITEMS = "HealingItems",
DRUG_ITEMS = "DrugItems", DRUG_ITEMS = "DrugItems",
STIM_ITEMS = "StimItems", STIM_ITEMS = "StimItems",
GRENADE_ITEMS = "GrenadeItems" GRENADE_ITEMS = "GrenadeItems",
FOOD_ITEMS = "FoodItems",
DRINK_ITEMS = "DrinkItems",
CURRENCY_ITEMS = "CurrencyItems"
} }

View File

@ -167,11 +167,8 @@ export interface IAdjustmentDetails {
add: Record<string, Record<string, number>>; add: Record<string, Record<string, number>>;
edit: Record<string, Record<string, number>>; edit: Record<string, Record<string, number>>;
} }
export interface IArmorPlateWeights { export interface IArmorPlateWeights extends Record<string, any> {
levelRange: MinMax; levelRange: MinMax;
frontPlateWeights: Record<string, number>;
backPlateWeights: Record<string, number>;
sidePlateWeights: Record<string, number>;
} }
export interface IRandomisedResourceDetails { export interface IRandomisedResourceDetails {
food: IRandomisedResourceValues; food: IRandomisedResourceValues;

View File

@ -7,6 +7,7 @@ export interface ICoreConfig extends IBaseConfig {
serverName: string; serverName: string;
profileSaveIntervalSeconds: number; profileSaveIntervalSeconds: number;
sptFriendNickname: string; sptFriendNickname: string;
allowProfileWipe: boolean;
bsgLogging: IBsgLogging; bsgLogging: IBsgLogging;
release: IRelease; release: IRelease;
fixes: IGameFixes; fixes: IGameFixes;

View File

@ -7,4 +7,8 @@ export interface IHideoutConfig extends IBaseConfig {
runIntervalValues: IRunIntervalValues; runIntervalValues: IRunIntervalValues;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
expCraftAmount: number; expCraftAmount: number;
overrideCraftTimeSeconds: number;
overrideBuildTimeSeconds: number;
/** Only process a profiles hideout crafts when it has been active in the last x minutes */
updateProfileHideoutWhenActiveWithinMinutes: number;
} }

View File

@ -1,9 +1,13 @@
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IHttpConfig extends IBaseConfig { export interface IHttpConfig extends IBaseConfig {
webSocketPingDelayMs: number;
kind: "aki-http"; kind: "aki-http";
/** Address used by webserver */
ip: string; ip: string;
port: number; port: number;
/** Address used by game client to connect to */
backendIp: string;
backendPort: string;
webSocketPingDelayMs: number;
logRequests: boolean; logRequests: boolean;
/** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */
serverImagePathOverride: Record<string, string>; serverImagePathOverride: Record<string, string>;

View File

@ -36,5 +36,4 @@ export interface RaidMenuSettings {
export interface Save { export interface Save {
/** Should loot gained from raid be saved */ /** Should loot gained from raid be saved */
loot: boolean; loot: boolean;
durability: boolean;
} }

View File

@ -34,8 +34,10 @@ export interface ILocationConfig extends IBaseConfig {
/** How full must a random static magazine be %*/ /** How full must a random static magazine be %*/
minFillStaticMagazinePercent: number; minFillStaticMagazinePercent: number;
allowDuplicateItemsInStaticContainers: boolean; allowDuplicateItemsInStaticContainers: boolean;
/** Chance loose/static magazines have ammo in them */ /** Chance loose magazines have ammo in them TODO - rename to dynamicMagazineLootHasAmmoChancePercent */
magazineLootHasAmmoChancePercent: number; magazineLootHasAmmoChancePercent: number;
/** Chance static magazines have ammo in them */
staticMagazineLootHasAmmoChancePercent: number;
/** Key: map, value: loose loot ids to ignore */ /** Key: map, value: loose loot ids to ignore */
looseLootBlacklist: Record<string, string[]>; looseLootBlacklist: Record<string, string[]>;
/** Key: map, value: settings to control how long scav raids are*/ /** Key: map, value: settings to control how long scav raids are*/

View File

@ -46,6 +46,8 @@ export interface IPmcConfig extends IBaseConfig {
/** Force a number of healing items into PMCs secure container to ensure they can heal */ /** Force a number of healing items into PMCs secure container to ensure they can heal */
forceHealingItemsIntoSecure: boolean; forceHealingItemsIntoSecure: boolean;
allPMCsHavePlayerNameWithRandomPrefixChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number;
/** Should secure container loot from usec.json/bear.json be added to pmc bots secure */
addSecureContainerLootFromBotConfig: boolean;
} }
export interface PmcTypes { export interface PmcTypes {
usec: string; usec: string;

View File

@ -40,6 +40,8 @@ export interface FenceConfig {
presetSlotsToRemoveChancePercent: Record<string, number>; presetSlotsToRemoveChancePercent: Record<string, number>;
/** Block seasonal items from appearing when season is inactive */ /** Block seasonal items from appearing when season is inactive */
blacklistSeasonalItems: boolean; blacklistSeasonalItems: boolean;
/** Max pen value allowed to be listed on flea - affects ammo + ammo boxes */
ammoMaxPenLimit: number;
blacklist: string[]; blacklist: string[];
coopExtractGift: CoopExtractReward; coopExtractGift: CoopExtractReward;
btrDeliveryExpireHours: number; btrDeliveryExpireHours: number;

View File

@ -30,7 +30,15 @@ export interface ISendMessageDetails {
} }
export interface IProfileChangeEvent { export interface IProfileChangeEvent {
_id: string; _id: string;
Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; Type: ProfileChangeEventType;
value: number; value: number;
entity?: string; 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"
}

View File

@ -0,0 +1,7 @@
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader";
export interface ICreateFenceAssortsResult {
sptItems: Item[][];
barter_scheme: Record<string, IBarterScheme[][]>;
loyal_level_items: Record<string, number>;
}

View File

@ -19,11 +19,19 @@ export declare class HttpServer {
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected webSocketServer: WebSocketServer; protected webSocketServer: WebSocketServer;
protected httpConfig: IHttpConfig; protected httpConfig: IHttpConfig;
protected started: boolean;
constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer);
/** /**
* Handle server loading event * Handle server loading event
*/ */
load(): void; load(): void;
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void;
/**
* Check against hardcoded values that determine its from a local address
* @param remoteAddress Address to check
* @returns True if its local
*/
protected isLocalRequest(remoteAddress: string): boolean;
protected getCookies(req: IncomingMessage): Record<string, string>; protected getCookies(req: IncomingMessage): Record<string, string>;
isStarted(): boolean;
} }

View File

@ -69,6 +69,9 @@ export declare class BotLootCacheService {
* @returns * @returns
*/ */
protected isGrenade(props: Props): boolean; protected isGrenade(props: Props): boolean;
protected isFood(tpl: string): boolean;
protected isDrink(tpl: string): boolean;
protected isCurrency(tpl: string): boolean;
/** /**
* Check if a bot type exists inside the loot cache * Check if a bot type exists inside the loot cache
* @param botRole role to check for * @param botRole role to check for

View File

@ -7,6 +7,7 @@ import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader";
import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ICreateFenceAssortsResult } from "@spt-aki/models/spt/fence/ICreateFenceAssortsResult";
import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
@ -37,14 +38,30 @@ export declare class FenceService {
protected fenceAssort: ITraderAssort; protected fenceAssort: ITraderAssort;
/** Assorts shown on a separate tab when you max out fence rep */ /** Assorts shown on a separate tab when you max out fence rep */
protected fenceDiscountAssort: ITraderAssort; protected fenceDiscountAssort: ITraderAssort;
/** Hydrated on initial assort generation as part of generateFenceAssorts() */ /** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */
protected desiredAssortCounts: IFenceAssortGenerationValues; protected desiredAssortCounts: IFenceAssortGenerationValues;
protected fenceItemUpdCompareProperties: Set<string>;
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); 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 * Replace main fence assort with new assort
* @param assort New assorts to replace old with * @param assort New assorts to replace old with
*/ */
setFenceAssort(assort: ITraderAssort): void; setFenceAssort(assort: ITraderAssort): void;
/**
* Replace discount fence assort with new assort
* @param assort New assorts to replace old with
*/
setDiscountFenceAssort(assort: ITraderAssort): void;
/**
* Get main fence assort
* @return ITraderAssort
*/
getMainFenceAssort(): ITraderAssort;
/**
* Get discount fence assort
* @return ITraderAssort
*/
getDiscountFenceAssort(): ITraderAssort;
/** /**
* Replace high rep level fence assort with new assort * Replace high rep level fence assort with new assort
* @param discountAssort New assorts to replace old with * @param discountAssort New assorts to replace old with
@ -57,6 +74,26 @@ export declare class FenceService {
* @returns ITraderAssort * @returns ITraderAssort
*/ */
getFenceAssorts(pmcProfile: IPmcData): 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 * Adjust all items contained inside an assort by a multiplier
* @param assort (clone)Assort that contains items with prices to adjust * @param assort (clone)Assort that contains items with prices to adjust
@ -93,17 +130,23 @@ export declare class FenceService {
* Replace a percentage of fence assorts with freshly generated items * Replace a percentage of fence assorts with freshly generated items
*/ */
performPartialRefresh(): void; performPartialRefresh(): void;
/**
* Handle the process of folding new assorts into existing assorts, when a new assort exists already, increment its StackObjectsCount instead
* @param newFenceAssorts Assorts to fold into existing fence assorts
* @param existingFenceAssorts Current fence assorts new assorts will be added to
*/
protected updateFenceAssorts(newFenceAssorts: ICreateFenceAssortsResult, existingFenceAssorts: ITraderAssort): void;
/** /**
* Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config
*/ */
protected incrementPartialRefreshTime(): void; protected incrementPartialRefreshTime(): void;
/** /**
* Compare the current fence offer count to what the config wants it to be, * Get values that will hydrate the passed in assorts back to the desired counts
* If value is lower add extra count to value to generate more items to fill gap * @param assortItems Current assorts after items have been removed
* @param existingItemCountToReplace count of items to generate * @param generationValues Base counts assorts should be adjusted to
* @returns number of items to generate * @returns IGenerationAssortValues object with adjustments needed to reach desired state
*/ */
protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; protected getItemCountsToGenerate(assortItems: Item[], generationValues: IGenerationAssortValues): IGenerationAssortValues;
/** /**
* Delete desired number of items from assort (including children) * Delete desired number of items from assort (including children)
* @param itemCountToReplace * @param itemCountToReplace
@ -112,8 +155,8 @@ export declare class FenceService {
protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void;
/** /**
* Choose an item at random and remove it + mods from assorts * Choose an item at random and remove it + mods from assorts
* @param assort Items to remove from * @param assort Trader assort to remove item from
* @param rootItems Assort root items to pick from to remove * @param rootItems Pool of root items to pick from to remove
*/ */
protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void; protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void;
/** /**
@ -132,6 +175,12 @@ export declare class FenceService {
* Uses fence base cache generatedon server start as a base * Uses fence base cache generatedon server start as a base
*/ */
generateFenceAssorts(): void; generateFenceAssorts(): void;
/**
* Convert the intermediary assort data generated into format client can process
* @param intermediaryAssorts Generated assorts that will be converted
* @returns ITraderAssort
*/
protected convertIntoFenceAssort(intermediaryAssorts: ICreateFenceAssortsResult): ITraderAssort;
/** /**
* Create object that contains calculated fence assort item values to make based on config * Create object that contains calculated fence assort item values to make based on config
* Stored in this.desiredAssortCounts * Stored in this.desiredAssortCounts
@ -147,7 +196,7 @@ export declare class FenceService {
* @param assortCount Number of assorts to generate * @param assortCount Number of assorts to generate
* @param assorts object to add created assorts to * @param assorts object to add created assorts to
*/ */
protected createAssorts(itemCounts: IGenerationAssortValues, assorts: ITraderAssort, loyaltyLevel: number): void; protected createAssorts(itemCounts: IGenerationAssortValues, loyaltyLevel: number): ICreateFenceAssortsResult;
/** /**
* Add item assorts to existing assort data * Add item assorts to existing assort data
* @param assortCount Number to add * @param assortCount Number to add
@ -156,7 +205,7 @@ export declare class FenceService {
* @param itemTypeLimits * @param itemTypeLimits
* @param loyaltyLevel Loyalty level to set new item to * @param loyaltyLevel Loyalty level to set new item to
*/ */
protected addItemAssorts(assortCount: number, assorts: ITraderAssort, baseFenceAssortClone: ITraderAssort, itemTypeLimits: Record<string, { protected addItemAssorts(assortCount: number, assorts: ICreateFenceAssortsResult, baseFenceAssortClone: ITraderAssort, itemTypeLimits: Record<string, {
current: number; current: number;
max: number; max: number;
}>, loyaltyLevel: number): void; }>, loyaltyLevel: number): void;
@ -165,10 +214,10 @@ export declare class FenceService {
* e.g. salewa hp resource units left * e.g. salewa hp resource units left
* @param rootItemBeingAdded item to look for a match against * @param rootItemBeingAdded item to look for a match against
* @param itemDbDetails Db details of matching item * @param itemDbDetails Db details of matching item
* @param fenceItemAssorts Items to search through * @param itemsWithChildren Items to search through
* @returns Matching assort item * @returns Matching assort item
*/ */
protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, itemsWithChildren: Item[][]): Item;
/** /**
* Should this item be forced into only 1 stack on fence * Should this item be forced into only 1 stack on fence
* @param existingItem Existing item from fence assort * @param existingItem Existing item from fence assort
@ -176,6 +225,7 @@ export declare class FenceService {
* @returns True item should be force stacked * @returns True item should be force stacked
*/ */
protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean; protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean;
protected itemInPreventDupeCategoryList(tpl: string): boolean;
/** /**
* Adjust price of item based on what is left to buy (resource/uses left) * Adjust price of item based on what is left to buy (resource/uses left)
* @param barterSchemes All barter scheme for item having price adjusted * @param barterSchemes All barter scheme for item having price adjusted
@ -197,7 +247,7 @@ export declare class FenceService {
* @param baseFenceAssort Base data to draw from * @param baseFenceAssort Base data to draw from
* @param loyaltyLevel Which loyalty level is required to see/buy item * @param loyaltyLevel Which loyalty level is required to see/buy item
*/ */
protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ITraderAssort, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void; protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ICreateFenceAssortsResult, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void;
/** /**
* Adjust plate / soft insert durability values * Adjust plate / soft insert durability values
* @param armor Armor item array to add mods into * @param armor Armor item array to add mods into

View File

@ -10,6 +10,7 @@ export declare class ItemBaseClassService {
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected itemBaseClassesCache: Record<string, string[]>; protected itemBaseClassesCache: Record<string, string[]>;
protected items: Record<string, ITemplateItem>;
protected cacheGenerated: boolean; protected cacheGenerated: boolean;
constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer);
/** /**
@ -21,9 +22,8 @@ export declare class ItemBaseClassService {
* Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary
* @param itemIdToUpdate item tpl to store base ids against in dictionary * @param itemIdToUpdate item tpl to store base ids against in dictionary
* @param item item being checked * @param item item being checked
* @param allDbItems all items in db
*/ */
protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record<string, ITemplateItem>): void; protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem): void;
/** /**
* Does item tpl inherit from the requested base class * Does item tpl inherit from the requested base class
* @param itemTpl item to check base classes of * @param itemTpl item to check base classes of
@ -31,6 +31,12 @@ export declare class ItemBaseClassService {
* @returns true if item inherits from base class passed in * @returns true if item inherits from base class passed in
*/ */
itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean;
/**
* Check if cached item template is of type Item
* @param itemTemplateId item to check
* @returns true if item is of type Item
*/
private cachedItemIsOfItemType;
/** /**
* Get base classes item inherits from * Get base classes item inherits from
* @param itemTpl item to get base classes for * @param itemTpl item to get base classes for

View File

@ -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 { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile";
import { MessageType } from "@spt-aki/models/enums/MessageType"; import { MessageType } from "@spt-aki/models/enums/MessageType";
import { Traders } from "@spt-aki/models/enums/Traders"; 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 { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer"; import { SaveServer } from "@spt-aki/servers/SaveServer";
@ -55,7 +55,7 @@ export declare class MailSendService {
* @param items Optional items to send to player * @param items Optional items to send to player
* @param maxStorageTimeSeconds Optional time to collect items before they expire * @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 * 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 * @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 items Optional items to send to player
* @param maxStorageTimeSeconds Optional time to collect items before they expire * @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 * Send a USER message to a player with or without items
* @param sessionId The session ID to send the message to * @param sessionId The session ID to send the message to

View File

@ -60,7 +60,7 @@ export declare class PaymentService {
*/ */
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void;
/** /**
* Get all money stacks in inventory and prioritse items in stash * Get all money stacks in inventory and prioritise items in stash
* @param pmcData * @param pmcData
* @param currencyTpl * @param currencyTpl
* @param playerStashId Players stash id * @param playerStashId Players stash id

View File

@ -0,0 +1,21 @@
export declare class ProfileActivityService {
protected profileActivityTimestamps: Record<string, number>;
/**
* Was the requested profile active in the last requested minutes
* @param sessionId Profile to check
* @param minutes Minutes to check for activity in
* @returns True when profile was active within past x minutes
*/
activeWithinLastMinutes(sessionId: string, minutes: number): boolean;
/**
* Get an array of profile ids that were active in the last x minutes
* @param minutes How many minutes from now to search for profiles
* @returns String array of profile ids
*/
getActiveProfileIdsWithinMinutes(minutes: number): string[];
/**
* Update the timestamp a profile was last observed active
* @param sessionId Profile to update
*/
setActivityTimestamp(sessionId: string): void;
}

View File

@ -6,8 +6,9 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Bonus, HideoutSlot } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Bonus, HideoutSlot } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile, IEquipmentBuild, IMagazineBuild, IWeaponBuild } from "@spt-aki/models/eft/profile/IAkiProfile";
import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -119,6 +120,19 @@ export declare class ProfileFixerService {
* @param pmcProfile Profile to check inventory of * @param pmcProfile Profile to check inventory of
*/ */
checkForOrphanedModdedItems(sessionId: string, fullProfile: IAkiProfile): void; checkForOrphanedModdedItems(sessionId: string, fullProfile: IAkiProfile): void;
/**
* @param buildType The type of build, used for logging only
* @param build The build to check for invalid items
* @param itemsDb The items database to use for item lookup
* @returns True if the build should be removed from the build list, false otherwise
*/
protected shouldRemoveWeaponEquipmentBuild(buildType: string, build: IWeaponBuild | IEquipmentBuild, itemsDb: Record<string, ITemplateItem>): boolean;
/**
* @param magazineBuild The magazine build to check for validity
* @param itemsDb The items database to use for item lookup
* @returns True if the build should be removed from the build list, false otherwise
*/
protected shouldRemoveMagazineBuild(magazineBuild: IMagazineBuild, itemsDb: Record<string, ITemplateItem>): boolean;
/** /**
* Attempt to fix common item issues that corrupt profiles * Attempt to fix common item issues that corrupt profiles
* @param pmcProfile Profile to check items of * @param pmcProfile Profile to check items of
@ -155,6 +169,10 @@ export declare class ProfileFixerService {
* @param pmcProfile Profile to add missing IDs to * @param pmcProfile Profile to add missing IDs to
*/ */
addMissingIdsToBonuses(pmcProfile: IPmcData): void; addMissingIdsToBonuses(pmcProfile: IPmcData): void;
/**
* 3.8.0 utilized the wrong ProductionTime for bitcoin, fix it if it's found
*/
fixBitcoinProductionTime(pmcProfile: IPmcData): void;
/** /**
* At some point the property name was changed,migrate data across to new name * At some point the property name was changed,migrate data across to new name
* @param pmcProfile Profile to migrate improvements in * @param pmcProfile Profile to migrate improvements in
@ -165,4 +183,9 @@ export declare class ProfileFixerService {
* @param pmcProfile Profile to remove dead quests from * @param pmcProfile Profile to remove dead quests from
*/ */
protected removeOrphanedQuests(pmcProfile: IPmcData): void; protected removeOrphanedQuests(pmcProfile: IPmcData): void;
/**
* If someone has run a mod from pre-3.8.0, it results in an invalid `nextResupply` value
* Resolve this by setting the nextResupply to 0 if it's null
*/
protected fixNullTraderNextResupply(pmcProfile: IPmcData): void;
} }

View File

@ -45,7 +45,7 @@ export declare class RagfairPriceService implements OnLoad {
/** /**
* Create a dictionary and store prices from prices.json in it * Create a dictionary and store prices from prices.json in it
*/ */
protected generateDynamicPrices(): void; generateDynamicPrices(): void;
/** /**
* Get the dynamic price for an item. If value doesn't exist, use static (handbook) value. * Get the dynamic price for an item. If value doesn't exist, use static (handbook) value.
* if no static value, return 1 * if no static value, return 1
@ -99,6 +99,15 @@ export declare class RagfairPriceService implements OnLoad {
* @returns cost of item in desired currency * @returns cost of item in desired currency
*/ */
getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number; getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number;
/**
* @param itemTemplateId
* @param desiredCurrency
* @param item
* @param offerItems
* @param isPackOffer
* @returns
*/
getDynamicItemPrice(itemTemplateId: string, desiredCurrency: string, item?: Item, offerItems?: Item[], isPackOffer?: boolean): number;
/** /**
* using data from config, adjust an items price to be relative to its handbook price * using data from config, adjust an items price to be relative to its handbook price
* @param handbookPrices Prices of items in handbook * @param handbookPrices Prices of items in handbook

View File

@ -3,6 +3,7 @@ import { OnUpdate } from "@spt-aki/di/OnUpdate";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { HttpServer } from "@spt-aki/servers/HttpServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { EncodingUtil } from "@spt-aki/utils/EncodingUtil"; import { EncodingUtil } from "@spt-aki/utils/EncodingUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
@ -12,11 +13,12 @@ export declare class App {
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected encodingUtil: EncodingUtil; protected encodingUtil: EncodingUtil;
protected httpServer: HttpServer;
protected onLoadComponents: OnLoad[]; protected onLoadComponents: OnLoad[];
protected onUpdateComponents: OnUpdate[]; protected onUpdateComponents: OnUpdate[];
protected onUpdateLastRun: {}; protected onUpdateLastRun: {};
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, configServer: ConfigServer, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, configServer: ConfigServer, encodingUtil: EncodingUtil, httpServer: HttpServer, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
load(): Promise<void>; load(): Promise<void>;
protected update(onUpdateComponents: OnUpdate[]): Promise<void>; protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
protected logUpdateException(err: any, updateable: OnUpdate): void; protected logUpdateException(err: any, updateable: OnUpdate): void;

View File

@ -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;
}

View File

@ -1,9 +1,12 @@
import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper";
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
export declare class RagfairOfferHolder { export declare class RagfairOfferHolder {
protected maxOffersPerTemplate: number;
protected ragfairServerHelper: RagfairServerHelper;
protected offersById: Map<string, IRagfairOffer>; protected offersById: Map<string, IRagfairOffer>;
protected offersByTemplate: Map<string, Map<string, IRagfairOffer>>; protected offersByTemplate: Map<string, Map<string, IRagfairOffer>>;
protected offersByTrader: Map<string, Map<string, IRagfairOffer>>; protected offersByTrader: Map<string, Map<string, IRagfairOffer>>;
constructor(); constructor(maxOffersPerTemplate: number, ragfairServerHelper: RagfairServerHelper);
getOfferById(id: string): IRagfairOffer; getOfferById(id: string): IRagfairOffer;
getOffersByTemplate(templateId: string): Array<IRagfairOffer>; getOffersByTemplate(templateId: string): Array<IRagfairOffer>;
getOffersByTrader(traderId: string): Array<IRagfairOffer>; getOffersByTrader(traderId: string): Array<IRagfairOffer>;

View File

@ -48,6 +48,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger {
protected abstract isLogExceptions(): boolean; protected abstract isLogExceptions(): boolean;
protected abstract getFilePath(): string; protected abstract getFilePath(): string;
protected abstract getFileName(): string; protected abstract getFileName(): string;
protected getLogFrequency(): string;
protected getLogMaxSize(): string; protected getLogMaxSize(): string;
protected getLogMaxFiles(): string; protected getLogMaxFiles(): string;
writeToLogFile(data: string | Daum): Promise<void>; writeToLogFile(data: string | Daum): Promise<void>;

View File

@ -13,7 +13,7 @@ This project is designed to streamline the initial setup process for building an
## **NodeJS Setup** ## **NodeJS Setup**
Before you begin, ensure to install NodeJS version `v18.15.0`, which has been tested thoroughly with our mod templates and build scripts. Download it from the [official NodeJS website](https://nodejs.org/). Before you begin, ensure to install NodeJS version `v20.11.1`, which has been tested thoroughly with our mod templates and build scripts. Download it from the [official NodeJS website](https://nodejs.org/).
After installation, it's advised to reboot your system. After installation, it's advised to reboot your system.

View File

@ -2,6 +2,7 @@ import { BotController } from "@spt-aki/controllers/BotController";
import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Difficulties } from "@spt-aki/models/eft/common/tables/IBotType";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class BotCallbacks { export declare class BotCallbacks {
@ -19,6 +20,11 @@ export declare class BotCallbacks {
* @returns string * @returns string
*/ */
getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string;
/**
* Handle singleplayer/settings/bot/difficulties
* @returns dictionary of every bot and its diffiulty settings
*/
getAllBotDifficulties(url: string, info: IEmptyRequestData, sessionID: string): Record<string, Difficulties>;
/** /**
* Handle client/game/bot/generate * Handle client/game/bot/generate
* @returns IGetBodyResponseData * @returns IGetBodyResponseData

View File

@ -1,7 +1,7 @@
import { DialogueController } from "@spt-aki/controllers/DialogueController"; import { DialogueController } from "@spt-aki/controllers/DialogueController";
import { OnUpdate } from "@spt-aki/di/OnUpdate"; import { OnUpdate } from "@spt-aki/di/OnUpdate";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; 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 { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer";
import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest";
import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest";
@ -73,10 +73,18 @@ export declare class DialogueCallbacks implements OnUpdate {
* Handle client/friend/request/send * Handle client/friend/request/send
*/ */
sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>; sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>;
/**
* Handle client/friend/request/accept-all
*/
acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData;
/** /**
* Handle client/friend/request/accept * Handle client/friend/request/accept
*/ */
acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>; acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
/**
* Handle client/friend/request/decline
*/
declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
/** /**
* Handle client/friend/request/cancel * Handle client/friend/request/cancel
*/ */

View File

@ -39,11 +39,6 @@ export declare class InraidCallbacks {
* @returns JSON as string * @returns JSON as string
*/ */
getRaidMenuSettings(): string; getRaidMenuSettings(): string;
/**
* Handle singleplayer/settings/weapon/durability
* @returns
*/
getWeaponDurability(): string;
/** /**
* Handle singleplayer/airdrop/config * Handle singleplayer/airdrop/config
* @returns JSON as string * @returns JSON as string

View File

@ -51,12 +51,14 @@ export declare class BotController {
getBotCoreDifficulty(): IBotCore; getBotCoreDifficulty(): IBotCore;
/** /**
* Get bot difficulty settings * Get bot difficulty settings
* adjust PMC settings to ensure they engage the correct bot types * Adjust PMC settings to ensure they engage the correct bot types
* @param type what bot the server is requesting settings for * @param type what bot the server is requesting settings for
* @param diffLevel difficulty level server requested settings for * @param diffLevel difficulty level server requested settings for
* @param ignoreRaidSettings should raid settings chosen pre-raid be ignored
* @returns Difficulty object * @returns Difficulty object
*/ */
getBotDifficulty(type: string, diffLevel: string): Difficulty; getBotDifficulty(type: string, diffLevel: string, ignoreRaidSettings?: boolean): Difficulty;
getAllBotDifficulties(): Record<string, any>;
/** /**
* Generate bot profiles and store in cache * Generate bot profiles and store in cache
* @param sessionId Session id * @param sessionId Session id

View File

@ -28,7 +28,7 @@ export declare class BuildController {
saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void;
/** Handle client/builds/delete*/ /** Handle client/builds/delete*/
removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; removeBuild(sessionID: string, request: IRemoveBuildRequestData): void;
protected removePlayerBuild(id: string, sessionID: string): void; protected removePlayerBuild(idToRemove: string, sessionID: string): void;
/** /**
* Handle client/builds/magazine/save * Handle client/builds/magazine/save
*/ */

View File

@ -29,6 +29,7 @@ import { GiftService } from "@spt-aki/services/GiftService";
import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { OpenZoneService } from "@spt-aki/services/OpenZoneService"; import { OpenZoneService } from "@spt-aki/services/OpenZoneService";
import { ProfileActivityService } from "@spt-aki/services/ProfileActivityService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
@ -55,6 +56,7 @@ export declare class GameController {
protected itemBaseClassService: ItemBaseClassService; protected itemBaseClassService: ItemBaseClassService;
protected giftService: GiftService; protected giftService: GiftService;
protected raidTimeAdjustmentService: RaidTimeAdjustmentService; protected raidTimeAdjustmentService: RaidTimeAdjustmentService;
protected profileActivityService: ProfileActivityService;
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected httpConfig: IHttpConfig; protected httpConfig: IHttpConfig;
@ -65,12 +67,14 @@ export declare class GameController {
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, profileActivityService: ProfileActivityService, applicationContext: ApplicationContext, configServer: ConfigServer);
load(): void; load(): void;
/** /**
* Handle client/game/start * Handle client/game/start
*/ */
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
protected adjustHideoutCraftTimes(): void;
protected adjustHideoutBuildTimes(): void;
protected adjustLocationBotValues(): void; protected adjustLocationBotValues(): void;
/** /**
* Out of date/incorrectly made trader mods forget this data * Out of date/incorrectly made trader mods forget this data

View File

@ -34,6 +34,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { FenceService } from "@spt-aki/services/FenceService"; import { FenceService } from "@spt-aki/services/FenceService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { PlayerService } from "@spt-aki/services/PlayerService"; import { PlayerService } from "@spt-aki/services/PlayerService";
import { ProfileActivityService } from "@spt-aki/services/ProfileActivityService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
@ -57,13 +58,14 @@ export declare class HideoutController {
protected hideoutHelper: HideoutHelper; protected hideoutHelper: HideoutHelper;
protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected profileActivityService: ProfileActivityService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected fenceService: FenceService; protected fenceService: FenceService;
/** Key used in TaskConditionCounters array */ /** Key used in TaskConditionCounters array */
protected static nameTaskConditionCountersCrafting: string; protected static nameTaskConditionCountersCrafting: string;
protected hideoutConfig: IHideoutConfig; protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, profileActivityService: ProfileActivityService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService);
/** /**
* Handle HideoutUpgrade event * Handle HideoutUpgrade event
* Start a hideout area upgrade * Start a hideout area upgrade

View File

@ -18,6 +18,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { MailSendService } from "@spt-aki/services/MailSendService"; import { MailSendService } from "@spt-aki/services/MailSendService";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil";
@ -38,10 +39,11 @@ export declare class InsuranceController {
protected paymentService: PaymentService; protected paymentService: PaymentService;
protected insuranceService: InsuranceService; protected insuranceService: InsuranceService;
protected mailSendService: MailSendService; protected mailSendService: MailSendService;
protected ragfairPriceService: RagfairPriceService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
protected roubleTpl: string; protected roubleTpl: string;
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer);
/** /**
* Process insurance items of all profiles prior to being given back to the player through the mail service. * Process insurance items of all profiles prior to being given back to the player through the mail service.
* *
@ -145,7 +147,7 @@ export declare class InsuranceController {
*/ */
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void; protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
/** /**
* Sorts the attachment items by their max price in descending order. * Sorts the attachment items by their dynamic price in descending order.
* *
* @param attachments The array of attachments items. * @param attachments The array of attachments items.
* @returns An array of items enriched with their max price and common locale-name. * @returns An array of items enriched with their max price and common locale-name.
@ -220,6 +222,6 @@ export declare class InsuranceController {
} }
interface EnrichedItem extends Item { interface EnrichedItem extends Item {
name: string; name: string;
maxPrice: number; dynamicPrice: number;
} }
export {}; export {};

View File

@ -44,6 +44,11 @@ export declare class LauncherController {
protected formatID(timeStamp: number, counter: number): string; protected formatID(timeStamp: number, counter: number): string;
changeUsername(info: IChangeRequestData): string; changeUsername(info: IChangeRequestData): string;
changePassword(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string;
/**
* Handle launcher requesting profile be wiped
* @param info IRegisterData
* @returns Session id
*/
wipe(info: IRegisterData): string; wipe(info: IRegisterData): string;
getCompatibleTarkovVersion(): string; getCompatibleTarkovVersion(): string;
/** /**

View File

@ -75,10 +75,11 @@ export declare class MatchController {
protected sendCoopTakenFenceMessage(sessionId: string): void; protected sendCoopTakenFenceMessage(sessionId: string): void;
/** /**
* Handle when a player extracts using a coop extract - add rep to fence * Handle when a player extracts using a coop extract - add rep to fence
* @param sessionId Session/player id
* @param pmcData Profile * @param pmcData Profile
* @param extractName Name of extract taken * @param extractName Name of extract taken
*/ */
protected handleCoopExtract(pmcData: IPmcData, extractName: string): void; protected handleCoopExtract(sessionId: string, pmcData: IPmcData, extractName: string): void;
/** /**
* Was extract by car * Was extract by car
* @param extractName name of extract * @param extractName name of extract

View File

@ -187,12 +187,12 @@ export declare class BotEquipmentModGenerator {
*/ */
protected getRandomModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; protected getRandomModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string;
/** /**
* Log errors if mod is not compatible with slot * Check if mod exists in db + is for a required slot
* @param modToAdd template of mod to check * @param modToAdd Db template of mod to check
* @param slotAddedToTemplate slot the item will be placed in * @param slotAddedToTemplate Slot object the item will be placed as child into
* @param modSlot slot the mod will fill * @param modSlot Slot the mod will fill
* @param parentTemplate template of the mods being added * @param parentTemplate Db template of the mods being added
* @param botRole * @param botRole Bots wildspawntype (assault/pmcBot etc)
* @returns true if valid * @returns true if valid
*/ */
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean; protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean;

View File

@ -80,9 +80,10 @@ export declare class BotGenerator {
* @param botJsonTemplate x.json from database * @param botJsonTemplate x.json from database
* @param botGenerationDetails * @param botGenerationDetails
* @param botRole role of bot e.g. assault * @param botRole role of bot e.g. assault
* @param sessionId profile session id
* @returns Nickname for bot * @returns Nickname for bot
*/ */
protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId?: string): string;
/** /**
* Log the number of PMCs generated to the debug console * Log the number of PMCs generated to the debug console
* @param output Generated bot array, ready to send to client * @param output Generated bot array, ready to send to client

View File

@ -82,7 +82,7 @@ export declare class BotLootGenerator {
* @param totalValueLimitRub Total value of loot allowed in roubles * @param totalValueLimitRub Total value of loot allowed in roubles
* @param isPmc Is bot being generated for a pmc * @param isPmc Is bot being generated for a pmc
*/ */
protected addLootFromPool(pool: Record<string, number>, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; protected addLootFromPool(pool: Record<string, number>, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set<string>): void;
protected createWalletLoot(walletId: string): Item[][]; protected createWalletLoot(walletId: string): Item[][];
/** /**
* Some items need child items to function, add them to the itemToAddChildrenTo array * 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 botRole bots role .e.g. pmcBot
* @param isPmc are we generating for a pmc * @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<string>): void;
/** /**
* Hydrate item limit array to contain items that have a limit for a specific bot type * Hydrate item limit array to contain items that have a limit for a specific bot type
* All values are set to 0 * All values are set to 0

View File

@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { FenceService } from "@spt-aki/services/FenceService";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
@ -22,14 +23,25 @@ export declare class FenceBaseAssortGenerator {
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
protected seasonalEventService: SeasonalEventService; protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected fenceService: FenceService;
protected traderConfig: ITraderConfig; 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 * Create base fence assorts dynamically and store in memory
*/ */
generateFenceBaseAssorts(): void; generateFenceBaseAssorts(): void;
protected getItemPrice(itemTpl: string, items: Item[]): number; /**
protected getAmmoBoxPrice(items: Item[]): number; * Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit
* @param rootItemDb Ammo box or ammo item from items.db
* @returns True if penetration value is above limit set in config
*/
protected isAmmoAbovePenetrationLimit(rootItemDb: ITemplateItem): boolean;
/**
* Get the penetration power value of an ammo, works with ammo boxes and raw ammos
* @param rootItemDb Ammo box or ammo item from items.db
* @returns Penetration power of passed in item, null if it doesnt have a power
*/
protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number;
/** /**
* Add soft inserts + armor plates to an armor * Add soft inserts + armor plates to an armor
* @param armor Armor item array to add mods into * @param armor Armor item array to add mods into

View File

@ -41,10 +41,10 @@ export declare class LootGenerator {
*/ */
createRandomLoot(options: LootRequest): LootItem[]; createRandomLoot(options: LootRequest): LootItem[];
/** /**
* Filter armor items by their main plates protection level * Filter armor items by their front plates protection level - top if its a helmet
* @param armor Armor preset * @param armor Armor preset to check
* @param options Loot request options * @param options Loot request options - armor level etc
* @returns True item passes checks * @returns True if item has desired armor level
*/ */
protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean;
/** /**
@ -74,13 +74,13 @@ export declare class LootGenerator {
protected getRandomisedStackCount(item: ITemplateItem, options: LootRequest): number; protected getRandomisedStackCount(item: ITemplateItem, options: LootRequest): number;
/** /**
* Find a random item in items.json and add to result array * Find a random item in items.json and add to result array
* @param globalDefaultPresets presets to choose from * @param presetPool Presets to choose from
* @param itemTypeCounts item limit counts * @param itemTypeCounts Item limit counts
* @param itemBlacklist items to skip * @param itemBlacklist Items to skip
* @param result array to add found preset to * @param result Array to add chosen preset to
* @returns true if preset was valid and added to pool * @returns true if preset was valid and added to pool
*/ */
protected findAndAddRandomPresetToLoot(globalDefaultPresets: IPreset[], itemTypeCounts: Record<string, { protected findAndAddRandomPresetToLoot(presetPool: IPreset[], itemTypeCounts: Record<string, {
current: number; current: number;
max: number; max: number;
}>, itemBlacklist: string[], result: LootItem[]): boolean; }>, itemBlacklist: string[], result: LootItem[]): boolean;

View File

@ -58,7 +58,7 @@ export declare class RepeatableQuestRewardGenerator {
* @param minPrice The minimum priced item to include * @param minPrice The minimum priced item to include
* @returns True if any items remain in `rewardItems`, false otherwise * @returns True if any items remain in `rewardItems`, false otherwise
*/ */
protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean; protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): ITemplateItem[];
/** /**
* Get a randomised number a reward items stack size should be based on its handbook price * Get a randomised number a reward items stack size should be based on its handbook price
* @param item Reward item to get stack size for * @param item Reward item to get stack size for

View File

@ -92,7 +92,7 @@ export declare class BotGeneratorHelper {
* @param inventory Inventory to add item+children into * @param inventory Inventory to add item+children into
* @returns ItemAddedResult result object * @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<string>): ItemAddedResult;
/** /**
* Is the provided item allowed inside a container * Is the provided item allowed inside a container
* @param slotGrid Items sub-grid we want to place item inside * @param slotGrid Items sub-grid we want to place item inside

View File

@ -0,0 +1,20 @@
import { IChatCommand, ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand";
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot";
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 { MailSendService } from "@spt-aki/services/MailSendService";
export declare abstract class AbstractDialogueChatBot implements IDialogueChatBot {
protected logger: ILogger;
protected mailSendService: MailSendService;
protected chatCommands: IChatCommand[] | ICommandoCommand[];
constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[] | ICommandoCommand[]);
/**
* @deprecated As of v3.7.6. Use registerChatCommand.
*/
registerCommandoCommand(chatCommand: IChatCommand | ICommandoCommand): void;
registerChatCommand(chatCommand: IChatCommand | ICommandoCommand): void;
abstract getChatBot(): IUserDialogInfo;
protected abstract getUnrecognizedCommandMessage(): string;
handleMessage(sessionId: string, request: ISendMessageRequest): string;
}

View File

@ -1,6 +1,10 @@
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
export interface ICommandoCommand { /**
* @deprecated As of v3.7.6. Use IChatCommand. Will be removed in v3.9.0.
*/
export type ICommandoCommand = IChatCommand;
export interface IChatCommand {
getCommandPrefix(): string; getCommandPrefix(): string;
getCommandHelp(command: string): string; getCommandHelp(command: string): string;
getCommands(): Set<string>; getCommands(): Set<string>;

View File

@ -1,9 +1,9 @@
import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand";
import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
export declare class SptCommandoCommands implements ICommandoCommand { export declare class SptCommandoCommands implements IChatCommand {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected sptCommands: ISptCommand[]; protected sptCommands: ISptCommand[];
constructor(configServer: ConfigServer, sptCommands: ISptCommand[]); constructor(configServer: ConfigServer, sptCommands: ISptCommand[]);

View File

@ -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<string, SavedCommand>;
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;
}

View File

@ -0,0 +1,6 @@
export declare class SavedCommand {
quantity: number;
potentialItemNames: string[];
locale: string;
constructor(quantity: number, potentialItemNames: string[], locale: string);
}

View File

@ -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;
}

View File

@ -1,20 +1,32 @@
import { SavedCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand";
import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; 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 { MailSendService } from "@spt-aki/services/MailSendService";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export declare class GiveSptCommand implements ISptCommand { export declare class TraderSptCommand implements ISptCommand {
protected logger: ILogger; protected logger: ILogger;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected presetHelper: PresetHelper; protected presetHelper: PresetHelper;
protected mailSendService: MailSendService; protected mailSendService: MailSendService;
constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, 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; getCommand(): string;
getCommandHelp(): string; getCommandHelp(): string;
performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string;

View File

@ -1,15 +1,10 @@
import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; import { AbstractDialogueChatBot } from "@spt-aki/helpers/Dialogue/AbstractDialogueChatBot";
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; import { IChatCommand } from "@spt-aki/helpers/Dialogue/Commando/IChatCommand";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { MailSendService } from "@spt-aki/services/MailSendService"; import { MailSendService } from "@spt-aki/services/MailSendService";
export declare class CommandoDialogueChatBot implements IDialogueChatBot { export declare class CommandoDialogueChatBot extends AbstractDialogueChatBot {
protected logger: ILogger; constructor(logger: ILogger, mailSendService: MailSendService, chatCommands: IChatCommand[]);
protected mailSendService: MailSendService;
protected commandoCommands: ICommandoCommand[];
constructor(logger: ILogger, mailSendService: MailSendService, commandoCommands: ICommandoCommand[]);
registerCommandoCommand(commandoCommand: ICommandoCommand): void;
getChatBot(): IUserDialogInfo; getChatBot(): IUserDialogInfo;
handleMessage(sessionId: string, request: ISendMessageRequest): string; protected getUnrecognizedCommandMessage(): string;
} }

View File

@ -162,7 +162,7 @@ export declare class HideoutHelper {
* @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted * @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update

View File

@ -17,7 +17,7 @@ export declare class HttpServerHelper {
constructor(configServer: ConfigServer); constructor(configServer: ConfigServer);
getMimeText(key: string): string; getMimeText(key: string): string;
/** /**
* Combine ip and port into url * Combine ip and port into address
* @returns url * @returns url
*/ */
buildUrl(): string; buildUrl(): string;

View File

@ -1,7 +1,7 @@
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; 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 { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; 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 { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocaleService } from "@spt-aki/services/LocaleService"; import { LocaleService } from "@spt-aki/services/LocaleService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { CompareUtil } from "@spt-aki/utils/CompareUtil";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil";
@ -28,8 +29,33 @@ export declare class ItemHelper {
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected localeService: LocaleService; protected localeService: LocaleService;
protected compareUtil: CompareUtil;
protected readonly defaultInvalidBaseTypes: string[]; 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<string>): 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<string>): 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 * 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 * @param {string} tpl the template id / tpl
@ -363,10 +389,11 @@ export declare class ItemHelper {
* Chose a randomly weighted cartridge that fits * Chose a randomly weighted cartridge that fits
* @param caliber Desired caliber * @param caliber Desired caliber
* @param staticAmmoDist Cartridges and thier weights * @param staticAmmoDist Cartridges and thier weights
* @param fallbackCartridgeTpl If a cartridge cannot be found in the above staticAmmoDist param, use this instead
* @param cartridgeWhitelist OPTIONAL whitelist for cartridges * @param cartridgeWhitelist OPTIONAL whitelist for cartridges
* @returns Tpl of cartridge * @returns Tpl of cartridge
*/ */
protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, cartridgeWhitelist?: string[]): string; protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, fallbackCartridgeTpl: string, cartridgeWhitelist?: string[]): string;
/** /**
* Create a basic cartrige object * Create a basic cartrige object
* @param parentId container cartridges will be placed in * @param parentId container cartridges will be placed in
@ -401,7 +428,7 @@ export declare class ItemHelper {
addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record<string, number>, requiredOnly?: boolean): Item[]; addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record<string, number>, requiredOnly?: boolean): Item[];
/** /**
* Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter
* @param possibleTpls Tpls to randomply choose from * @param possibleTpls Tpls to randomly choose from
* @param incompatibleModTpls Incompatible tpls to not allow * @param incompatibleModTpls Incompatible tpls to not allow
* @returns Chosen tpl or null * @returns Chosen tpl or null
*/ */

View File

@ -1,4 +1,5 @@
import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; import { IPreset } from "@spt-aki/models/eft/common/IGlobals";
import { BaseClasses } from "@spt-aki/models/enums/BaseClasses";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
@ -27,6 +28,13 @@ export declare class PresetHelper {
*/ */
getDefaultEquipmentPresets(): Record<string, IPreset>; getDefaultEquipmentPresets(): Record<string, IPreset>;
isPreset(id: string): boolean; isPreset(id: string): boolean;
/**
* Checks to see if the preset is of the given base class.
* @param id The id of the preset
* @param baseClass The BaseClasses enum to check against
* @returns True if the preset is of the given base class, false otherwise
*/
isPresetBaseClass(id: string, baseClass: BaseClasses): boolean;
hasPreset(templateId: string): boolean; hasPreset(templateId: string): boolean;
getPreset(id: string): IPreset; getPreset(id: string): IPreset;
getAllPresets(): IPreset[]; getAllPresets(): IPreset[];

View File

@ -109,6 +109,9 @@ export interface GenerationWeightingItems {
grenades: GenerationData; grenades: GenerationData;
healing: GenerationData; healing: GenerationData;
drugs: GenerationData; drugs: GenerationData;
food: GenerationData;
drink: GenerationData;
currency: GenerationData;
stims: GenerationData; stims: GenerationData;
backpackLoot: GenerationData; backpackLoot: GenerationData;
pocketLoot: GenerationData; pocketLoot: GenerationData;

View File

@ -145,6 +145,7 @@ export interface IQuestReward {
target?: string; target?: string;
items?: Item[]; items?: Item[];
loyaltyLevel?: number; loyaltyLevel?: number;
/** Hideout area id */
traderId?: string; traderId?: string;
unknown?: boolean; unknown?: boolean;
findInRaid?: boolean; findInRaid?: boolean;

View File

@ -2,6 +2,8 @@ export interface IAcceptFriendRequestData extends IBaseFriendRequest {
} }
export interface ICancelFriendRequestData extends IBaseFriendRequest { export interface ICancelFriendRequestData extends IBaseFriendRequest {
} }
export interface IBaseFriendRequest { export interface IDeclineFriendRequestData extends IBaseFriendRequest {
request_id: string; }
export interface IBaseFriendRequest {
profileId: string;
} }

View File

@ -1,5 +1,5 @@
export interface IFriendRequestSendResponse { export interface IFriendRequestSendResponse {
status: number; status: number;
requestid: string; requestId: string;
retryAfter: number; retryAfter: number;
} }

View File

@ -1,5 +1,5 @@
import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; 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 { export interface IGetOtherProfileResponse {
id: string; id: string;
aid: number; aid: number;

View File

@ -1,9 +1,11 @@
export interface ISearchFriendResponse { export interface ISearchFriendResponse {
_id: string; _id: string;
aid: number;
Info: Info; Info: Info;
} }
export interface Info { export interface Info {
Nickname: string; Nickname: string;
Side: string; Side: string;
Level: number; Level: number;
MemberCategory: number;
} }

View File

@ -216,3 +216,7 @@ export declare enum Ammo26x75 {
WHITE_FLARE = "62389bc9423ed1685422dc57", WHITE_FLARE = "62389bc9423ed1685422dc57",
YELLOW_FLARE = "62389be94d5d474bf712e709" YELLOW_FLARE = "62389be94d5d474bf712e709"
} }
export declare enum Ammo68x51 {
SIG_FMJ = "6529302b8c26af6326029fb7",
SIG_HYBRID = "6529243824cbe3c74a05e5c1"
}

Some files were not shown because too many files have changed in this diff Show More