Initial release for SPT 3.9
This commit is contained in:
99
types/services/BotEquipmentFilterService.d.ts
vendored
Normal file
99
types/services/BotEquipmentFilterService.d.ts
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt/models/eft/common/tables/IBotType";
|
||||
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
|
||||
import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt/models/spt/config/IBotConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
export declare class BotEquipmentFilterService {
|
||||
protected logger: ILogger;
|
||||
protected botHelper: BotHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected configServer: ConfigServer;
|
||||
protected botConfig: IBotConfig;
|
||||
protected botEquipmentConfig: Record<string, EquipmentFilters>;
|
||||
constructor(logger: ILogger, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
|
||||
/**
|
||||
* Filter a bots data to exclude equipment and cartridges defines in the botConfig
|
||||
* @param sessionId Players id
|
||||
* @param baseBotNode bots json data to filter
|
||||
* @param botLevel Level of the bot
|
||||
* @param botGenerationDetails details on how to generate a bot
|
||||
*/
|
||||
filterBotEquipment(sessionId: string, baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void;
|
||||
/**
|
||||
* Iterate over the changes passed in and apply them to baseValues parameter
|
||||
* @param equipmentChanges Changes to apply
|
||||
* @param baseValues data to update
|
||||
*/
|
||||
protected adjustChances(equipmentChanges: Record<string, number>, baseValues: EquipmentChances | ModsChances): void;
|
||||
/**
|
||||
* Iterate over the Generation changes and alter data in baseValues.Generation
|
||||
* @param generationChanges Changes to apply
|
||||
* @param baseBotGeneration dictionary to update
|
||||
*/
|
||||
protected adjustGenerationChances(generationChanges: Record<string, GenerationData>, baseBotGeneration: Generation): void;
|
||||
/**
|
||||
* Get equipment settings for bot
|
||||
* @param botEquipmentRole equipment role to return
|
||||
* @returns EquipmentFilters object
|
||||
*/
|
||||
getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters;
|
||||
/**
|
||||
* Get weapon sight whitelist for a specific bot type
|
||||
* @param botEquipmentRole equipment role of bot to look up
|
||||
* @returns Dictionary of weapon type and their whitelisted scope types
|
||||
*/
|
||||
getBotWeaponSightWhitelist(botEquipmentRole: string): Record<string, string[]> | undefined;
|
||||
/**
|
||||
* Get an object that contains equipment and cartridge blacklists for a specified bot type
|
||||
* @param botRole Role of the bot we want the blacklist for
|
||||
* @param playerLevel Level of the player
|
||||
* @returns EquipmentBlacklistDetails object
|
||||
*/
|
||||
getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails | undefined;
|
||||
/**
|
||||
* Get the whitelist for a specific bot type that's within the players level
|
||||
* @param botRole Bot type
|
||||
* @param playerLevel Players level
|
||||
* @returns EquipmentFilterDetails object
|
||||
*/
|
||||
protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails | undefined;
|
||||
/**
|
||||
* Retrieve item weighting adjustments from bot.json config based on bot level
|
||||
* @param botRole Bot type to get adjustments for
|
||||
* @param botLevel Level of bot
|
||||
* @returns Weighting adjustments for bot items
|
||||
*/
|
||||
protected getBotWeightingAdjustments(botRole: string, botLevel: number): WeightingAdjustmentDetails | undefined;
|
||||
/**
|
||||
* Retrieve item weighting adjustments from bot.json config based on player level
|
||||
* @param botRole Bot type to get adjustments for
|
||||
* @param playerlevel Level of bot
|
||||
* @returns Weighting adjustments for bot items
|
||||
*/
|
||||
protected getBotWeightingAdjustmentsByPlayerLevel(botRole: string, playerlevel: number): WeightingAdjustmentDetails | undefined;
|
||||
/**
|
||||
* Filter bot equipment based on blacklist and whitelist from config/bot.json
|
||||
* Prioritizes whitelist first, if one is found blacklist is ignored
|
||||
* @param baseBotNode bot .json file to update
|
||||
* @param blacklist equipment blacklist
|
||||
* @returns Filtered bot file
|
||||
*/
|
||||
protected filterEquipment(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void;
|
||||
/**
|
||||
* Filter bot cartridges based on blacklist and whitelist from config/bot.json
|
||||
* Prioritizes whitelist first, if one is found blacklist is ignored
|
||||
* @param baseBotNode bot .json file to update
|
||||
* @param blacklist equipment on this list should be excluded from the bot
|
||||
* @param whitelist equipment on this list should be used exclusively
|
||||
* @returns Filtered bot file
|
||||
*/
|
||||
protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void;
|
||||
/**
|
||||
* Add/Edit weighting changes to bot items using values from config/bot.json/equipment
|
||||
* @param weightingAdjustments Weighting change to apply to bot
|
||||
* @param botItemPool Bot item dictionary to adjust
|
||||
*/
|
||||
protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record<string, any>, showEditWarnings?: boolean): void;
|
||||
}
|
||||
67
types/services/BotEquipmentModPoolService.d.ts
vendored
Normal file
67
types/services/BotEquipmentModPoolService.d.ts
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { Mods } from "@spt/models/eft/common/tables/IBotType";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { VFS } from "@spt/utils/VFS";
|
||||
/** Store a mapping between weapons, their slots and the items that fit those slots */
|
||||
export declare class BotEquipmentModPoolService {
|
||||
protected logger: ILogger;
|
||||
protected vfs: VFS;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected databaseService: DatabaseService;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected botConfig: IBotConfig;
|
||||
protected weaponModPool: Mods;
|
||||
protected gearModPool: Mods;
|
||||
protected weaponPoolGenerated: boolean;
|
||||
protected armorPoolGenerated: boolean;
|
||||
constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseService: DatabaseService, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
/**
|
||||
* Store dictionary of mods for each item passed in
|
||||
* @param items items to find related mods and store in modPool
|
||||
*/
|
||||
protected generatePool(items: ITemplateItem[], poolType: string): void;
|
||||
/**
|
||||
* Empty the mod pool
|
||||
*/
|
||||
resetPool(): void;
|
||||
/**
|
||||
* Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already)
|
||||
* @param itemTpl item to look up
|
||||
* @param slotName slot to get compatible mods for
|
||||
* @returns tpls that fit the slot
|
||||
*/
|
||||
getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[];
|
||||
/**
|
||||
* Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already)
|
||||
* @param itemTpl item to look up
|
||||
* @param slotName slot to get compatible mods for
|
||||
* @returns tpls that fit the slot
|
||||
*/
|
||||
getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[];
|
||||
/**
|
||||
* Get mods for a piece of gear by its tpl
|
||||
* @param itemTpl items tpl to look up mods for
|
||||
* @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value
|
||||
*/
|
||||
getModsForGearSlot(itemTpl: string): Record<string, string[]>;
|
||||
/**
|
||||
* Get mods for a weapon by its tpl
|
||||
* @param itemTpl Weapons tpl to look up mods for
|
||||
* @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value
|
||||
*/
|
||||
getModsForWeaponSlot(itemTpl: string): Record<string, string[]>;
|
||||
/**
|
||||
* Create weapon mod pool and set generated flag to true
|
||||
*/
|
||||
protected generateWeaponPool(): void;
|
||||
/**
|
||||
* Create gear mod pool and set generated flag to true
|
||||
*/
|
||||
protected generateGearPool(): void;
|
||||
}
|
||||
47
types/services/BotGenerationCacheService.d.ts
vendored
Normal file
47
types/services/BotGenerationCacheService.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
export declare class BotGenerationCacheService {
|
||||
protected logger: ILogger;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected botHelper: BotHelper;
|
||||
protected storedBots: Map<string, IBotBase[]>;
|
||||
protected activeBotsInRaid: IBotBase[];
|
||||
constructor(logger: ILogger, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper);
|
||||
/**
|
||||
* Store array of bots in cache, shuffle results before storage
|
||||
* @param botsToStore Bots we want to store in the cache
|
||||
*/
|
||||
storeBots(key: string, botsToStore: IBotBase[]): void;
|
||||
/**
|
||||
* Find and return a bot based on its role
|
||||
* Remove bot from internal array so it can't be retreived again
|
||||
* @param key role to retreive (assault/bossTagilla etc)
|
||||
* @returns IBotBase object
|
||||
*/
|
||||
getBot(key: string): IBotBase;
|
||||
/**
|
||||
* Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav
|
||||
* @param botToStore Bot object to store
|
||||
*/
|
||||
storeUsedBot(botToStore: IBotBase): void;
|
||||
/**
|
||||
* Get a bot by its profileId that has been generated and sent to client for current raid
|
||||
* Cache is wiped post-raid in client/match/offline/end endOfflineRaid()
|
||||
* @param profileId Id of bot to get
|
||||
* @returns IBotBase
|
||||
*/
|
||||
getUsedBot(profileId: string): IBotBase;
|
||||
/**
|
||||
* Remove all cached bot profiles from memory
|
||||
*/
|
||||
clearStoredBots(): void;
|
||||
/**
|
||||
* Does cache have a bot with requested key
|
||||
* @returns false if empty
|
||||
*/
|
||||
cacheHasBotOfRole(key: string): boolean;
|
||||
}
|
||||
96
types/services/BotLootCacheService.d.ts
vendored
Normal file
96
types/services/BotLootCacheService.d.ts
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import { PMCLootGenerator } from "@spt/generators/PMCLootGenerator";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { IBotType } from "@spt/models/eft/common/tables/IBotType";
|
||||
import { ITemplateItem, Props } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { IBotLootCache, LootCacheType } from "@spt/models/spt/bots/IBotLootCache";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
export declare class BotLootCacheService {
|
||||
protected logger: ILogger;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected databaseServer: DatabaseServer;
|
||||
protected pmcLootGenerator: PMCLootGenerator;
|
||||
protected localisationService: LocalisationService;
|
||||
protected ragfairPriceService: RagfairPriceService;
|
||||
protected cloner: ICloner;
|
||||
protected lootCache: Record<string, IBotLootCache>;
|
||||
constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, cloner: ICloner);
|
||||
/**
|
||||
* Remove cached bot loot data
|
||||
*/
|
||||
clearCache(): void;
|
||||
/**
|
||||
* Get the fully created loot array, ordered by price low to high
|
||||
* @param botRole bot to get loot for
|
||||
* @param isPmc is the bot a pmc
|
||||
* @param lootType what type of loot is needed (backpack/pocket/stim/vest etc)
|
||||
* @param botJsonTemplate Base json db file for the bot having its loot generated
|
||||
* @returns ITemplateItem array
|
||||
*/
|
||||
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record<string, number>;
|
||||
/**
|
||||
* Generate loot for a bot and store inside a private class property
|
||||
* @param botRole bots role (assault / pmcBot etc)
|
||||
* @param isPmc Is the bot a PMC (alteres what loot is cached)
|
||||
* @param botJsonTemplate db template for bot having its loot generated
|
||||
*/
|
||||
protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void;
|
||||
/**
|
||||
* Add unique items into combined pool
|
||||
* @param poolToAddTo Pool of items to add to
|
||||
* @param itemsToAdd items to add to combined pool if unique
|
||||
*/
|
||||
protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void;
|
||||
protected addItemsToPool(poolToAddTo: Record<string, number>, poolOfItemsToAdd: Record<string, number>): void;
|
||||
/**
|
||||
* Ammo/grenades have this property
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
protected isBulletOrGrenade(props: Props): boolean;
|
||||
/**
|
||||
* Internal and external magazine have this property
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
protected isMagazine(props: Props): boolean;
|
||||
/**
|
||||
* Medical use items (e.g. morphine/lip balm/grizzly)
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
protected isMedicalItem(props: Props): boolean;
|
||||
/**
|
||||
* Grenades have this property (e.g. smoke/frag/flash grenades)
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
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
|
||||
* @param botRole role to check for
|
||||
* @returns true if they exist
|
||||
*/
|
||||
protected botRoleExistsInCache(botRole: string): boolean;
|
||||
/**
|
||||
* If lootcache is undefined, init with empty property arrays
|
||||
* @param botRole Bot role to hydrate
|
||||
*/
|
||||
protected initCacheForBotRole(botRole: string): void;
|
||||
/**
|
||||
* Compares two item prices by their flea (or handbook if that doesnt exist) price
|
||||
* -1 when a < b
|
||||
* 0 when a === b
|
||||
* 1 when a > b
|
||||
* @param itemAPrice
|
||||
* @param itemBPrice
|
||||
* @returns
|
||||
*/
|
||||
protected compareByValue(itemAPrice: number, itemBPrice: number): number;
|
||||
}
|
||||
54
types/services/BotWeaponModLimitService.d.ts
vendored
Normal file
54
types/services/BotWeaponModLimitService.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
export declare class BotModLimits {
|
||||
scope: ItemCount;
|
||||
scopeMax: number;
|
||||
scopeBaseTypes: string[];
|
||||
flashlightLaser: ItemCount;
|
||||
flashlightLaserMax: number;
|
||||
flashlgihtLaserBaseTypes: string[];
|
||||
}
|
||||
export declare class ItemCount {
|
||||
count: number;
|
||||
}
|
||||
export declare class BotWeaponModLimitService {
|
||||
protected logger: ILogger;
|
||||
protected configServer: ConfigServer;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected botConfig: IBotConfig;
|
||||
constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper);
|
||||
/**
|
||||
* Initalise mod limits to be used when generating a weapon
|
||||
* @param botRole "assault", "bossTagilla" or "pmc"
|
||||
* @returns BotModLimits object
|
||||
*/
|
||||
getWeaponModLimits(botRole: string): BotModLimits;
|
||||
/**
|
||||
* Check if weapon mod item is on limited list + has surpassed the limit set for it
|
||||
* Exception: Always allow ncstar backup mount
|
||||
* Exception: Always allow scopes with a scope for a parent
|
||||
* Exception: Always disallow mounts that hold only scopes once scope limit reached
|
||||
* Exception: Always disallow mounts that hold only flashlights once flashlight limit reached
|
||||
* @param botRole role the bot has e.g. assault
|
||||
* @param modTemplate mods template data
|
||||
* @param modLimits limits set for weapon being generated for this bot
|
||||
* @param modsParent The parent of the mod to be checked
|
||||
* @returns true if over item limit
|
||||
*/
|
||||
weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean;
|
||||
/**
|
||||
* Check if the specific item type on the weapon has reached the set limit
|
||||
* @param modTpl log mod tpl if over type limit
|
||||
* @param currentCount current number of this item on gun
|
||||
* @param maxLimit mod limit allowed
|
||||
* @param botRole role of bot we're checking weapon of
|
||||
* @returns true if limit reached
|
||||
*/
|
||||
protected weaponModLimitReached(modTpl: string, currentCount: {
|
||||
count: number;
|
||||
}, maxLimit: number, botRole: string): boolean;
|
||||
}
|
||||
40
types/services/CustomLocationWaveService.d.ts
vendored
Normal file
40
types/services/CustomLocationWaveService.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { BossLocationSpawn, Wave } from "@spt/models/eft/common/ILocationBase";
|
||||
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
export declare class CustomLocationWaveService {
|
||||
protected logger: ILogger;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected databaseService: DatabaseService;
|
||||
protected configServer: ConfigServer;
|
||||
protected locationConfig: ILocationConfig;
|
||||
constructor(logger: ILogger, randomUtil: RandomUtil, databaseService: DatabaseService, configServer: ConfigServer);
|
||||
/**
|
||||
* Add a boss wave to a map
|
||||
* @param locationId e.g. factory4_day, bigmap
|
||||
* @param waveToAdd Boss wave to add to map
|
||||
*/
|
||||
addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void;
|
||||
/**
|
||||
* Add a normal bot wave to a map
|
||||
* @param locationId e.g. factory4_day, bigmap
|
||||
* @param waveToAdd Wave to add to map
|
||||
*/
|
||||
addNormalWaveToMap(locationId: string, waveToAdd: Wave): void;
|
||||
/**
|
||||
* Clear all custom boss waves from a map
|
||||
* @param locationId e.g. factory4_day, bigmap
|
||||
*/
|
||||
clearBossWavesForMap(locationId: string): void;
|
||||
/**
|
||||
* Clear all custom normal waves from a map
|
||||
* @param locationId e.g. factory4_day, bigmap
|
||||
*/
|
||||
clearNormalWavesForMap(locationId: string): void;
|
||||
/**
|
||||
* Add custom boss and normal waves to maps found in config/location.json to db
|
||||
*/
|
||||
applyWaveChangesToAllMaps(): void;
|
||||
}
|
||||
113
types/services/DatabaseService.d.ts
vendored
Normal file
113
types/services/DatabaseService.d.ts
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
import { IGlobals } from "@spt/models/eft/common/IGlobals";
|
||||
import { ILocation } from "@spt/models/eft/common/ILocation";
|
||||
import { IAchievement } from "@spt/models/eft/common/tables/IAchievement";
|
||||
import { ICustomizationItem } from "@spt/models/eft/common/tables/ICustomizationItem";
|
||||
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
||||
import { IMatch } from "@spt/models/eft/common/tables/IMatch";
|
||||
import { IProfileTemplates } from "@spt/models/eft/common/tables/IProfileTemplate";
|
||||
import { IQuest } from "@spt/models/eft/common/tables/IQuest";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { ITrader } from "@spt/models/eft/common/tables/ITrader";
|
||||
import { IBots } from "@spt/models/spt/bots/IBots";
|
||||
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||
import { IHideout } from "@spt/models/spt/hideout/IHideout";
|
||||
import { IDatabaseTables } from "@spt/models/spt/server/IDatabaseTables";
|
||||
import { ILocaleBase } from "@spt/models/spt/server/ILocaleBase";
|
||||
import { ILocations } from "@spt/models/spt/server/ILocations";
|
||||
import { IServerBase } from "@spt/models/spt/server/IServerBase";
|
||||
import { ISettingsBase } from "@spt/models/spt/server/ISettingsBase";
|
||||
import { ITemplates } from "@spt/models/spt/templates/ITemplates";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
export declare class DatabaseService {
|
||||
protected logger: ILogger;
|
||||
protected databaseServer: DatabaseServer;
|
||||
protected localisationService: LocalisationService;
|
||||
protected locationConfig: ILocationConfig;
|
||||
constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService);
|
||||
/**
|
||||
* @returns assets/database/
|
||||
*/
|
||||
getTables(): IDatabaseTables;
|
||||
/**
|
||||
* @returns assets/database/bots/
|
||||
*/
|
||||
getBots(): IBots;
|
||||
/**
|
||||
* @returns assets/database/globals.json
|
||||
*/
|
||||
getGlobals(): IGlobals;
|
||||
/**
|
||||
* @returns assets/database/hideout/
|
||||
*/
|
||||
getHideout(): IHideout;
|
||||
/**
|
||||
* @returns assets/database/locales/
|
||||
*/
|
||||
getLocales(): ILocaleBase;
|
||||
/**
|
||||
* @returns assets/database/locations
|
||||
*/
|
||||
getLocations(): ILocations;
|
||||
/**
|
||||
* Get specific location by its Id
|
||||
* @param locationId Desired location id
|
||||
* @returns assets/database/locations/
|
||||
*/
|
||||
getLocation(locationId: string): ILocation;
|
||||
/**
|
||||
* @returns assets/database/match/
|
||||
*/
|
||||
getMatch(): IMatch;
|
||||
/**
|
||||
* @returns assets/database/server.json
|
||||
*/
|
||||
getServer(): IServerBase;
|
||||
/**
|
||||
* @returns assets/database/settings.json
|
||||
*/
|
||||
getSettings(): ISettingsBase;
|
||||
/**
|
||||
* @returns assets/database/templates/
|
||||
*/
|
||||
getTemplates(): ITemplates;
|
||||
/**
|
||||
* @returns assets/database/templates/achievements.json
|
||||
*/
|
||||
getAchievements(): IAchievement[];
|
||||
/**
|
||||
* @returns assets/database/templates/customisation.json
|
||||
*/
|
||||
getCustomization(): Record<string, ICustomizationItem>;
|
||||
/**
|
||||
* @returns assets/database/templates/items.json
|
||||
*/
|
||||
getHandbook(): IHandbookBase;
|
||||
/**
|
||||
* @returns assets/database/templates/items.json
|
||||
*/
|
||||
getItems(): Record<string, ITemplateItem>;
|
||||
/**
|
||||
* @returns assets/database/templates/prices.json
|
||||
*/
|
||||
getPrices(): Record<string, number>;
|
||||
/**
|
||||
* @returns assets/database/templates/profiles.json
|
||||
*/
|
||||
getProfiles(): IProfileTemplates;
|
||||
/**
|
||||
* @returns assets/database/templates/items.json
|
||||
*/
|
||||
getQuests(): Record<string, IQuest>;
|
||||
/**
|
||||
* @returns assets/database/traders/
|
||||
*/
|
||||
getTraders(): Record<string, ITrader>;
|
||||
/**
|
||||
* Get specific trader by their Id
|
||||
* @param traderId Desired trader id
|
||||
* @returns assets/database/traders/
|
||||
*/
|
||||
getTrader(traderId: string): ITrader;
|
||||
}
|
||||
333
types/services/FenceService.d.ts
vendored
Normal file
333
types/services/FenceService.d.ts
vendored
Normal file
@@ -0,0 +1,333 @@
|
||||
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||
import { IFenceLevel } from "@spt/models/eft/common/IGlobals";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Item, Repairable } from "@spt/models/eft/common/tables/IItem";
|
||||
import { ITemplateItem, Slot } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { IBarterScheme, ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
|
||||
import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||
import { ICreateFenceAssortsResult } from "@spt/models/spt/fence/ICreateFenceAssortsResult";
|
||||
import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt/models/spt/fence/IFenceAssortGenerationValues";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
/**
|
||||
* Handle actions surrounding Fence
|
||||
* e.g. generating or refreshing assorts / get next refresh time
|
||||
*/
|
||||
export declare class FenceService {
|
||||
protected logger: ILogger;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected databaseService: DatabaseService;
|
||||
protected handbookHelper: HandbookHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected presetHelper: PresetHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected traderConfig: ITraderConfig;
|
||||
/** Time when some items in assort will be replaced */
|
||||
protected nextPartialRefreshTimestamp: number;
|
||||
/** Main assorts you see at all rep levels */
|
||||
protected fenceAssort?: ITraderAssort;
|
||||
/** Assorts shown on a separate tab when you max out fence rep */
|
||||
protected fenceDiscountAssort?: ITraderAssort;
|
||||
/** Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() */
|
||||
protected desiredAssortCounts: IFenceAssortGenerationValues;
|
||||
protected fenceItemUpdCompareProperties: Set<string>;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseService: DatabaseService, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Replace main fence assort with new assort
|
||||
* @param assort New assorts to replace old with
|
||||
*/
|
||||
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 | undefined;
|
||||
/**
|
||||
* Get discount fence assort
|
||||
* @return ITraderAssort
|
||||
*/
|
||||
getDiscountFenceAssort(): ITraderAssort | undefined;
|
||||
/**
|
||||
* Replace high rep level fence assort with new assort
|
||||
* @param discountAssort New assorts to replace old with
|
||||
*/
|
||||
setFenceDiscountAssort(discountAssort: ITraderAssort): void;
|
||||
/**
|
||||
* Get assorts player can purchase
|
||||
* Adjust prices based on fence level of player
|
||||
* @param pmcProfile Player profile
|
||||
* @returns ITraderAssort
|
||||
*/
|
||||
getFenceAssorts(pmcProfile: IPmcData): ITraderAssort;
|
||||
/**
|
||||
* Adds to fence assort a single item (with its children)
|
||||
* @param items the items to add with all its childrens
|
||||
* @param mainItem the most parent item of the array
|
||||
*/
|
||||
addItemsToFenceAssort(items: Item[], mainItem: Item): void;
|
||||
/**
|
||||
* Calculates the overall price for an item (with all its children)
|
||||
* @param itemTpl the item tpl to calculate the fence price for
|
||||
* @param items the items (with its children) to calculate fence price for
|
||||
* @returns the fence price of the item
|
||||
*/
|
||||
getItemPrice(itemTpl: string, items: Item[]): number;
|
||||
/**
|
||||
* Calculate the overall price for an ammo box, where only one item is
|
||||
* the ammo box itself and every other items are the bullets in that box
|
||||
* @param items the ammo box (and all its children ammo items)
|
||||
* @returns the price of the ammo box
|
||||
*/
|
||||
protected getAmmoBoxPrice(items: Item[]): number;
|
||||
/**
|
||||
* Adjust all items contained inside an assort by a multiplier
|
||||
* @param assort (clone)Assort that contains items with prices to adjust
|
||||
* @param itemMultipler multipler to use on items
|
||||
* @param presetMultiplier preset multipler to use on presets
|
||||
*/
|
||||
protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void;
|
||||
/**
|
||||
* Merge two trader assort files together
|
||||
* @param firstAssort assort 1#
|
||||
* @param secondAssort assort #2
|
||||
* @returns merged assort
|
||||
*/
|
||||
protected mergeAssorts(firstAssort: ITraderAssort, secondAssort: ITraderAssort): ITraderAssort;
|
||||
/**
|
||||
* Adjust assorts price by a modifier
|
||||
* @param item assort item details
|
||||
* @param assort assort to be modified
|
||||
* @param modifier value to multiply item price by
|
||||
* @param presetModifier value to multiply preset price by
|
||||
*/
|
||||
protected adjustItemPriceByModifier(item: Item, assort: ITraderAssort, modifier: number, presetModifier: number): void;
|
||||
/**
|
||||
* Get fence assorts with no price adjustments based on fence rep
|
||||
* @returns ITraderAssort
|
||||
*/
|
||||
getRawFenceAssorts(): ITraderAssort;
|
||||
/**
|
||||
* Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json
|
||||
* @returns true if it needs a partial refresh
|
||||
*/
|
||||
needsPartialRefresh(): boolean;
|
||||
/**
|
||||
* Replace a percentage of fence assorts with freshly generated items
|
||||
*/
|
||||
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
|
||||
*/
|
||||
protected incrementPartialRefreshTime(): void;
|
||||
/**
|
||||
* Get values that will hydrate the passed in assorts back to the desired counts
|
||||
* @param assortItems Current assorts after items have been removed
|
||||
* @param generationValues Base counts assorts should be adjusted to
|
||||
* @returns IGenerationAssortValues object with adjustments needed to reach desired state
|
||||
*/
|
||||
protected getItemCountsToGenerate(assortItems: Item[], generationValues: IGenerationAssortValues): IGenerationAssortValues;
|
||||
/**
|
||||
* Delete desired number of items from assort (including children)
|
||||
* @param itemCountToReplace
|
||||
* @param discountItemCountToReplace
|
||||
*/
|
||||
protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void;
|
||||
/**
|
||||
* Choose an item at random and remove it + mods from assorts
|
||||
* @param assort Trader assort to remove item from
|
||||
* @param rootItems Pool of root items to pick from to remove
|
||||
*/
|
||||
protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void;
|
||||
/**
|
||||
* Get an integer rounded count of items to replace based on percentrage from traderConfig value
|
||||
* @param totalItemCount total item count
|
||||
* @returns rounded int of items to replace
|
||||
*/
|
||||
protected getCountOfItemsToReplace(totalItemCount: number): number;
|
||||
/**
|
||||
* Get the count of items fence offers
|
||||
* @returns number
|
||||
*/
|
||||
getOfferCount(): number;
|
||||
/**
|
||||
* Create trader assorts for fence and store in fenceService cache
|
||||
* Uses fence base cache generatedon server start as a base
|
||||
*/
|
||||
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
|
||||
* Stored in this.desiredAssortCounts
|
||||
*/
|
||||
protected createInitialFenceAssortGenerationValues(): void;
|
||||
/**
|
||||
* Create skeleton to hold assort items
|
||||
* @returns ITraderAssort object
|
||||
*/
|
||||
protected createFenceAssortSkeleton(): ITraderAssort;
|
||||
/**
|
||||
* Hydrate assorts parameter object with generated assorts
|
||||
* @param assortCount Number of assorts to generate
|
||||
* @param assorts object to add created assorts to
|
||||
*/
|
||||
protected createAssorts(itemCounts: IGenerationAssortValues, loyaltyLevel: number): ICreateFenceAssortsResult;
|
||||
/**
|
||||
* Add item assorts to existing assort data
|
||||
* @param assortCount Number to add
|
||||
* @param assorts Assorts data to add to
|
||||
* @param baseFenceAssortClone Base data to draw from
|
||||
* @param itemTypeLimits
|
||||
* @param loyaltyLevel Loyalty level to set new item to
|
||||
*/
|
||||
protected addItemAssorts(assortCount: number, assorts: ICreateFenceAssortsResult, baseFenceAssortClone: ITraderAssort, itemTypeLimits: Record<string, {
|
||||
current: number;
|
||||
max: number;
|
||||
}>, loyaltyLevel: number): void;
|
||||
/**
|
||||
* Find an assort item that matches the first parameter, also matches based on upd properties
|
||||
* e.g. salewa hp resource units left
|
||||
* @param rootItemBeingAdded item to look for a match against
|
||||
* @param itemDbDetails Db details of matching item
|
||||
* @param itemsWithChildren Items to search through
|
||||
* @returns Matching assort item
|
||||
*/
|
||||
protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, itemsWithChildren: Item[][]): Item | undefined;
|
||||
/**
|
||||
* Should this item be forced into only 1 stack on fence
|
||||
* @param existingItem Existing item from fence assort
|
||||
* @param itemDbDetails Item we want to add db details
|
||||
* @returns True item should be force stacked
|
||||
*/
|
||||
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)
|
||||
* @param barterSchemes All barter scheme for item having price adjusted
|
||||
* @param itemRoot Root item having price adjusted
|
||||
* @param itemTemplate Db template of item
|
||||
*/
|
||||
protected adjustItemPriceByQuality(barterSchemes: Record<string, IBarterScheme[][]>, itemRoot: Item, itemTemplate: ITemplateItem): void;
|
||||
protected getMatchingItemLimit(itemTypeLimits: Record<string, {
|
||||
current: number;
|
||||
max: number;
|
||||
}>, itemTpl: string): {
|
||||
current: number;
|
||||
max: number;
|
||||
} | undefined;
|
||||
/**
|
||||
* Find presets in base fence assort and add desired number to 'assorts' parameter
|
||||
* @param desiredWeaponPresetsCount
|
||||
* @param assorts Assorts to add preset to
|
||||
* @param baseFenceAssort Base data to draw from
|
||||
* @param loyaltyLevel Which loyalty level is required to see/buy item
|
||||
*/
|
||||
protected addPresetsToAssort(desiredWeaponPresetsCount: number, desiredEquipmentPresetsCount: number, assorts: ICreateFenceAssortsResult, baseFenceAssort: ITraderAssort, loyaltyLevel: number): void;
|
||||
/**
|
||||
* Adjust plate / soft insert durability values
|
||||
* @param armor Armor item array to add mods into
|
||||
* @param itemDbDetails Armor items db template
|
||||
*/
|
||||
protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void;
|
||||
/**
|
||||
* Randomise the durability values of items on armor with a passed in slot
|
||||
* @param softInsertSlots Slots of items to randomise
|
||||
* @param armorItemAndMods Array of armor + inserts to get items from
|
||||
*/
|
||||
protected randomiseArmorSoftInsertDurabilities(softInsertSlots: Slot[], armorItemAndMods: Item[]): void;
|
||||
/**
|
||||
* Randomise the durability values of plate items in armor
|
||||
* Has chance to remove plate
|
||||
* @param plateSlots Slots of items to randomise
|
||||
* @param armorItemAndMods Array of armor + inserts to get items from
|
||||
*/
|
||||
protected randomiseArmorInsertsDurabilities(plateSlots: Slot[], armorItemAndMods: Item[]): void;
|
||||
/**
|
||||
* Get stack size of a singular item (no mods)
|
||||
* @param itemDbDetails item being added to fence
|
||||
* @returns Stack size
|
||||
*/
|
||||
protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number;
|
||||
/**
|
||||
* Remove parts of a weapon prior to being listed on flea
|
||||
* @param itemAndMods Weapon to remove parts from
|
||||
*/
|
||||
protected removeRandomModsOfItem(itemAndMods: Item[]): void;
|
||||
/**
|
||||
* Roll % chance check to see if item should be removed
|
||||
* @param weaponMod Weapon mod being checked
|
||||
* @param itemsBeingDeleted Current list of items on weapon being deleted
|
||||
* @returns True if item will be removed
|
||||
*/
|
||||
protected presetModItemWillBeRemoved(weaponMod: Item, itemsBeingDeleted: string[]): boolean;
|
||||
/**
|
||||
* Randomise items' upd properties e.g. med packs/weapons/armor
|
||||
* @param itemDetails Item being randomised
|
||||
* @param itemToAdjust Item being edited
|
||||
*/
|
||||
protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void;
|
||||
/**
|
||||
* Generate a randomised current and max durabiltiy value for an armor item
|
||||
* @param itemDetails Item to create values for
|
||||
* @param equipmentDurabilityLimits Max durabiltiy percent min/max values
|
||||
* @returns Durability + MaxDurability values
|
||||
*/
|
||||
protected getRandomisedArmorDurabilityValues(itemDetails: ITemplateItem, equipmentDurabilityLimits: IItemDurabilityCurrentMax): Repairable;
|
||||
/**
|
||||
* Construct item limit record to hold max and current item count
|
||||
* @param limits limits as defined in config
|
||||
* @returns record, key: item tplId, value: current/max item count allowed
|
||||
*/
|
||||
protected initItemLimitCounter(limits: Record<string, number>): Record<string, {
|
||||
current: number;
|
||||
max: number;
|
||||
}>;
|
||||
/**
|
||||
* Get the next update timestamp for fence
|
||||
* @returns future timestamp
|
||||
*/
|
||||
getNextFenceUpdateTimestamp(): number;
|
||||
/**
|
||||
* Get fence refresh time in seconds
|
||||
* @returns Refresh time in seconds
|
||||
*/
|
||||
protected getFenceRefreshTime(): number;
|
||||
/**
|
||||
* Get fence level the passed in profile has
|
||||
* @param pmcData Player profile
|
||||
* @returns FenceLevel object
|
||||
*/
|
||||
getFenceInfo(pmcData: IPmcData): IFenceLevel;
|
||||
/**
|
||||
* Remove or lower stack size of an assort from fence by id
|
||||
* @param assortId assort id to adjust
|
||||
* @param buyCount Count of items bought
|
||||
*/
|
||||
amendOrRemoveFenceOffer(assortId: string, buyCount: number): void;
|
||||
protected deleteOffer(assortId: string, assorts: Item[]): void;
|
||||
}
|
||||
63
types/services/GiftService.d.ts
vendored
Normal file
63
types/services/GiftService.d.ts
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { GiftSentResult } from "@spt/models/enums/GiftSentResult";
|
||||
import { MessageType } from "@spt/models/enums/MessageType";
|
||||
import { Gift, IGiftsConfig } from "@spt/models/spt/config/IGiftsConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
export declare class GiftService {
|
||||
protected logger: ILogger;
|
||||
protected mailSendService: MailSendService;
|
||||
protected localisationService: LocalisationService;
|
||||
protected hashUtil: HashUtil;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected configServer: ConfigServer;
|
||||
protected giftConfig: IGiftsConfig;
|
||||
constructor(logger: ILogger, mailSendService: MailSendService, localisationService: LocalisationService, hashUtil: HashUtil, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer);
|
||||
/**
|
||||
* Does a gift with a specific ID exist in db
|
||||
* @param giftId Gift id to check for
|
||||
* @returns True if it exists in db
|
||||
*/
|
||||
giftExists(giftId: string): boolean;
|
||||
getGiftById(giftId: string): Gift;
|
||||
/**
|
||||
* Get dictionary of all gifts
|
||||
* @returns Dict keyed by gift id
|
||||
*/
|
||||
getGifts(): Record<string, Gift>;
|
||||
/**
|
||||
* Get an array of all gift ids
|
||||
* @returns string array of gift ids
|
||||
*/
|
||||
getGiftIds(): string[];
|
||||
/**
|
||||
* Send player a gift from a range of sources
|
||||
* @param playerId Player to send gift to / sessionId
|
||||
* @param giftId Id of gift in configs/gifts.json to send player
|
||||
* @returns outcome of sending gift to player
|
||||
*/
|
||||
sendGiftToPlayer(playerId: string, giftId: string): GiftSentResult;
|
||||
/**
|
||||
* Get sender id based on gifts sender type enum
|
||||
* @param giftData Gift to send player
|
||||
* @returns trader/user/system id
|
||||
*/
|
||||
protected getSenderId(giftData: Gift): string | undefined;
|
||||
/**
|
||||
* Convert GiftSenderType into a dialog MessageType
|
||||
* @param giftData Gift to send player
|
||||
* @returns MessageType enum value
|
||||
*/
|
||||
protected getMessageType(giftData: Gift): MessageType | undefined;
|
||||
/**
|
||||
* Prapor sends gifts to player for first week after profile creation
|
||||
* @param sessionId Player id
|
||||
* @param day What day to give gift for
|
||||
*/
|
||||
sendPraporStartingGift(sessionId: string, day: number): void;
|
||||
}
|
||||
173
types/services/InsuranceService.d.ts
vendored
Normal file
173
types/services/InsuranceService.d.ts
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
|
||||
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { SecureContainerHelper } from "@spt/helpers/SecureContainerHelper";
|
||||
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { ITraderBase } from "@spt/models/eft/common/tables/ITrader";
|
||||
import { IInsuredItemsData } from "@spt/models/eft/inRaid/IInsuredItemsData";
|
||||
import { ISaveProgressRequestData } from "@spt/models/eft/inRaid/ISaveProgressRequestData";
|
||||
import { IInsuranceConfig } from "@spt/models/spt/config/IInsuranceConfig";
|
||||
import { ILostOnDeathConfig } from "@spt/models/spt/config/ILostOnDeathConfig";
|
||||
import { IInsuranceEquipmentPkg } from "@spt/models/spt/services/IInsuranceEquipmentPkg";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocaleService } from "@spt/services/LocaleService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
export declare class InsuranceService {
|
||||
protected logger: ILogger;
|
||||
protected databaseService: DatabaseService;
|
||||
protected secureContainerHelper: SecureContainerHelper;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected hashUtil: HashUtil;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected saveServer: SaveServer;
|
||||
protected traderHelper: TraderHelper;
|
||||
protected dialogueHelper: DialogueHelper;
|
||||
protected handbookHelper: HandbookHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected localeService: LocaleService;
|
||||
protected mailSendService: MailSendService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected insured: Record<string, Record<string, Item[]>>;
|
||||
protected insuranceConfig: IInsuranceConfig;
|
||||
protected lostOnDeathConfig: ILostOnDeathConfig;
|
||||
constructor(logger: ILogger, databaseService: DatabaseService, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Does player have insurance array
|
||||
* @param sessionId Player id
|
||||
* @returns True if exists
|
||||
*/
|
||||
insuranceExists(sessionId: string): boolean;
|
||||
/**
|
||||
* Get all insured items by all traders for a profile
|
||||
* @param sessionId Profile id (session id)
|
||||
* @returns Item array
|
||||
*/
|
||||
getInsurance(sessionId: string): Record<string, Item[]>;
|
||||
/**
|
||||
* Get insured items by profile id + trader id
|
||||
* @param sessionId Profile id (session id)
|
||||
* @param traderId Trader items were insured with
|
||||
* @returns Item array
|
||||
*/
|
||||
getInsuranceItems(sessionId: string, traderId: string): Item[];
|
||||
resetInsurance(sessionId: string): void;
|
||||
/**
|
||||
* Sends stored insured items as message to player
|
||||
* @param pmcData profile to send insured items to
|
||||
* @param sessionID SessionId of current player
|
||||
* @param mapId Id of the map player died/exited that caused the insurance to be issued on
|
||||
*/
|
||||
sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void;
|
||||
/**
|
||||
* Check all root insured items and remove location property + set slotId to 'hideout'
|
||||
* @param sessionId Session id
|
||||
* @param traderId Trader id
|
||||
*/
|
||||
protected removeLocationProperty(sessionId: string, traderId: string): void;
|
||||
/**
|
||||
* Get a timestamp of when insurance items should be sent to player based on trader used to insure
|
||||
* Apply insurance return bonus if found in profile
|
||||
* @param pmcData Player profile
|
||||
* @param trader Trader base used to insure items
|
||||
* @returns Timestamp to return items to player in seconds
|
||||
*/
|
||||
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
|
||||
/**
|
||||
* Create insurance equipment packages that should be sent to the user. The packages should contain items that have
|
||||
* been lost in a raid and should be returned to the player through the insurance system.
|
||||
*
|
||||
* NOTE: We do not have data on items that were dropped in a raid. This means we have to pull item data from the
|
||||
* profile at the start of the raid to return to the player in insurance. Because of this, the item
|
||||
* positioning may differ from the position the item was in when the player died. Apart from removing all
|
||||
* positioning, this is the best we can do. >:{}
|
||||
*
|
||||
* @param pmcData Player profile
|
||||
* @param offraidData Post-raid data
|
||||
* @param preRaidGear Pre-raid data
|
||||
* @param sessionID Session id
|
||||
* @param playerDied Did player die in raid
|
||||
* @returns Array of insured items lost in raid
|
||||
*/
|
||||
getGearLostInRaid(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): IInsuranceEquipmentPkg[];
|
||||
/**
|
||||
* Take the insurance item packages within a profile session and ensure that each of the items in that package are
|
||||
* not orphaned from their parent ID.
|
||||
*
|
||||
* @param sessionID The session ID to update insurance equipment packages in.
|
||||
* @returns void
|
||||
*/
|
||||
protected adoptOrphanedInsEquipment(sessionID: string): void;
|
||||
/**
|
||||
* Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
|
||||
* @param equipmentPkg Gear to store - generated by getGearLostInRaid()
|
||||
*/
|
||||
storeGearLostInRaidToSendLater(sessionID: string, equipmentPkg: IInsuranceEquipmentPkg[]): void;
|
||||
/**
|
||||
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
|
||||
* @param pmcData Player profile
|
||||
* @param preRaidItemWithChildren Insured item (with children) as it was pre-raid
|
||||
* @param allItemsFromClient Item data when player left raid (durability values)
|
||||
* @returns Item (with children) to send to player
|
||||
*/
|
||||
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
|
||||
/**
|
||||
* Reset slotId property to "hideout" when necessary (used to be in )
|
||||
* @param pmcData Players pmcData.Inventory.equipment value
|
||||
* @param itemToReturn item we will send to player as insurance return
|
||||
*/
|
||||
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
|
||||
/**
|
||||
* Add gear item to InsuredItems array in player profile
|
||||
* @param sessionID Session id
|
||||
* @param pmcData Player profile
|
||||
* @param itemToReturnToPlayer item to store
|
||||
* @param traderId Id of trader item was insured with
|
||||
*/
|
||||
protected addGearToSend(gear: IInsuranceEquipmentPkg): void;
|
||||
/**
|
||||
* Does insurance exist for a player and by trader
|
||||
* @param sessionId Player id (session id)
|
||||
* @param traderId Trader items insured with
|
||||
* @returns True if exists
|
||||
*/
|
||||
protected insuranceTraderArrayExists(sessionId: string, traderId: string): boolean;
|
||||
/**
|
||||
* Empty out array holding insured items by sessionid + traderid
|
||||
* @param sessionId Player id (session id)
|
||||
* @param traderId Trader items insured with
|
||||
*/
|
||||
resetInsuranceTraderArray(sessionId: string, traderId: string): void;
|
||||
/**
|
||||
* Store insured item
|
||||
* @param sessionId Player id (session id)
|
||||
* @param traderId Trader item insured with
|
||||
* @param itemToAdd Insured item (with children)
|
||||
*/
|
||||
addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void;
|
||||
/**
|
||||
* Get price of insurance * multiplier from config
|
||||
* @param pmcData Player profile
|
||||
* @param inventoryItem Item to be insured
|
||||
* @param traderId Trader item is insured with
|
||||
* @returns price in roubles
|
||||
*/
|
||||
getRoublePriceToInsureItemWithTrader(pmcData: IPmcData, inventoryItem: Item, traderId: string): number;
|
||||
/**
|
||||
* Returns the ID that should be used for a root-level Item's parentId property value within in the context of insurance.
|
||||
* @param sessionID Players id
|
||||
* @returns The root item Id.
|
||||
*/
|
||||
getRootItemParentID(sessionID: string): string;
|
||||
}
|
||||
46
types/services/ItemBaseClassService.d.ts
vendored
Normal file
46
types/services/ItemBaseClassService.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
/**
|
||||
* Cache the baseids for each item in the tiems db inside a dictionary
|
||||
*/
|
||||
export declare class ItemBaseClassService {
|
||||
protected logger: ILogger;
|
||||
protected localisationService: LocalisationService;
|
||||
protected databaseService: DatabaseService;
|
||||
protected itemBaseClassesCache: Record<string, string[]>;
|
||||
protected items: Record<string, ITemplateItem>;
|
||||
protected cacheGenerated: boolean;
|
||||
constructor(logger: ILogger, localisationService: LocalisationService, databaseService: DatabaseService);
|
||||
/**
|
||||
* Create cache and store inside ItemBaseClassService
|
||||
* Store a dict of an items tpl to the base classes it and its parents have
|
||||
*/
|
||||
hydrateItemBaseClassCache(): void;
|
||||
/**
|
||||
* 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 item item being checked
|
||||
*/
|
||||
protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem): void;
|
||||
/**
|
||||
* Does item tpl inherit from the requested base class
|
||||
* @param itemTpl item to check base classes of
|
||||
* @param baseClass base class to check for
|
||||
* @returns true if item inherits from base class passed in
|
||||
*/
|
||||
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
|
||||
* @param itemTpl item to get base classes for
|
||||
* @returns array of base classes
|
||||
*/
|
||||
getItemBaseClasses(itemTpl: string): string[];
|
||||
}
|
||||
60
types/services/ItemFilterService.d.ts
vendored
Normal file
60
types/services/ItemFilterService.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { IItemConfig } from "@spt/models/spt/config/IItemConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json, stores items that should not be used by players / broken items */
|
||||
export declare class ItemFilterService {
|
||||
protected logger: ILogger;
|
||||
protected cloner: ICloner;
|
||||
protected databaseServer: DatabaseServer;
|
||||
protected configServer: ConfigServer;
|
||||
protected itemConfig: IItemConfig;
|
||||
protected itemBlacklistCache: Set<string>;
|
||||
protected lootableItemBlacklistCache: Set<string>;
|
||||
constructor(logger: ILogger, cloner: ICloner, databaseServer: DatabaseServer, configServer: ConfigServer);
|
||||
/**
|
||||
* Check if the provided template id is blacklisted in config/item.json/blacklist
|
||||
* @param tpl template id
|
||||
* @returns true if blacklisted
|
||||
*/
|
||||
isItemBlacklisted(tpl: string): boolean;
|
||||
/**
|
||||
* Check if the provided template id is blacklisted in config/item.json/lootableItemBlacklist
|
||||
* @param tpl template id
|
||||
* @returns true if blacklisted
|
||||
*/
|
||||
isLootableItemBlacklisted(tpl: string): boolean;
|
||||
/**
|
||||
* Check if item is blacklisted from being a reward for player
|
||||
* @param tpl item tpl to check is on blacklist
|
||||
* @returns True when blacklisted
|
||||
*/
|
||||
isItemRewardBlacklisted(tpl: string): boolean;
|
||||
/**
|
||||
* Get an array of items that should never be given as a reward to player
|
||||
* @returns string array of item tpls
|
||||
*/
|
||||
getItemRewardBlacklist(): string[];
|
||||
/**
|
||||
* Return every template id blacklisted in config/item.json
|
||||
* @returns string array of blacklisted tempalte ids
|
||||
*/
|
||||
getBlacklistedItems(): string[];
|
||||
/**
|
||||
* Return every template id blacklisted in config/item.json/lootableItemBlacklist
|
||||
* @returns string array of blacklisted tempalte ids
|
||||
*/
|
||||
getBlacklistedLootableItems(): string[];
|
||||
/**
|
||||
* Check if the provided template id is boss item in config/item.json
|
||||
* @param tpl template id
|
||||
* @returns true if boss item
|
||||
*/
|
||||
isBossItem(tpl: string): boolean;
|
||||
/**
|
||||
* Return boss items in config/item.json
|
||||
* @returns string array of boss item tempalte ids
|
||||
*/
|
||||
getBossItems(): string[];
|
||||
}
|
||||
58
types/services/LocaleService.d.ts
vendored
Normal file
58
types/services/LocaleService.d.ts
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { ILocaleConfig } from "@spt/models/spt/config/ILocaleConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
/**
|
||||
* Handles getting locales from config or users machine
|
||||
*/
|
||||
export declare class LocaleService {
|
||||
protected logger: ILogger;
|
||||
protected databaseServer: DatabaseServer;
|
||||
protected configServer: ConfigServer;
|
||||
protected localeConfig: ILocaleConfig;
|
||||
constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer);
|
||||
/**
|
||||
* Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en'
|
||||
* @returns dictionary
|
||||
*/
|
||||
getLocaleDb(): Record<string, string>;
|
||||
/**
|
||||
* Gets the game locale key from the locale.json file,
|
||||
* if value is 'system' get system locale
|
||||
* @returns locale e.g en/ge/cz/cn
|
||||
*/
|
||||
getDesiredGameLocale(): string;
|
||||
/**
|
||||
* Gets the game locale key from the locale.json file,
|
||||
* if value is 'system' get system locale
|
||||
* @returns locale e.g en/ge/cz/cn
|
||||
*/
|
||||
getDesiredServerLocale(): string;
|
||||
/**
|
||||
* Get array of languages supported for localisation
|
||||
* @returns array of locales e.g. en/fr/cn
|
||||
*/
|
||||
getServerSupportedLocales(): string[];
|
||||
/**
|
||||
* Get array of languages supported for localisation
|
||||
* @returns array of locales e.g. en/fr/cn
|
||||
*/
|
||||
getLocaleFallbacks(): {
|
||||
[locale: string]: string;
|
||||
};
|
||||
/**
|
||||
* Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt
|
||||
* @returns string
|
||||
*/
|
||||
protected getPlatformForServerLocale(): string;
|
||||
/**
|
||||
* Get the locale of the computer running the server
|
||||
* @returns langage part of locale e.g. 'en' part of 'en-US'
|
||||
*/
|
||||
protected getPlatformForClientLocale(): string;
|
||||
/**
|
||||
* This is in a function so we can overwrite it during testing
|
||||
* @returns The current platform locale
|
||||
*/
|
||||
protected getPlatformLocale(): Intl.Locale;
|
||||
}
|
||||
34
types/services/LocalisationService.d.ts
vendored
Normal file
34
types/services/LocalisationService.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { I18n } from "i18n";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { LocaleService } from "@spt/services/LocaleService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
/**
|
||||
* Handles translating server text into different langauges
|
||||
*/
|
||||
export declare class LocalisationService {
|
||||
protected logger: ILogger;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected databaseServer: DatabaseServer;
|
||||
protected localeService: LocaleService;
|
||||
protected i18n: I18n;
|
||||
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService);
|
||||
/**
|
||||
* Get a localised value using the passed in key
|
||||
* @param key Key to loop up locale for
|
||||
* @param args optional arguments
|
||||
* @returns Localised string
|
||||
*/
|
||||
getText(key: string, args?: any): string;
|
||||
/**
|
||||
* Get all locale keys
|
||||
* @returns string array of keys
|
||||
*/
|
||||
getKeys(): string[];
|
||||
/**
|
||||
* From the provided partial key, find all keys that start with text and choose a random match
|
||||
* @param partialKey Key to match locale keys on
|
||||
* @returns locale text
|
||||
*/
|
||||
getRandomTextThatMatchesPartialKey(partialKey: string): string;
|
||||
}
|
||||
129
types/services/MailSendService.d.ts
vendored
Normal file
129
types/services/MailSendService.d.ts
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper";
|
||||
import { NotifierHelper } from "@spt/helpers/NotifierHelper";
|
||||
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { Dialogue, ISystemData, IUserDialogInfo, Message, MessageContentRagfair, MessageItems } from "@spt/models/eft/profile/ISptProfile";
|
||||
import { MessageType } from "@spt/models/enums/MessageType";
|
||||
import { Traders } from "@spt/models/enums/Traders";
|
||||
import { IProfileChangeEvent, ISendMessageDetails } from "@spt/models/spt/dialog/ISendMessageDetails";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
export declare class MailSendService {
|
||||
protected logger: ILogger;
|
||||
protected hashUtil: HashUtil;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected saveServer: SaveServer;
|
||||
protected databaseService: DatabaseService;
|
||||
protected notifierHelper: NotifierHelper;
|
||||
protected dialogueHelper: DialogueHelper;
|
||||
protected notificationSendHelper: NotificationSendHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected traderHelper: TraderHelper;
|
||||
protected readonly systemSenderId = "59e7125688a45068a6249071";
|
||||
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseService: DatabaseService, notifierHelper: NotifierHelper, dialogueHelper: DialogueHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper, traderHelper: TraderHelper);
|
||||
/**
|
||||
* Send a message from an NPC (e.g. prapor) to the player with or without items using direct message text, do not look up any locale
|
||||
* @param sessionId The session ID to send the message to
|
||||
* @param trader The trader sending the message
|
||||
* @param messageType What type the message will assume (e.g. QUEST_SUCCESS)
|
||||
* @param message Text to send to the player
|
||||
* @param items Optional items to send to player
|
||||
* @param maxStorageTimeSeconds Optional time to collect items before they expire
|
||||
*/
|
||||
sendDirectNpcMessageToPlayer(sessionId: string, trader: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: number, systemData?: ISystemData, ragfair?: MessageContentRagfair): void;
|
||||
/**
|
||||
* Send a message from an NPC (e.g. prapor) to the player with or without items
|
||||
* @param sessionId The session ID to send the message to
|
||||
* @param trader The trader sending the message
|
||||
* @param messageType What type the message will assume (e.g. QUEST_SUCCESS)
|
||||
* @param messageLocaleId The localised text to send to player
|
||||
* @param items Optional items to send to player
|
||||
* @param maxStorageTimeSeconds Optional time to collect items before they expire
|
||||
*/
|
||||
sendLocalisedNpcMessageToPlayer(sessionId: string, trader: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: number, systemData?: ISystemData, ragfair?: MessageContentRagfair): void;
|
||||
/**
|
||||
* Send a message from SYSTEM to the player with or without items
|
||||
* @param sessionId The session ID to send the message to
|
||||
* @param message The text to send to player
|
||||
* @param items Optional items to send to player
|
||||
* @param maxStorageTimeSeconds Optional time to collect items before they expire
|
||||
*/
|
||||
sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: number, profileChangeEvents?: IProfileChangeEvent[]): void;
|
||||
/**
|
||||
* Send a message from SYSTEM to the player with or without items with localised text
|
||||
* @param sessionId The session ID to send the message to
|
||||
* @param messageLocaleId Id of key from locale file to send to player
|
||||
* @param items Optional items to send to player
|
||||
* @param maxStorageTimeSeconds Optional time to collect items before they expire
|
||||
*/
|
||||
sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: IProfileChangeEvent[], maxStorageTimeSeconds?: number): void;
|
||||
/**
|
||||
* Send a USER message to a player with or without items
|
||||
* @param sessionId The session ID to send the message to
|
||||
* @param senderId Who is sending the message
|
||||
* @param message The text to send to player
|
||||
* @param items Optional items to send to player
|
||||
* @param maxStorageTimeSeconds Optional time to collect items before they expire
|
||||
*/
|
||||
sendUserMessageToPlayer(sessionId: string, senderDetails: IUserDialogInfo, message: string, items?: Item[], maxStorageTimeSeconds?: number): void;
|
||||
/**
|
||||
* Large function to send messages to players from a variety of sources (SYSTEM/NPC/USER)
|
||||
* Helper functions in this class are available to simplify common actions
|
||||
* @param messageDetails Details needed to send a message to the player
|
||||
*/
|
||||
sendMessageToPlayer(messageDetails: ISendMessageDetails): void;
|
||||
/**
|
||||
* Send a message from the player to an NPC
|
||||
* @param sessionId Player id
|
||||
* @param targetNpcId NPC message is sent to
|
||||
* @param message Text to send to NPC
|
||||
*/
|
||||
sendPlayerMessageToNpc(sessionId: string, targetNpcId: string, message: string): void;
|
||||
/**
|
||||
* Create a message for storage inside a dialog in the player profile
|
||||
* @param senderDialog Id of dialog that will hold the message
|
||||
* @param messageDetails Various details on what the message must contain/do
|
||||
* @returns Message
|
||||
*/
|
||||
protected createDialogMessage(dialogId: string, messageDetails: ISendMessageDetails): Message;
|
||||
/**
|
||||
* Add items to message and adjust various properties to reflect the items being added
|
||||
* @param message Message to add items to
|
||||
* @param itemsToSendToPlayer Items to add to message
|
||||
* @param maxStorageTimeSeconds total time items are stored in mail before being deleted
|
||||
*/
|
||||
protected addRewardItemsToMessage(message: Message, itemsToSendToPlayer: MessageItems | undefined, maxStorageTimeSeconds: number | undefined): void;
|
||||
/**
|
||||
* perform various sanitising actions on the items before they're considered ready for insertion into message
|
||||
* @param dialogType The type of the dialog that will hold the reward items being processed
|
||||
* @param messageDetails
|
||||
* @returns Sanitised items
|
||||
*/
|
||||
protected processItemsBeforeAddingToMail(dialogType: MessageType, messageDetails: ISendMessageDetails): MessageItems;
|
||||
/**
|
||||
* Try to find the most correct item to be the 'primary' item in a reward mail
|
||||
* @param items Possible items to choose from
|
||||
* @returns Chosen 'primary' item
|
||||
*/
|
||||
protected getBaseItemFromRewards(items: Item[]): Item;
|
||||
/**
|
||||
* Get a dialog with a specified entity (user/trader)
|
||||
* Create and store empty dialog if none exists in profile
|
||||
* @param messageDetails Data on what message should do
|
||||
* @returns Relevant Dialogue
|
||||
*/
|
||||
protected getDialog(messageDetails: ISendMessageDetails): Dialogue;
|
||||
/**
|
||||
* Get the appropriate sender id by the sender enum type
|
||||
* @param messageDetails
|
||||
* @returns gets an id of the individual sending it
|
||||
*/
|
||||
protected getMessageSenderIdByType(messageDetails: ISendMessageDetails): string | undefined;
|
||||
}
|
||||
37
types/services/MapMarkerService.d.ts
vendored
Normal file
37
types/services/MapMarkerService.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData";
|
||||
import { IInventoryDeleteMarkerRequestData } from "@spt/models/eft/inventory/IInventoryDeleteMarkerRequestData";
|
||||
import { IInventoryEditMarkerRequestData } from "@spt/models/eft/inventory/IInventoryEditMarkerRequestData";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
export declare class MapMarkerService {
|
||||
protected logger: ILogger;
|
||||
constructor(logger: ILogger);
|
||||
/**
|
||||
* Add note to a map item in player inventory
|
||||
* @param pmcData Player profile
|
||||
* @param request Add marker request
|
||||
* @returns Item
|
||||
*/
|
||||
createMarkerOnMap(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData): Item;
|
||||
/**
|
||||
* Delete a map marker
|
||||
* @param pmcData Player profile
|
||||
* @param request Delete marker request
|
||||
* @returns Item
|
||||
*/
|
||||
deleteMarkerFromMap(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData): Item;
|
||||
/**
|
||||
* Edit an existing map marker
|
||||
* @param pmcData Player profile
|
||||
* @param request Edit marker request
|
||||
* @returns Item
|
||||
*/
|
||||
editMarkerOnMap(pmcData: IPmcData, request: IInventoryEditMarkerRequestData): Item;
|
||||
/**
|
||||
* Strip out characters from note string that are not: letter/numbers/unicode/spaces
|
||||
* @param mapNoteText Marker text to sanitise
|
||||
* @returns Sanitised map marker text
|
||||
*/
|
||||
protected sanitiseMapMarkerText(mapNoteText: string): string;
|
||||
}
|
||||
25
types/services/MatchBotDetailsCacheService.d.ts
vendored
Normal file
25
types/services/MatchBotDetailsCacheService.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */
|
||||
export declare class MatchBotDetailsCacheService {
|
||||
protected logger: ILogger;
|
||||
protected localisationService: LocalisationService;
|
||||
protected botDetailsCache: Record<string, IBotBase>;
|
||||
constructor(logger: ILogger, localisationService: LocalisationService);
|
||||
/**
|
||||
* Store a bot in the cache, keyed by its name
|
||||
* @param botToCache Bot details to cache
|
||||
*/
|
||||
cacheBot(botToCache: IBotBase): void;
|
||||
/**
|
||||
* Clean the cache of all bot details
|
||||
*/
|
||||
clearCache(): void;
|
||||
/**
|
||||
* Find a bot in the cache by its name and side
|
||||
* @param botName Name of bot to find
|
||||
* @returns Bot details
|
||||
*/
|
||||
getBotByNameAndSide(botName: string, botSide: string): IBotBase;
|
||||
}
|
||||
9
types/services/MatchLocationService.d.ts
vendored
Normal file
9
types/services/MatchLocationService.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
export declare class MatchLocationService {
|
||||
protected timeUtil: TimeUtil;
|
||||
protected saveServer: SaveServer;
|
||||
protected locations: {};
|
||||
constructor(timeUtil: TimeUtil, saveServer: SaveServer);
|
||||
deleteGroup(info: any): void;
|
||||
}
|
||||
37
types/services/ModCompilerService.d.ts
vendored
Normal file
37
types/services/ModCompilerService.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { CompilerOptions } from "typescript";
|
||||
import type { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ModHashCacheService } from "@spt/services/cache/ModHashCacheService";
|
||||
import { VFS } from "@spt/utils/VFS";
|
||||
export declare class ModCompilerService {
|
||||
protected logger: ILogger;
|
||||
protected modHashCacheService: ModHashCacheService;
|
||||
protected vfs: VFS;
|
||||
protected serverDependencies: string[];
|
||||
constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS);
|
||||
/**
|
||||
* Convert a mods TS into JS
|
||||
* @param modName Name of mod
|
||||
* @param modPath Dir path to mod
|
||||
* @param modTypeScriptFiles
|
||||
* @returns
|
||||
*/
|
||||
compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise<void>;
|
||||
/**
|
||||
* Convert a TS file into JS
|
||||
* @param fileNames Paths to TS files
|
||||
* @param options Compiler options
|
||||
*/
|
||||
protected compile(fileNames: string[], options: CompilerOptions): Promise<void>;
|
||||
/**
|
||||
* Do the files at the provided paths exist
|
||||
* @param fileNames
|
||||
* @returns
|
||||
*/
|
||||
protected areFilesReady(fileNames: string[]): boolean;
|
||||
/**
|
||||
* Wait the provided number of milliseconds
|
||||
* @param ms Milliseconds
|
||||
* @returns
|
||||
*/
|
||||
protected delay(ms: number): Promise<unknown>;
|
||||
}
|
||||
21
types/services/NotificationService.d.ts
vendored
Normal file
21
types/services/NotificationService.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { IWsNotificationEvent } from "@spt/models/eft/ws/IWsNotificationEvent";
|
||||
export declare class NotificationService {
|
||||
protected messageQueue: Record<string, any[]>;
|
||||
getMessageQueue(): Record<string, any[]>;
|
||||
getMessageFromQueue(sessionId: string): any[];
|
||||
updateMessageOnQueue(sessionId: string, value: any[]): void;
|
||||
has(sessionID: string): boolean;
|
||||
/**
|
||||
* Pop first message from queue.
|
||||
*/
|
||||
pop(sessionID: string): any;
|
||||
/**
|
||||
* Add message to queue
|
||||
*/
|
||||
add(sessionID: string, message: IWsNotificationEvent): void;
|
||||
/**
|
||||
* Get message queue for session
|
||||
* @param sessionID
|
||||
*/
|
||||
get(sessionID: string): any[];
|
||||
}
|
||||
26
types/services/OpenZoneService.d.ts
vendored
Normal file
26
types/services/OpenZoneService.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
/** Service for adding new zones to a maps OpenZones property */
|
||||
export declare class OpenZoneService {
|
||||
protected logger: ILogger;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected databaseService: DatabaseService;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected locationConfig: ILocationConfig;
|
||||
constructor(logger: ILogger, randomUtil: RandomUtil, databaseService: DatabaseService, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
/**
|
||||
* Add open zone to specified map
|
||||
* @param locationId map location (e.g. factory4_day)
|
||||
* @param zoneToAdd zone to add
|
||||
*/
|
||||
addZoneToMap(locationId: string, zoneToAdd: string): void;
|
||||
/**
|
||||
* Add open zones to all maps found in config/location.json to db
|
||||
*/
|
||||
applyZoneChangesToAllMaps(): void;
|
||||
}
|
||||
88
types/services/PaymentService.d.ts
vendored
Normal file
88
types/services/PaymentService.d.ts
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { IProcessSellTradeRequestData } from "@spt/models/eft/trade/IProcessSellTradeRequestData";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
export declare class PaymentService {
|
||||
protected logger: ILogger;
|
||||
protected hashUtil: HashUtil;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected databaseService: DatabaseService;
|
||||
protected handbookHelper: HandbookHelper;
|
||||
protected traderHelper: TraderHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected inventoryHelper: InventoryHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected paymentHelper: PaymentHelper;
|
||||
constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseService: DatabaseService, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper);
|
||||
/**
|
||||
* Take money and insert items into return to server request
|
||||
* @param pmcData Pmc profile
|
||||
* @param request Buy item request
|
||||
* @param sessionID Session id
|
||||
* @param output Client response
|
||||
*/
|
||||
payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||
/**
|
||||
* Get the item price of a specific traders assort
|
||||
* @param traderAssortId Id of assort to look up
|
||||
* @param traderId Id of trader with assort
|
||||
* @returns Handbook rouble price of item
|
||||
*/
|
||||
protected getTraderItemHandbookPriceRouble(traderAssortId: string, traderId: string): number;
|
||||
/**
|
||||
* Receive money back after selling
|
||||
* @param {IPmcData} pmcData
|
||||
* @param {number} amountToSend
|
||||
* @param {IProcessSellTradeRequestData} request
|
||||
* @param {IItemEventRouterResponse} output
|
||||
* @param {string} sessionID
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void;
|
||||
/**
|
||||
* Remove currency from player stash/inventory and update client object with changes
|
||||
* @param pmcData Player profile to find and remove currency from
|
||||
* @param currencyTpl Type of currency to pay
|
||||
* @param amountToPay money value to pay
|
||||
* @param sessionID Session id
|
||||
* @param output output object to send to client
|
||||
*/
|
||||
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void;
|
||||
/**
|
||||
* Get all money stacks in inventory and prioritise items in stash
|
||||
* @param pmcData
|
||||
* @param currencyTpl
|
||||
* @param playerStashId Players stash id
|
||||
* @returns Sorting money items
|
||||
*/
|
||||
protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[];
|
||||
/**
|
||||
* Prioritise player stash first over player inventory
|
||||
* Post-raid healing would often take money out of the players pockets/secure container
|
||||
* @param a First money stack item
|
||||
* @param b Second money stack item
|
||||
* @param inventoryItems players inventory items
|
||||
* @param playerStashId Players stash id
|
||||
* @returns sort order
|
||||
*/
|
||||
protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number;
|
||||
/**
|
||||
* Recursivly check items parents to see if it is inside the players inventory, not stash
|
||||
* @param itemId item id to check
|
||||
* @param inventoryItems player inventory
|
||||
* @param playerStashId Players stash id
|
||||
* @returns true if its in inventory
|
||||
*/
|
||||
protected isInStash(itemId: string | undefined, inventoryItems: Item[], playerStashId: string): boolean;
|
||||
}
|
||||
18
types/services/PlayerService.d.ts
vendored
Normal file
18
types/services/PlayerService.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
export declare class PlayerService {
|
||||
protected logger: ILogger;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected databaseService: DatabaseService;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, databaseService: DatabaseService);
|
||||
/**
|
||||
* Get level of player
|
||||
* @param pmcData Player profile
|
||||
* @returns Level of player
|
||||
*/
|
||||
calculateLevel(pmcData: IPmcData): number;
|
||||
}
|
||||
97
types/services/PmcChatResponseService.d.ts
vendored
Normal file
97
types/services/PmcChatResponseService.d.ts
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper";
|
||||
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Aggressor, Victim } from "@spt/models/eft/common/tables/IBotBase";
|
||||
import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile";
|
||||
import { IGiftsConfig } from "@spt/models/spt/config/IGiftsConfig";
|
||||
import { IPmcChatResponse } from "@spt/models/spt/config/IPmChatResponse";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { GiftService } from "@spt/services/GiftService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
export declare class PmcChatResponseService {
|
||||
protected logger: ILogger;
|
||||
protected hashUtil: HashUtil;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected notificationSendHelper: NotificationSendHelper;
|
||||
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
|
||||
protected localisationService: LocalisationService;
|
||||
protected giftService: GiftService;
|
||||
protected weightedRandomHelper: WeightedRandomHelper;
|
||||
protected configServer: ConfigServer;
|
||||
protected pmcResponsesConfig: IPmcChatResponse;
|
||||
protected giftConfig: IGiftsConfig;
|
||||
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, giftService: GiftService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer);
|
||||
/**
|
||||
* For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative
|
||||
* @param sessionId Session id
|
||||
* @param pmcVictims Array of bots killed by player
|
||||
* @param pmcData Player profile
|
||||
*/
|
||||
sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void;
|
||||
/**
|
||||
* Not fully implemented yet, needs method of acquiring killers details after raid
|
||||
* @param sessionId Session id
|
||||
* @param pmcData Players profile
|
||||
* @param killer The bot who killed the player
|
||||
*/
|
||||
sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void;
|
||||
/**
|
||||
* Choose a localised message to send the player (different if sender was killed or killed player)
|
||||
* @param isVictim Is the message coming from a bot killed by the player
|
||||
* @param pmcData Player profile
|
||||
* @returns Message from PMC to player
|
||||
*/
|
||||
protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string | undefined;
|
||||
/**
|
||||
* Should capitalisation be stripped from the message response before sending
|
||||
* @param isVictim Was responder a victim of player
|
||||
* @returns true = should be stripped
|
||||
*/
|
||||
protected stripCapitalistion(isVictim: boolean): boolean;
|
||||
/**
|
||||
* Should capitalisation be stripped from the message response before sending
|
||||
* @param isVictim Was responder a victim of player
|
||||
* @returns true = should be stripped
|
||||
*/
|
||||
protected allCaps(isVictim: boolean): boolean;
|
||||
/**
|
||||
* Should a suffix be appended to the end of the message being sent to player
|
||||
* @param isVictim Was responder a victim of player
|
||||
* @returns true = should be stripped
|
||||
*/
|
||||
appendSuffixToMessageEnd(isVictim: boolean): boolean;
|
||||
/**
|
||||
* Choose a type of response based on the weightings in pmc response config
|
||||
* @param isVictim Was responder killed by player
|
||||
* @returns Response type (positive/negative)
|
||||
*/
|
||||
protected chooseResponseType(isVictim?: boolean): string;
|
||||
/**
|
||||
* Get locale keys related to the type of response to send (victim/killer)
|
||||
* @param keyType Positive/negative
|
||||
* @param isVictim Was responder killed by player
|
||||
* @returns
|
||||
*/
|
||||
protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[];
|
||||
/**
|
||||
* Get all locale keys that start with `pmcresponse-suffix`
|
||||
* @returns array of keys
|
||||
*/
|
||||
protected getResponseSuffixLocaleKeys(): string[];
|
||||
/**
|
||||
* Randomly draw a victim of the the array and return thier details
|
||||
* @param pmcVictims Possible victims to choose from
|
||||
* @returns IUserDialogInfo
|
||||
*/
|
||||
protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo;
|
||||
/**
|
||||
* Convert a victim object into a IUserDialogInfo object
|
||||
* @param pmcVictim victim to convert
|
||||
* @returns IUserDialogInfo
|
||||
*/
|
||||
protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo;
|
||||
}
|
||||
21
types/services/ProfileActivityService.d.ts
vendored
Normal file
21
types/services/ProfileActivityService.d.ts
vendored
Normal 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;
|
||||
}
|
||||
193
types/services/ProfileFixerService.d.ts
vendored
Normal file
193
types/services/ProfileFixerService.d.ts
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
import { HideoutHelper } from "@spt/helpers/HideoutHelper";
|
||||
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Bonus, HideoutSlot } from "@spt/models/eft/common/tables/IBotBase";
|
||||
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { StageBonus } from "@spt/models/eft/hideout/IHideoutArea";
|
||||
import { ISptProfile, IEquipmentBuild, IMagazineBuild, IWeaponBuild } from "@spt/models/eft/profile/ISptProfile";
|
||||
import { HideoutAreas } from "@spt/models/enums/HideoutAreas";
|
||||
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
import { Watermark } from "@spt/utils/Watermark";
|
||||
export declare class ProfileFixerService {
|
||||
protected logger: ILogger;
|
||||
protected watermark: Watermark;
|
||||
protected databaseService: DatabaseService;
|
||||
protected hideoutHelper: HideoutHelper;
|
||||
protected inventoryHelper: InventoryHelper;
|
||||
protected traderHelper: TraderHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected jsonUtil: JsonUtil;
|
||||
protected hashUtil: HashUtil;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected coreConfig: ICoreConfig;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
constructor(logger: ILogger, watermark: Watermark, databaseService: DatabaseService, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Find issues in the pmc profile data that may cause issues and fix them
|
||||
* @param pmcProfile profile to check and fix
|
||||
*/
|
||||
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Find issues in the scav profile data that may cause issues
|
||||
* @param scavProfile profile to check and fix
|
||||
*/
|
||||
checkForAndFixScavProfileIssues(scavProfile: IPmcData): void;
|
||||
protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void;
|
||||
protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void;
|
||||
protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void;
|
||||
protected addHideoutAreaStashes(pmcProfile: IPmcData): void;
|
||||
protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Add tag to profile to indicate when it was made
|
||||
* @param fullProfile
|
||||
*/
|
||||
addMissingSptVersionTagToProfile(fullProfile: ISptProfile): void;
|
||||
/**
|
||||
* TODO - make this non-public - currently used by RepeatableQuestController
|
||||
* Remove unused condition counters
|
||||
* @param pmcProfile profile to remove old counters from
|
||||
*/
|
||||
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
|
||||
addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void;
|
||||
protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them
|
||||
* @param pmcProfile Player profile to check
|
||||
*/
|
||||
protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void;
|
||||
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
|
||||
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
|
||||
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Adjust profile quest status and statusTimers object values
|
||||
* quest.status is numeric e.g. 2
|
||||
* quest.statusTimers keys are numeric as strings e.g. "2"
|
||||
* @param profile profile to update
|
||||
*/
|
||||
protected updateProfileQuestDataValues(profile: IPmcData): void;
|
||||
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Some profiles have hideout maxed and therefore no improvements
|
||||
* @param pmcProfile Profile to add improvement data to
|
||||
*/
|
||||
protected addMissingWallImprovements(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* A new property was added to slot items "locationIndex", if this is missing, the hideout slot item must be removed
|
||||
* @param pmcProfile Profile to find and remove slots from
|
||||
*/
|
||||
protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Hideout slots need to be in a specific order, locationIndex in ascending order
|
||||
* @param pmcProfile profile to edit
|
||||
*/
|
||||
protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* add in objects equal to the number of slots
|
||||
* @param areaType area to check
|
||||
* @param pmcProfile profile to update
|
||||
*/
|
||||
protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void;
|
||||
protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[];
|
||||
/**
|
||||
* Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing
|
||||
* @param pmcProfile Profile to update
|
||||
*/
|
||||
addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* @param profileBonuses bonuses from profile
|
||||
* @param bonus bonus to find
|
||||
* @returns matching bonus
|
||||
*/
|
||||
protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus | undefined;
|
||||
/**
|
||||
* Checks profile inventiory for items that do not exist inside the items db
|
||||
* @param sessionId Session id
|
||||
* @param pmcProfile Profile to check inventory of
|
||||
*/
|
||||
checkForOrphanedModdedItems(sessionId: string, fullProfile: ISptProfile): 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
|
||||
* @param pmcProfile Profile to check items of
|
||||
*/
|
||||
fixProfileBreakingInventoryItemIssues(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Add `Improvements` object to hideout if missing - added in eft 13.0.21469
|
||||
* @param pmcProfile profile to update
|
||||
*/
|
||||
addMissingUpgradesPropertyToHideout(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* Iterate over associated profile template and check all hideout areas exist, add if not
|
||||
* @param fullProfile Profile to update
|
||||
*/
|
||||
addMissingHideoutAreasToProfile(fullProfile: ISptProfile): void;
|
||||
/**
|
||||
* These used to be used for storing scav case rewards, rewards are now generated on pickup
|
||||
* @param pmcProfile Profile to update
|
||||
*/
|
||||
removeLegacyScavCaseProductionCrafts(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* 3.7.0 moved AIDs to be numeric, old profiles need to be migrated
|
||||
* We store the old AID value in new field `sessionId`
|
||||
* @param fullProfile Profile to update
|
||||
*/
|
||||
fixIncorrectAidValue(fullProfile: ISptProfile): void;
|
||||
/**
|
||||
* Bsg nested `stats` into a sub object called 'eft'
|
||||
* @param fullProfile Profile to check for and migrate stats data
|
||||
*/
|
||||
migrateStatsToNewStructure(fullProfile: ISptProfile): void;
|
||||
/**
|
||||
* 26126 (7th August) requires bonuses to have an ID, these were not included in the default profile presets
|
||||
* @param pmcProfile Profile to add missing IDs to
|
||||
*/
|
||||
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
|
||||
* @param pmcProfile Profile to migrate improvements in
|
||||
*/
|
||||
protected migrateImprovements(pmcProfile: IPmcData): void;
|
||||
/**
|
||||
* After removing mods that add quests, the quest panel will break without removing these
|
||||
* @param pmcProfile Profile to remove dead quests from
|
||||
*/
|
||||
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 undefined
|
||||
*/
|
||||
protected fixNullTraderNextResupply(pmcProfile: IPmcData): void;
|
||||
}
|
||||
30
types/services/ProfileSnapshotService.d.ts
vendored
Normal file
30
types/services/ProfileSnapshotService.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
export declare class ProfileSnapshotService {
|
||||
protected cloner: ICloner;
|
||||
protected storedProfileSnapshots: Record<string, ISptProfile>;
|
||||
constructor(cloner: ICloner);
|
||||
/**
|
||||
* Store a profile into an in-memory object
|
||||
* @param sessionID session id - acts as the key
|
||||
* @param profile - profile to save
|
||||
*/
|
||||
storeProfileSnapshot(sessionID: string, profile: ISptProfile): void;
|
||||
/**
|
||||
* Retreve a stored profile
|
||||
* @param sessionID key
|
||||
* @returns A player profile object
|
||||
*/
|
||||
getProfileSnapshot(sessionID: string): ISptProfile | undefined;
|
||||
/**
|
||||
* Does a profile exists against the provided key
|
||||
* @param sessionID key
|
||||
* @returns true if exists
|
||||
*/
|
||||
hasProfileSnapshot(sessionID: string): boolean;
|
||||
/**
|
||||
* Remove a stored profile by key
|
||||
* @param sessionID key
|
||||
*/
|
||||
clearProfileSnapshot(sessionID: string): void;
|
||||
}
|
||||
17
types/services/RagfairCategoriesService.d.ts
vendored
Normal file
17
types/services/RagfairCategoriesService.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
export declare class RagfairCategoriesService {
|
||||
protected logger: ILogger;
|
||||
protected paymentHelper: PaymentHelper;
|
||||
constructor(logger: ILogger, paymentHelper: PaymentHelper);
|
||||
/**
|
||||
* Get a dictionary of each item the play can see in their flea menu, filtered by what is available for them to buy
|
||||
* @param offers All offers in flea
|
||||
* @param searchRequestData Search criteria requested
|
||||
* @param fleaUnlocked Can player see full flea yet (level 15 by default)
|
||||
* @returns KVP of item tpls + count of offers
|
||||
*/
|
||||
getCategoriesFromOffers(offers: IRagfairOffer[], searchRequestData: ISearchRequestData, fleaUnlocked: boolean): Record<string, number>;
|
||||
}
|
||||
33
types/services/RagfairLinkedItemService.d.ts
vendored
Normal file
33
types/services/RagfairLinkedItemService.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
export declare class RagfairLinkedItemService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected linkedItemsCache: Record<string, Set<string>>;
|
||||
constructor(databaseService: DatabaseService, itemHelper: ItemHelper);
|
||||
getLinkedItems(linkedSearchId: string): Set<string>;
|
||||
/**
|
||||
* Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl
|
||||
* @param itemTpl Item to get sub-items for
|
||||
* @returns ITemplateItem array
|
||||
*/
|
||||
getLinkedDbItems(itemTpl: string): ITemplateItem[];
|
||||
/**
|
||||
* Create Dictionary of every item and the items associated with it
|
||||
*/
|
||||
protected buildLinkedItemTable(): void;
|
||||
/**
|
||||
* Add ammo to revolvers linked item dictionary
|
||||
* @param cylinder Revolvers cylinder
|
||||
* @param applyLinkedItems
|
||||
*/
|
||||
protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void;
|
||||
/**
|
||||
* Scans a given slot type for filters and returns them as a Set
|
||||
* @param item
|
||||
* @param slot
|
||||
* @returns array of ids
|
||||
*/
|
||||
protected getFilters(item: ITemplateItem, slot: string): string[];
|
||||
}
|
||||
99
types/services/RagfairOfferService.d.ts
vendored
Normal file
99
types/services/RagfairOfferService.d.ts
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
export declare class RagfairOfferService {
|
||||
protected logger: ILogger;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
*/
|
||||
getOffers(): IRagfairOffer[];
|
||||
getOfferByOfferId(offerId: string): IRagfairOffer | undefined;
|
||||
getOffersOfType(templateId: string): IRagfairOffer[] | undefined;
|
||||
addOffer(offer: IRagfairOffer): void;
|
||||
addOfferToExpired(staleOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Get total count of current expired offers
|
||||
* @returns Number of expired offers
|
||||
*/
|
||||
getExpiredOfferCount(): number;
|
||||
/**
|
||||
* Get an array of arrays of expired offer items + children
|
||||
* @returns Expired offer assorts
|
||||
*/
|
||||
getExpiredOfferAssorts(): Item[][];
|
||||
/**
|
||||
* Clear out internal expiredOffers dictionary of all items
|
||||
*/
|
||||
resetExpiredOffers(): void;
|
||||
/**
|
||||
* Does the offer exist on the ragfair
|
||||
* @param offerId offer id to check for
|
||||
* @returns offer exists - true
|
||||
*/
|
||||
doesOfferExist(offerId: string): boolean;
|
||||
/**
|
||||
* Remove an offer from ragfair by offer id
|
||||
* @param offerId Offer id to remove
|
||||
*/
|
||||
removeOfferById(offerId: string): void;
|
||||
/**
|
||||
* Reduce size of an offer stack by specified amount
|
||||
* @param offerId Offer to adjust stack size of
|
||||
* @param amount How much to deduct from offers stack size
|
||||
*/
|
||||
removeOfferStack(offerId: string, amount: number): void;
|
||||
removeAllOffersByTrader(traderId: string): void;
|
||||
/**
|
||||
* Do the trader offers on flea need to be refreshed
|
||||
* @param traderID Trader to check
|
||||
* @returns true if they do
|
||||
*/
|
||||
traderOffersNeedRefreshing(traderID: string): boolean;
|
||||
addPlayerOffers(): void;
|
||||
expireStaleOffers(): void;
|
||||
/**
|
||||
* Remove stale offer from flea
|
||||
* @param staleOffer Stale offer to process
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
163
types/services/RagfairPriceService.d.ts
vendored
Normal file
163
types/services/RagfairPriceService.d.ts
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
import { OnLoad } from "@spt/di/OnLoad";
|
||||
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { MinMax } from "@spt/models/common/MinMax";
|
||||
import { IPreset } from "@spt/models/eft/common/IGlobals";
|
||||
import { HandbookItem } from "@spt/models/eft/common/tables/IHandbookBase";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
|
||||
import { IRagfairConfig, IUnreasonableModPrices } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { IRagfairServerPrices } from "@spt/models/spt/ragfair/IRagfairServerPrices";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
/**
|
||||
* Stores flea prices for items as well as methods to interact with them
|
||||
*/
|
||||
export declare class RagfairPriceService implements OnLoad {
|
||||
protected handbookHelper: HandbookHelper;
|
||||
protected databaseService: DatabaseService;
|
||||
protected logger: ILogger;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected presetHelper: PresetHelper;
|
||||
protected traderHelper: TraderHelper;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected prices: IRagfairServerPrices;
|
||||
constructor(handbookHelper: HandbookHelper, databaseService: DatabaseService, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, traderHelper: TraderHelper, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
/**
|
||||
* Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries
|
||||
*/
|
||||
onLoad(): Promise<void>;
|
||||
getRoute(): string;
|
||||
/**
|
||||
* Iterate over all items of type "Item" in db and get template price, store in cache
|
||||
*/
|
||||
refreshStaticPrices(): void;
|
||||
/**
|
||||
* Copy the prices.json data into our dynamic price dictionary
|
||||
*/
|
||||
refreshDynamicPrices(): void;
|
||||
/**
|
||||
* Get the dynamic price for an item. If value doesn't exist, use static (handbook) value.
|
||||
* if no static value, return 1
|
||||
* @param tplId Item tpl id to get price for
|
||||
* @returns price in roubles
|
||||
*/
|
||||
getFleaPriceForItem(tplId: string): number;
|
||||
/**
|
||||
* Get the flea price for an offers items + children
|
||||
* @param offerItems offer item + children to process
|
||||
* @returns Rouble price
|
||||
*/
|
||||
getFleaPriceForOfferItems(offerItems: Item[]): number;
|
||||
/**
|
||||
* get the dynamic (flea) price for an item
|
||||
* @param itemTpl item template id to look up
|
||||
* @returns price in roubles
|
||||
*/
|
||||
getDynamicPriceForItem(itemTpl: string): number;
|
||||
/**
|
||||
* Grab the static (handbook) for an item by its tplId
|
||||
* @param itemTpl item template id to look up
|
||||
* @returns price in roubles
|
||||
*/
|
||||
getStaticPriceForItem(itemTpl: string): number;
|
||||
/**
|
||||
* Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing
|
||||
* This will refresh the caches prior to building the output
|
||||
* @returns Dictionary of item tpls and rouble cost
|
||||
*/
|
||||
getAllFleaPrices(): Record<string, number>;
|
||||
getAllStaticPrices(): Record<string, number>;
|
||||
/**
|
||||
* Get the percentage difference between two values
|
||||
* @param a numerical value a
|
||||
* @param b numerical value b
|
||||
* @returns different in percent
|
||||
*/
|
||||
protected getPriceDifference(a: number, b: number): number;
|
||||
/**
|
||||
* Get the rouble price for an assorts barter scheme
|
||||
* @param barterScheme
|
||||
* @returns Rouble price
|
||||
*/
|
||||
getBarterPrice(barterScheme: IBarterScheme[]): number;
|
||||
/**
|
||||
* Generate a currency cost for an item and its mods
|
||||
* @param offerItems Item with mods to get price for
|
||||
* @param desiredCurrency Currency price desired in
|
||||
* @param isPackOffer Price is for a pack type offer
|
||||
* @returns cost of item in desired currency
|
||||
*/
|
||||
getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number;
|
||||
/**
|
||||
* @param itemTemplateId items tpl value
|
||||
* @param desiredCurrency Currency to return result in
|
||||
* @param item Item object (used for weapon presets)
|
||||
* @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
|
||||
* @param handbookPrices Prices of items in handbook
|
||||
* @param unreasonableItemChange Change object from config
|
||||
* @param itemTpl Item being adjusted
|
||||
* @param price Current price of item
|
||||
* @returns Adjusted price of item
|
||||
*/
|
||||
protected adjustUnreasonablePrice(handbookPrices: HandbookItem[], unreasonableItemChange: IUnreasonableModPrices, itemTpl: string, price: number): number;
|
||||
/**
|
||||
* Get different min/max price multipliers for different offer types (preset/pack/default)
|
||||
* @param isPreset Offer is a preset
|
||||
* @param isPack Offer is a pack
|
||||
* @returns MinMax values
|
||||
*/
|
||||
protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax;
|
||||
/**
|
||||
* Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json
|
||||
* @param itemPrice price of item
|
||||
* @param itemTpl item template Id being checked
|
||||
* @returns adjusted price value in roubles
|
||||
*/
|
||||
protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number;
|
||||
/**
|
||||
* Multiply the price by a randomised curve where n = 2, shift = 2
|
||||
* @param existingPrice price to alter
|
||||
* @param rangeValues min and max to adjust price by
|
||||
* @returns multiplied price
|
||||
*/
|
||||
protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number;
|
||||
/**
|
||||
* Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset
|
||||
* @param weaponRootItem base weapon
|
||||
* @param weaponWithChildren weapon plus mods
|
||||
* @param existingPrice price of existing base weapon
|
||||
* @returns price of weapon in roubles
|
||||
*/
|
||||
protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number;
|
||||
/**
|
||||
* Get the highest price for an item that is stored in handbook or trader assorts
|
||||
* @param itemTpl Item to get highest price of
|
||||
* @returns rouble cost
|
||||
*/
|
||||
protected getHighestHandbookOrTraderPriceAsRouble(itemTpl: string): number;
|
||||
/**
|
||||
* Attempt to get the default preset for a weapon, failing that get the first preset in the array
|
||||
* (assumes default = has encyclopedia entry)
|
||||
* @param presets weapon presets to choose from
|
||||
* @returns Default preset object
|
||||
*/
|
||||
protected getWeaponPreset(weapon: Item): {
|
||||
isDefault: boolean;
|
||||
preset: IPreset;
|
||||
};
|
||||
}
|
||||
13
types/services/RagfairRequiredItemsService.d.ts
vendored
Normal file
13
types/services/RagfairRequiredItemsService.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { RagfairOfferService } from "@spt/services/RagfairOfferService";
|
||||
export declare class RagfairRequiredItemsService {
|
||||
protected logger: ILogger;
|
||||
protected paymentHelper: PaymentHelper;
|
||||
protected ragfairOfferService: RagfairOfferService;
|
||||
protected requiredItemsCache: {};
|
||||
constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService);
|
||||
getRequiredItemsById(searchId: string): IRagfairOffer[];
|
||||
buildRequiredItemTable(): void;
|
||||
}
|
||||
31
types/services/RagfairTaxService.d.ts
vendored
Normal file
31
types/services/RagfairTaxService.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { IStorePlayerOfferTaxAmountRequestData } from "@spt/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||
export declare class RagfairTaxService {
|
||||
protected logger: ILogger;
|
||||
protected databaseService: DatabaseService;
|
||||
protected ragfairPriceService: RagfairPriceService;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected playerOfferTaxCache: Record<string, IStorePlayerOfferTaxAmountRequestData>;
|
||||
constructor(logger: ILogger, databaseService: DatabaseService, ragfairPriceService: RagfairPriceService, itemHelper: ItemHelper);
|
||||
storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void;
|
||||
clearStoredOfferTaxById(offerIdToRemove: string): void;
|
||||
getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData;
|
||||
/**
|
||||
// This method, along with calculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice".
|
||||
// It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary.
|
||||
* @param item Item being sold on flea
|
||||
* @param pmcData player profile
|
||||
* @param requirementsValue
|
||||
* @param offerItemCount Number of offers being created
|
||||
* @param sellInOnePiece
|
||||
* @returns Tax in roubles
|
||||
*/
|
||||
calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number;
|
||||
protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number;
|
||||
}
|
||||
60
types/services/RaidTimeAdjustmentService.d.ts
vendored
Normal file
60
types/services/RaidTimeAdjustmentService.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { ApplicationContext } from "@spt/context/ApplicationContext";
|
||||
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
|
||||
import { IGetRaidTimeRequest } from "@spt/models/eft/game/IGetRaidTimeRequest";
|
||||
import { ExtractChange, IGetRaidTimeResponse } from "@spt/models/eft/game/IGetRaidTimeResponse";
|
||||
import { ILocationConfig, IScavRaidTimeLocationSettings, LootMultiplier } from "@spt/models/spt/config/ILocationConfig";
|
||||
import { IRaidChanges } from "@spt/models/spt/location/IRaidChanges";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
export declare class RaidTimeAdjustmentService {
|
||||
protected logger: ILogger;
|
||||
protected databaseService: DatabaseService;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected weightedRandomHelper: WeightedRandomHelper;
|
||||
protected applicationContext: ApplicationContext;
|
||||
protected configServer: ConfigServer;
|
||||
protected locationConfig: ILocationConfig;
|
||||
constructor(logger: ILogger, databaseService: DatabaseService, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
|
||||
/**
|
||||
* Make alterations to the base map data passed in
|
||||
* Loot multipliers/waves/wave start times
|
||||
* @param raidAdjustments Changes to process on map
|
||||
* @param mapBase Map to adjust
|
||||
*/
|
||||
makeAdjustmentsToMap(raidAdjustments: IRaidChanges, mapBase: ILocationBase): void;
|
||||
/**
|
||||
* Adjust the loot multiplier values passed in to be a % of their original value
|
||||
* @param mapLootMultiplers Multiplers to adjust
|
||||
* @param loosePercent Percent to change values to
|
||||
*/
|
||||
protected adjustLootMultipliers(mapLootMultiplers: LootMultiplier, loosePercent: number): void;
|
||||
/**
|
||||
* Adjust bot waves to act as if player spawned later
|
||||
* @param mapBase map to adjust
|
||||
* @param raidAdjustments Map adjustments
|
||||
*/
|
||||
protected adjustWaves(mapBase: ILocationBase, raidAdjustments: IRaidChanges): void;
|
||||
/**
|
||||
* Create a randomised adjustment to the raid based on map data in location.json
|
||||
* @param sessionId Session id
|
||||
* @param request Raid adjustment request
|
||||
* @returns Response to send to client
|
||||
*/
|
||||
getRaidAdjustments(sessionId: string, request: IGetRaidTimeRequest): IGetRaidTimeResponse;
|
||||
/**
|
||||
* Get raid start time settings for specific map
|
||||
* @param location Map Location e.g. bigmap
|
||||
* @returns IScavRaidTimeLocationSettings
|
||||
*/
|
||||
protected getMapSettings(location: string): IScavRaidTimeLocationSettings;
|
||||
/**
|
||||
* Adjust exit times to handle scavs entering raids part-way through
|
||||
* @param mapBase Map base file player is on
|
||||
* @param newRaidTimeMinutes How long raid is in minutes
|
||||
* @returns List of exit changes to send to client
|
||||
*/
|
||||
protected getExitAdjustments(mapBase: ILocationBase, newRaidTimeMinutes: number): ExtractChange[] | undefined;
|
||||
}
|
||||
145
types/services/RepairService.d.ts
vendored
Normal file
145
types/services/RepairService.d.ts
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RepairHelper } from "@spt/helpers/RepairHelper";
|
||||
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
import { RepairKitsInfo } from "@spt/models/eft/repair/IRepairActionDataRequest";
|
||||
import { RepairItem } from "@spt/models/eft/repair/ITraderRepairActionDataRequest";
|
||||
import { BonusType } from "@spt/models/enums/BonusType";
|
||||
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
||||
import { BonusSettings, IRepairConfig } from "@spt/models/spt/config/IRepairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { PaymentService } from "@spt/services/PaymentService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
export declare class RepairService {
|
||||
protected logger: ILogger;
|
||||
protected databaseService: DatabaseService;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected traderHelper: TraderHelper;
|
||||
protected weightedRandomHelper: WeightedRandomHelper;
|
||||
protected paymentService: PaymentService;
|
||||
protected repairHelper: RepairHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected repairConfig: IRepairConfig;
|
||||
constructor(logger: ILogger, databaseService: DatabaseService, profileHelper: ProfileHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, traderHelper: TraderHelper, weightedRandomHelper: WeightedRandomHelper, paymentService: PaymentService, repairHelper: RepairHelper, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
/**
|
||||
* Use trader to repair an items durability
|
||||
* @param sessionID Session id
|
||||
* @param pmcData profile to find item to repair in
|
||||
* @param repairItemDetails details of the item to repair
|
||||
* @param traderId Trader being used to repair item
|
||||
* @returns RepairDetails object
|
||||
*/
|
||||
repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails;
|
||||
/**
|
||||
* @param sessionID Session id
|
||||
* @param pmcData profile to take money from
|
||||
* @param repairedItemId Repaired item id
|
||||
* @param repairCost Cost to repair item in roubles
|
||||
* @param traderId Id of the trader who repaired the item / who is paid
|
||||
* @param output
|
||||
*/
|
||||
payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void;
|
||||
/**
|
||||
* Add skill points to profile after repairing an item
|
||||
* @param sessionId Session id
|
||||
* @param repairDetails details of item repaired, cost/item
|
||||
* @param pmcData Profile to add points to
|
||||
*/
|
||||
addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData): void;
|
||||
protected getIntellectGainedFromRepair(repairDetails: RepairDetails): number;
|
||||
/**
|
||||
* Return an appromixation of the amount of skill points live would return for the given repairDetails
|
||||
* @param repairDetails the repair details to calculate skill points for
|
||||
* @returns the number of skill points to reward the user
|
||||
*/
|
||||
protected getWeaponRepairSkillPoints(repairDetails: RepairDetails): number;
|
||||
/**
|
||||
* @param sessionId Session id
|
||||
* @param pmcData Profile to update repaired item in
|
||||
* @param repairKits Array of Repair kits to use
|
||||
* @param itemToRepairId Item id to repair
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns Details of repair, item/price
|
||||
*/
|
||||
repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails;
|
||||
/**
|
||||
* Calculate value repairkit points need to be divided by to get the durability points to be added to an item
|
||||
* @param itemToRepairDetails Item to repair details
|
||||
* @param isArmor Is the item being repaired armor
|
||||
* @param pmcData Player profile
|
||||
* @returns Number to divide kit points by
|
||||
*/
|
||||
protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number;
|
||||
/**
|
||||
* Get the bonus multiplier for a skill from a player profile
|
||||
* @param skillBonus Bonus to get multipler of
|
||||
* @param pmcData Player profile to look in for skill
|
||||
* @returns Multiplier value
|
||||
*/
|
||||
protected getBonusMultiplierValue(skillBonus: BonusType, pmcData: IPmcData): number;
|
||||
/**
|
||||
* Should a repair kit apply total durability loss on repair
|
||||
* @param pmcData Player profile
|
||||
* @param applyRandomizeDurabilityLoss Value from repair config
|
||||
* @returns True if loss should be applied
|
||||
*/
|
||||
protected shouldRepairKitApplyDurabilityLoss(pmcData: IPmcData, applyRandomizeDurabilityLoss: boolean): boolean;
|
||||
/**
|
||||
* Update repair kits Resource object if it doesn't exist
|
||||
* @param repairKitDetails Repair kit details from db
|
||||
* @param repairKitInInventory Repair kit to update
|
||||
*/
|
||||
protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void;
|
||||
/**
|
||||
* Chance to apply buff to an item (Armor/weapon) if repaired by armor kit
|
||||
* @param repairDetails Repair details of item
|
||||
* @param pmcData Player profile
|
||||
*/
|
||||
addBuffToItem(repairDetails: RepairDetails, pmcData: IPmcData): void;
|
||||
/**
|
||||
* Add random buff to item
|
||||
* @param itemConfig weapon/armor config
|
||||
* @param repairDetails Details for item to repair
|
||||
*/
|
||||
addBuff(itemConfig: BonusSettings, item: Item): void;
|
||||
/**
|
||||
* Check if item should be buffed by checking the item type and relevant player skill level
|
||||
* @param repairDetails Item that was repaired
|
||||
* @param itemTpl tpl of item to be buffed
|
||||
* @param pmcData Player profile
|
||||
* @returns True if item should have buff applied
|
||||
*/
|
||||
protected shouldBuffItem(repairDetails: RepairDetails, pmcData: IPmcData): boolean;
|
||||
/**
|
||||
* Based on item, what underlying skill does this item use for buff settings
|
||||
* @param itemTemplate Item to check for skill
|
||||
* @returns Skill name
|
||||
*/
|
||||
protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined;
|
||||
/**
|
||||
* Ensure multiplier is between 1 and 0.01
|
||||
* @param receiveDurabilityMaxPercent Max durability percent
|
||||
* @param receiveDurabilityPercent current durability percent
|
||||
* @returns durability multiplier value
|
||||
*/
|
||||
protected getDurabilityMultiplier(receiveDurabilityMaxPercent: number, receiveDurabilityPercent: number): number;
|
||||
}
|
||||
export declare class RepairDetails {
|
||||
repairCost?: number;
|
||||
repairPoints?: number;
|
||||
repairedItem: Item;
|
||||
repairedItemIsArmor: boolean;
|
||||
repairAmount: number;
|
||||
repairedByKit: boolean;
|
||||
}
|
||||
159
types/services/SeasonalEventService.d.ts
vendored
Normal file
159
types/services/SeasonalEventService.d.ts
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { IConfig } from "@spt/models/eft/common/IGlobals";
|
||||
import { Inventory } from "@spt/models/eft/common/tables/IBotType";
|
||||
import { Season } from "@spt/models/enums/Season";
|
||||
import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
|
||||
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
|
||||
import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||
import { ISeasonalEvent, ISeasonalEventConfig } from "@spt/models/spt/config/ISeasonalEventConfig";
|
||||
import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { GiftService } from "@spt/services/GiftService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { DatabaseImporter } from "@spt/utils/DatabaseImporter";
|
||||
export declare class SeasonalEventService {
|
||||
protected logger: ILogger;
|
||||
protected databaseService: DatabaseService;
|
||||
protected databaseImporter: DatabaseImporter;
|
||||
protected giftService: GiftService;
|
||||
protected localisationService: LocalisationService;
|
||||
protected botHelper: BotHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected configServer: ConfigServer;
|
||||
protected seasonalEventConfig: ISeasonalEventConfig;
|
||||
protected questConfig: IQuestConfig;
|
||||
protected httpConfig: IHttpConfig;
|
||||
protected weatherConfig: IWeatherConfig;
|
||||
protected halloweenEventActive?: boolean;
|
||||
protected christmasEventActive?: boolean;
|
||||
/** All events active at this point in time */
|
||||
protected currentlyActiveEvents: SeasonalEventType[];
|
||||
constructor(logger: ILogger, databaseService: DatabaseService, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
|
||||
protected get christmasEventItems(): string[];
|
||||
protected get halloweenEventItems(): string[];
|
||||
/**
|
||||
* Get an array of christmas items found in bots inventories as loot
|
||||
* @returns array
|
||||
*/
|
||||
getChristmasEventItems(): string[];
|
||||
/**
|
||||
* Get an array of halloween items found in bots inventories as loot
|
||||
* @returns array
|
||||
*/
|
||||
getHalloweenEventItems(): string[];
|
||||
itemIsChristmasRelated(itemTpl: string): boolean;
|
||||
itemIsHalloweenRelated(itemTpl: string): boolean;
|
||||
/**
|
||||
* Check if item id exists in christmas or halloween event arrays
|
||||
* @param itemTpl item tpl to check for
|
||||
* @returns
|
||||
*/
|
||||
itemIsSeasonalRelated(itemTpl: string): boolean;
|
||||
/**
|
||||
* Get an array of seasonal items that should not appear
|
||||
* e.g. if halloween is active, only return christmas items
|
||||
* or, if halloween and christmas are inactive, return both sets of items
|
||||
* @returns array of tpl strings
|
||||
*/
|
||||
getInactiveSeasonalEventItems(): string[];
|
||||
/**
|
||||
* Is a seasonal event currently active
|
||||
* @returns true if event is active
|
||||
*/
|
||||
seasonalEventEnabled(): boolean;
|
||||
/**
|
||||
* Is christmas event active
|
||||
* @returns true if active
|
||||
*/
|
||||
christmasEventEnabled(): boolean;
|
||||
/**
|
||||
* is halloween event active
|
||||
* @returns true if active
|
||||
*/
|
||||
halloweenEventEnabled(): boolean;
|
||||
/**
|
||||
* Is detection of seasonal events enabled (halloween / christmas)
|
||||
* @returns true if seasonal events should be checked for
|
||||
*/
|
||||
isAutomaticEventDetectionEnabled(): boolean;
|
||||
/**
|
||||
* Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween
|
||||
* @param eventName Name of event to get gear changes for
|
||||
* @returns bots with equipment changes
|
||||
*/
|
||||
protected getEventBotGear(eventType: SeasonalEventType): Record<string, Record<string, Record<string, number>>>;
|
||||
/**
|
||||
* Get the dates each seasonal event starts and ends at
|
||||
* @returns Record with event name + start/end date
|
||||
*/
|
||||
getEventDetails(): ISeasonalEvent[];
|
||||
/**
|
||||
* Look up quest in configs/quest.json
|
||||
* @param questId Quest to look up
|
||||
* @param event event type (Christmas/Halloween/None)
|
||||
* @returns true if related
|
||||
*/
|
||||
isQuestRelatedToEvent(questId: string, event: SeasonalEventType): boolean;
|
||||
/**
|
||||
* Handle seasonal events
|
||||
* @param sessionId Players id
|
||||
*/
|
||||
enableSeasonalEvents(sessionId: string): void;
|
||||
protected cacheActiveEvents(): void;
|
||||
getActiveWeatherSeason(): Season;
|
||||
/**
|
||||
* Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService)
|
||||
* @param botInventory Bots inventory to iterate over
|
||||
* @param botRole the role of the bot being processed
|
||||
*/
|
||||
removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void;
|
||||
/**
|
||||
* Make adjusted to server code based on the name of the event passed in
|
||||
* @param sessionId Player id
|
||||
* @param globalConfig globals.json
|
||||
* @param eventName Name of the event to enable. e.g. Christmas
|
||||
*/
|
||||
protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void;
|
||||
protected adjustZryachiyMeleeChance(): void;
|
||||
protected enableHalloweenSummonEvent(): void;
|
||||
protected addEventBossesToMaps(eventType: SeasonalEventType): void;
|
||||
/**
|
||||
* Change trader icons to be more event themed (Halloween only so far)
|
||||
* @param eventType What event is active
|
||||
*/
|
||||
protected adjustTraderIcons(eventType: SeasonalEventType): void;
|
||||
/**
|
||||
* Add lootble items from backpack into patrol.ITEMS_TO_DROP difficulty property
|
||||
*/
|
||||
protected addLootItemsToGifterDropItemsList(): void;
|
||||
/**
|
||||
* Read in data from seasonalEvents.json and add found equipment items to bots
|
||||
* @param eventName Name of the event to read equipment in from config
|
||||
*/
|
||||
protected addEventGearToBots(eventType: SeasonalEventType): void;
|
||||
protected addPumpkinsToScavBackpacks(): void;
|
||||
/**
|
||||
* Set Khorovod(dancing tree) chance to 100% on all maps that support it
|
||||
*/
|
||||
protected enableDancingTree(): void;
|
||||
/**
|
||||
* Add santa to maps
|
||||
*/
|
||||
protected addGifterBotToMaps(): void;
|
||||
/**
|
||||
* Send gift to player if they'e not already received it
|
||||
* @param playerId Player to send gift to
|
||||
* @param giftKey Key of gift to give
|
||||
*/
|
||||
protected giveGift(playerId: string, giftKey: string): void;
|
||||
/**
|
||||
* Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy`
|
||||
* @param eventBotRole Event bot role type
|
||||
* @returns Bot role as string
|
||||
*/
|
||||
getBaseRoleForEventBot(eventBotRole: string): string;
|
||||
enableSnow(): void;
|
||||
}
|
||||
11
types/services/TraderAssortService.d.ts
vendored
Normal file
11
types/services/TraderAssortService.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
|
||||
export declare class TraderAssortService {
|
||||
protected pristineTraderAssorts: Record<string, ITraderAssort>;
|
||||
getPristineTraderAssort(traderId: string): ITraderAssort;
|
||||
/**
|
||||
* Store trader assorts inside a class property
|
||||
* @param traderId Traderid to store assorts against
|
||||
* @param assort Assorts to store
|
||||
*/
|
||||
setPristineTraderAssort(traderId: string, assort: ITraderAssort): void;
|
||||
}
|
||||
46
types/services/TraderPurchasePersisterService.d.ts
vendored
Normal file
46
types/services/TraderPurchasePersisterService.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { TraderPurchaseData } from "@spt/models/eft/profile/ISptProfile";
|
||||
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
/**
|
||||
* Help with storing limited item purchases from traders in profile to persist them over server restarts
|
||||
*/
|
||||
export declare class TraderPurchasePersisterService {
|
||||
protected logger: ILogger;
|
||||
protected timeUtil: TimeUtil;
|
||||
protected randomUtil: RandomUtil;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected traderConfig: ITraderConfig;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, randomUtil: RandomUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
/**
|
||||
* Get the purchases made from a trader for this profile before the last trader reset
|
||||
* @param sessionId Session id
|
||||
* @param traderId Trader to loop up purchases for
|
||||
* @returns Dict of assort id and count purchased
|
||||
*/
|
||||
getProfileTraderPurchases(sessionId: string, traderId: string): Record<string, TraderPurchaseData> | undefined;
|
||||
/**
|
||||
* Get a purchase made from a trader for requested profile before the last trader reset
|
||||
* @param sessionId Session id
|
||||
* @param traderId Trader to loop up purchases for
|
||||
* @param assortId Id of assort to get data for
|
||||
* @returns TraderPurchaseData
|
||||
*/
|
||||
getProfileTraderPurchase(sessionId: string, traderId: string, assortId: string): TraderPurchaseData | undefined;
|
||||
/**
|
||||
* Remove all trader purchase records from all profiles that exist
|
||||
* @param traderId Traders id
|
||||
*/
|
||||
resetTraderPurchasesStoredInProfile(traderId: string): void;
|
||||
/**
|
||||
* Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time
|
||||
* @param traderId Trader id
|
||||
*/
|
||||
removeStalePurchasesFromProfiles(traderId: string): void;
|
||||
}
|
||||
13
types/services/TraderServicesService.d.ts
vendored
Normal file
13
types/services/TraderServicesService.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
export declare class TraderServicesService {
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected logger: ILogger;
|
||||
protected databaseService: DatabaseService;
|
||||
protected cloner: ICloner;
|
||||
constructor(profileHelper: ProfileHelper, logger: ILogger, databaseService: DatabaseService, cloner: ICloner);
|
||||
getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[];
|
||||
}
|
||||
18
types/services/cache/BundleHashCacheService.d.ts
vendored
Normal file
18
types/services/cache/BundleHashCacheService.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||
import { VFS } from "@spt/utils/VFS";
|
||||
export declare class BundleHashCacheService {
|
||||
protected vfs: VFS;
|
||||
protected hashUtil: HashUtil;
|
||||
protected jsonUtil: JsonUtil;
|
||||
protected logger: ILogger;
|
||||
protected bundleHashes: Record<string, number>;
|
||||
protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json";
|
||||
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
|
||||
getStoredValue(key: string): number;
|
||||
storeValue(key: string, value: number): void;
|
||||
matchWithStoredHash(bundlePath: string, hash: number): boolean;
|
||||
calculateAndMatchHash(bundlePath: string): boolean;
|
||||
calculateAndStoreHash(bundlePath: string): void;
|
||||
}
|
||||
18
types/services/cache/ModHashCacheService.d.ts
vendored
Normal file
18
types/services/cache/ModHashCacheService.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||
import { VFS } from "@spt/utils/VFS";
|
||||
export declare class ModHashCacheService {
|
||||
protected vfs: VFS;
|
||||
protected hashUtil: HashUtil;
|
||||
protected jsonUtil: JsonUtil;
|
||||
protected logger: ILogger;
|
||||
protected modHashes: Record<string, string>;
|
||||
protected readonly modCachePath = "./user/cache/modCache.json";
|
||||
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
|
||||
getStoredValue(key: string): string;
|
||||
storeValue(key: string, value: string): void;
|
||||
matchWithStoredHash(modName: string, hash: string): boolean;
|
||||
calculateAndCompareHash(modName: string, modContent: string): boolean;
|
||||
calculateAndStoreHash(modName: string, modContent: string): void;
|
||||
}
|
||||
94
types/services/mod/CustomItemService.d.ts
vendored
Normal file
94
types/services/mod/CustomItemService.d.ts
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ITemplateItem, Props } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetails } from "@spt/models/spt/mod/NewItemDetails";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { ItemBaseClassService } from "@spt/services/ItemBaseClassService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
export declare class CustomItemService {
|
||||
protected logger: ILogger;
|
||||
protected hashUtil: HashUtil;
|
||||
protected databaseService: DatabaseService;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected itemBaseClassService: ItemBaseClassService;
|
||||
protected cloner: ICloner;
|
||||
constructor(logger: ILogger, hashUtil: HashUtil, databaseService: DatabaseService, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService, cloner: ICloner);
|
||||
/**
|
||||
* Create a new item from a cloned item base
|
||||
* WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start
|
||||
* Add to the items db
|
||||
* Add to the flea market
|
||||
* Add to the handbook
|
||||
* Add to the locales
|
||||
* @param newItemDetails Item details for the new item to be created
|
||||
* @returns tplId of the new item created
|
||||
*/
|
||||
createItemFromClone(newItemDetails: NewItemFromCloneDetails): CreateItemResult;
|
||||
/**
|
||||
* Create a new item without using an existing item as a template
|
||||
* Add to the items db
|
||||
* Add to the flea market
|
||||
* Add to the handbook
|
||||
* Add to the locales
|
||||
* @param newItemDetails Details on what the item to be created
|
||||
* @returns CreateItemResult containing the completed items Id
|
||||
*/
|
||||
createItem(newItemDetails: NewItemDetails): CreateItemResult;
|
||||
/**
|
||||
* If the id provided is an empty string, return a randomly generated guid, otherwise return the newId parameter
|
||||
* @param newId id supplied to code
|
||||
* @returns item id
|
||||
*/
|
||||
protected getOrGenerateIdForItem(newId: string): string;
|
||||
/**
|
||||
* Iterates through supplied properties and updates the cloned items properties with them
|
||||
* Complex objects cannot have overrides, they must be fully hydrated with values if they are to be used
|
||||
* @param overrideProperties new properties to apply
|
||||
* @param itemClone item to update
|
||||
*/
|
||||
protected updateBaseItemPropertiesWithOverrides(overrideProperties: Props, itemClone: ITemplateItem): void;
|
||||
/**
|
||||
* Addd a new item object to the in-memory representation of items.json
|
||||
* @param newItemId id of the item to add to items.json
|
||||
* @param itemToAdd Item to add against the new id
|
||||
*/
|
||||
protected addToItemsDb(newItemId: string, itemToAdd: ITemplateItem): void;
|
||||
/**
|
||||
* Add a handbook price for an item
|
||||
* @param newItemId id of the item being added
|
||||
* @param parentId parent id of the item being added
|
||||
* @param priceRoubles price of the item being added
|
||||
*/
|
||||
protected addToHandbookDb(newItemId: string, parentId: string, priceRoubles: number): void;
|
||||
/**
|
||||
* Iterate through the passed in locale data and add to each locale in turn
|
||||
* If data is not provided for each langauge eft uses, the first object will be used in its place
|
||||
* e.g.
|
||||
* en[0]
|
||||
* fr[1]
|
||||
*
|
||||
* No jp provided, so english will be used as a substitute
|
||||
* @param localeDetails key is language, value are the new locale details
|
||||
* @param newItemId id of the item being created
|
||||
*/
|
||||
protected addToLocaleDbs(localeDetails: Record<string, LocaleDetails>, newItemId: string): void;
|
||||
/**
|
||||
* Add a price to the in-memory representation of prices.json, used to inform the flea of an items price on the market
|
||||
* @param newItemId id of the new item
|
||||
* @param fleaPriceRoubles Price of the new item
|
||||
*/
|
||||
protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void;
|
||||
/**
|
||||
* Add a weapon to the hideout weapon shelf whitelist
|
||||
* @param newItemId Weapon id to add
|
||||
*/
|
||||
protected addToWeaponShelf(newItemId: string): void;
|
||||
/**
|
||||
* Add a custom weapon to PMCs loadout
|
||||
* @param weaponTpl Custom weapon tpl to add to PMCs
|
||||
* @param weaponWeight The weighting for the weapon to be picked vs other weapons
|
||||
* @param weaponSlot The slot the weapon should be added to (e.g. FirstPrimaryWeapon/SecondPrimaryWeapon/Holster)
|
||||
*/
|
||||
addCustomWeaponToPMCs(weaponTpl: string, weaponWeight: number, weaponSlot: string): void;
|
||||
}
|
||||
6
types/services/mod/dynamicRouter/DynamicRouterMod.d.ts
vendored
Normal file
6
types/services/mod/dynamicRouter/DynamicRouterMod.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { DynamicRouter, RouteAction } from "@spt/di/Router";
|
||||
export declare class DynamicRouterMod extends DynamicRouter {
|
||||
private topLevelRoute;
|
||||
constructor(routes: RouteAction[], topLevelRoute: string);
|
||||
getTopLevelRoute(): string;
|
||||
}
|
||||
7
types/services/mod/dynamicRouter/DynamicRouterModService.d.ts
vendored
Normal file
7
types/services/mod/dynamicRouter/DynamicRouterModService.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { RouteAction } from "@spt/di/Router";
|
||||
export declare class DynamicRouterModService {
|
||||
private container;
|
||||
constructor(container: DependencyContainer);
|
||||
registerDynamicRouter(name: string, routes: RouteAction[], topLevelRoute: string): void;
|
||||
}
|
||||
10
types/services/mod/httpListener/HttpListenerMod.d.ts
vendored
Normal file
10
types/services/mod/httpListener/HttpListenerMod.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { IHttpListener } from "@spt/servers/http/IHttpListener";
|
||||
export declare class HttpListenerMod implements IHttpListener {
|
||||
private canHandleOverride;
|
||||
private handleOverride;
|
||||
constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void);
|
||||
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): Promise<void>;
|
||||
}
|
||||
8
types/services/mod/httpListener/HttpListenerModService.d.ts
vendored
Normal file
8
types/services/mod/httpListener/HttpListenerModService.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
export declare class HttpListenerModService {
|
||||
protected container: DependencyContainer;
|
||||
constructor(container: DependencyContainer);
|
||||
registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void;
|
||||
}
|
||||
6
types/services/mod/image/ImageRouteService.d.ts
vendored
Normal file
6
types/services/mod/image/ImageRouteService.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare class ImageRouteService {
|
||||
protected routes: Record<string, string>;
|
||||
addRoute(urlKey: string, route: string): void;
|
||||
getByKey(urlKey: string): string;
|
||||
existsByKey(urlKey: string): boolean;
|
||||
}
|
||||
8
types/services/mod/onLoad/OnLoadMod.d.ts
vendored
Normal file
8
types/services/mod/onLoad/OnLoadMod.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { OnLoad } from "@spt/di/OnLoad";
|
||||
export declare class OnLoadMod implements OnLoad {
|
||||
private onLoadOverride;
|
||||
private getRouteOverride;
|
||||
constructor(onLoadOverride: () => void, getRouteOverride: () => string);
|
||||
onLoad(): Promise<void>;
|
||||
getRoute(): string;
|
||||
}
|
||||
6
types/services/mod/onLoad/OnLoadModService.d.ts
vendored
Normal file
6
types/services/mod/onLoad/OnLoadModService.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
export declare class OnLoadModService {
|
||||
protected container: DependencyContainer;
|
||||
constructor(container: DependencyContainer);
|
||||
registerOnLoad(name: string, onLoad: () => void, getRoute: () => string): void;
|
||||
}
|
||||
8
types/services/mod/onUpdate/OnUpdateMod.d.ts
vendored
Normal file
8
types/services/mod/onUpdate/OnUpdateMod.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||
export declare class OnUpdateMod implements OnUpdate {
|
||||
private onUpdateOverride;
|
||||
private getRouteOverride;
|
||||
constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string);
|
||||
onUpdate(timeSinceLastRun: number): Promise<boolean>;
|
||||
getRoute(): string;
|
||||
}
|
||||
6
types/services/mod/onUpdate/OnUpdateModService.d.ts
vendored
Normal file
6
types/services/mod/onUpdate/OnUpdateModService.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
export declare class OnUpdateModService {
|
||||
protected container: DependencyContainer;
|
||||
constructor(container: DependencyContainer);
|
||||
registerOnUpdate(name: string, onUpdate: (timeSinceLastRun: number) => boolean, getRoute: () => string): void;
|
||||
}
|
||||
6
types/services/mod/staticRouter/StaticRouterMod.d.ts
vendored
Normal file
6
types/services/mod/staticRouter/StaticRouterMod.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { RouteAction, StaticRouter } from "@spt/di/Router";
|
||||
export declare class StaticRouterMod extends StaticRouter {
|
||||
private topLevelRoute;
|
||||
constructor(routes: RouteAction[], topLevelRoute: string);
|
||||
getTopLevelRoute(): string;
|
||||
}
|
||||
7
types/services/mod/staticRouter/StaticRouterModService.d.ts
vendored
Normal file
7
types/services/mod/staticRouter/StaticRouterModService.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { RouteAction } from "@spt/di/Router";
|
||||
export declare class StaticRouterModService {
|
||||
protected container: DependencyContainer;
|
||||
constructor(container: DependencyContainer);
|
||||
registerStaticRouter(name: string, routes: RouteAction[], topLevelRoute: string): void;
|
||||
}
|
||||
Reference in New Issue
Block a user