diff --git a/advancedConfig.json b/advancedConfig.json deleted file mode 100644 index 6a2c095..0000000 --- a/advancedConfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "startDelayInSeconds": 6.9, - "baselineBulletId": "59e6906286f7746c9f75e847", - "baselineBulletPrice": 1000, - "bulletDamageMultiplierRedutionFactor": 0.7, - "baselineArmourId": "5c0e655586f774045612eeb2", - "baselineArmourWeight": 10, - "baselineArmourPrice": 200000, - "pricePerArmourClassStep": 100000, - "armourWeightMultiplierReductionFactor": 0.7, - "enableDebug": false, - "excludedCategories": ["5b5f78b786f77447ed5636af", "5b47574386f77428ca22b33c"], - "gunPriceFallback": 100000, - "useTraderPriceForOffersIfHigher": true -} \ No newline at end of file diff --git a/advancedConfig.jsonc b/advancedConfig.jsonc new file mode 100644 index 0000000..9885d38 --- /dev/null +++ b/advancedConfig.jsonc @@ -0,0 +1,50 @@ +{ + // Represents the M856A1 bullet which is a blacklist round that is good to balance the price of other ammos around. + "baselineBulletId": "59e6906286f7746c9f75e847", + + // The M856A1 will be 1000 roubles on the flea, better blacklisted rounds will be more expensive proportionally and worse rounds will be cheaper. + "baselineBulletPrice": 1000, + + // Reduces the weighting of the bullet damage against their flea price. So a blacklisted low pen, high dmg round won't be as expensive as better pen rounds. + "bulletDamageMultiplierRedutionFactor": 0.7, + + // When enabled, creates more logging, mostly for Platinum to debug things. + "enableDebug": true, + + // Items that are blacklisted in these categories will remain blacklisted. + "excludedCategories": [ + "5b5f78b786f77447ed5636af", // Money, dont want people buying roubles with roubles + "5b47574386f77428ca22b345", // Special equipment, dont want people buying lightkeeper items + "5b47574386f77428ca22b33c" // Ammo boxes, some ammo boxes are really cheap, some are very expensive. Just buy loose rounds instead. + ], + + // By default, SPT flea prices will use a trader's price for an item if the trader's price is higher. Even custom item configs from this mod won't apply so you might need to disable this if you have some items set really cheap. + "useTraderPriceForOffersIfHigher": true, + + // When an item doesn't have a flea price because it was blacklisted by default, multiply the handbook price by this number to get the new flea price. Default 3. + "handbookPriceMultiplier": 3, + + // Overrides ragfairConfig.runIntervalValues.outOfRaid if config.enableFasterSales is true. Default 3s. + "runIntervalSecondsOverride": 3, + + // When config.enableScarceOffers is true, use these values to limit the number of offers on the flea. + "offerItemCountOverride": { + "max": 4, + "min": 2 + }, + + // When config.enableScarceOffers is true, use these values to limit the quantity of a stackable item (like ammo) per offer on the flea. + "stackablePercentOverride": { + "max": 200, + "min": 20 + }, + + // When config.enableScarceOffers is true, use these values to limit the quantity of a non-stackable item (most items) per offer on the flea. + "nonStackableCountOverride": { + "max": 2, + "min": 1 + }, + + // Adds the specified amount of offers for your current flea market rating if config.addExtraOfferSlot is enabled. + "extraOfferSlotsToAdd": 1 +} \ No newline at end of file diff --git a/config.json b/config.json deleted file mode 100644 index 6bdc6d4..0000000 --- a/config.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "disableBsgBlacklist": true, - "limitMaxPriceOfAttachments": true, - "useBalancedPricingForAllAmmo": false, - "maxFleaPriceOfAttachmentsToHandbookPrice": 5, - "blacklistedItemPriceMultiplier": 1, - "blacklistedAmmoAdditionalPriceMultiplier": 1, - "blacklistedArmourAdditionalPriceMultiplier": 1, - "customItemConfigs": [ - { - "itemIdHint": "Just a human friendly description that isn't used in code to help you remember. This item is the .338 AP round", - "itemId": "5fc382a9d724d907e2077dab", - "priceMultiplier": 1.3 - }, - { - "itemIdHint": "MK-18 .338 rifle", - "itemId": "5fc22d7c187fea44d52eda44", - "fleaPriceOverride": 400000 - }, - { - "itemIdHint": "AXMC .338 rifle. This gun has no flea price by default. We can use the price override to avoid any issues", - "itemId": "627e14b21713922ded6f2c15", - "fleaPriceOverride": 300000 - }, - { - "itemIdHint": "RSASS 7.62 rifle. 300k+ default seems too high for me", - "itemId": "5a367e5dc4a282000e49738f", - "fleaPriceOverride": 150000 - }, - { - "itemIdHint": "M32 40mm MGL", - "itemId": "6275303a9f372d6ea97f9ec7", - "fleaPriceOverride": 200000 - }, - { - "itemIdHint": "Thicc Items Case", - "itemId": "5c0a840b86f7742ffa4f2482", - "fleaPriceOverride": 12000000 - }, - { - "itemIdHint": "Thicc Weapons Case", - "itemId": "5b6d9ce188a4501afc1b2b25", - "fleaPriceOverride": 4000000 - }, - { - "itemIdHint": "Regular Weapon Case", - "itemId": "59fb023c86f7746d0d4b423c", - "fleaPriceOverride": 1500000 - }, - { - "itemIdHint": "M203 40mm UGL", - "itemId": "6357c98711fb55120211f7e1", - "fleaPriceOverride": 200000 - }, - { - "itemIdHint": "GP-25 40mm UGL", - "itemId": "62e7e7bbe6da9612f743f1e0", - "fleaPriceOverride": 150000 - }, - { - "itemIdHint": "Dogtag BEAR", - "itemId": "59f32bb586f774757e1e8442", - "blacklisted": true - }, - { - "itemIdHint": "Dogtag USEC", - "itemId": "59f32c3b86f77472a31742f0", - "blacklisted": true - } - ] -} \ No newline at end of file diff --git a/config.jsonc b/config.jsonc new file mode 100644 index 0000000..eef0a3c --- /dev/null +++ b/config.jsonc @@ -0,0 +1,61 @@ +{ + // Main feature of the mod, set to true to disable blacklist, false to keep it enabled. Other parts of the mod still applies however. Default true. + "disableBsgBlacklist": true, + + // Make cheap offers sell faster. Default true. + "enableFasterSales": true, + + // Reduces the number of offers and quantities per offer to make the flea experience more hardcore. Highly recommend to enable but default is false. + "enableScarceOffers": false, + + // Adds an extra offer for your current flea market rating bracket. So a new account at level 15 can create 3 offers instead of 2. Default is false. Extra amount is configurable in advancedConfigs. + "addExtraOfferSlot": false, + + // Balances the flea price of all ammo types, not just the blacklisted ammo types. Can be useful if you find some ammo prices are unbalanced, this generally makes them very balanced for what they do. Default false. + "useBalancedPricingForAllAmmo": false, + + // Multiplies the price of all blacklisted items that are now available. Default 1. + "blacklistedItemPriceMultiplier": 1, + + // Multiplies the price of all blacklisted ammo in addition to the `blacklistedItemPriceMultiplier` setting. Default 1. + "blacklistedAmmoAdditionalPriceMultiplier": 1, + + // You can manually add flea prices to items, set a multiplier to their existing price or blacklist them entirely. + "customItemConfigs": [ + { + // .338 AP round, the best round in the game so it's quite expensive. This also demonstrates the use of the priceMultiplier property. You can lower this if you think it's too expensive.", + "itemId": "5fc382a9d724d907e2077dab", + "priceMultiplier": 1.2 + }, + { + // .338 FMJ round", + "itemId": "5fc275cf85fd526b824a571a", + "priceMultiplier": 1.3 + }, + { + // 6.8x51mm FMJ, a bit expensive at 5k a round because of the novelty + "itemId": "6529302b8c26af6326029fb7", + "fleaPriceOverride": 2000 + }, + { + // 6.8x51mm Hybrid, it's around 2k using my ammo price balancing but we'll make it a bit more expensive due to it's novelty. + "itemId": "6529243824cbe3c74a05e5c1", + "fleaPriceOverride": 2800 + }, + { + // Regular Weapon Case, I think it's too expensive at the 5 mil mark by default", + "itemId": "59fb023c86f7746d0d4b423c", + "fleaPriceOverride": 1500000 + }, + { + // Dogtag BEAR + "itemId": "59f32bb586f774757e1e8442", + "blacklisted": true + }, + { + // Dogtag USEC + "itemId": "59f32c3b86f77472a31742f0", + "blacklisted": true + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 70ba0c9..172b2e5 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "The Blacklist", - "version": "1.3.1", + "version": "1.3.2", "main": "src/mod.js", "license": "GPLv3", "author": "Platinum", - "akiVersion": "3.7.*", + "akiVersion": "3.8.*", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" @@ -18,6 +18,7 @@ "fs-extra": "11.1.0", "glob": "8.0.3", "tsyringe": "4.7.0", - "typescript": "4.9.4" + "typescript": "4.9.4", + "jsonc": "^2.0.0" } -} \ No newline at end of file +} diff --git a/src/helpers.ts b/src/helpers.ts new file mode 100644 index 0000000..9e29582 --- /dev/null +++ b/src/helpers.ts @@ -0,0 +1,7 @@ +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; + +export function isBulletOrShotgunShell(item: ITemplateItem): boolean { + const props = item._props; + + return props.ammoType === "bullet" || props.ammoType === "buckshot"; +} \ No newline at end of file diff --git a/src/mod.ts b/src/mod.ts index 5468b37..c45c668 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -16,261 +16,233 @@ // along with spt-the-blacklist. If not, see . import { DependencyContainer } from "tsyringe"; +import { jsonc } from "jsonc"; +import path from "path"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod"; +import { IPostDBLoadModAsync } from "@spt-aki/models/external/IPostDBLoadModAsync"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; -import { RagfairOfferGenerator } from "@spt-aki/generators/RagfairOfferGenerator"; -import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; -import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; -import config from "../config.json"; -import advancedConfig from "../advancedConfig.json"; +import { isBulletOrShotgunShell } from "./helpers"; +import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; -class TheBlacklistMod implements IPostDBLoadMod { +class TheBlacklistMod implements IPostDBLoadModAsync { private logger: ILogger; private modName = "[The Blacklist]"; // We to adjust for pricing using a baseline when mods like SPT Realism are used private baselineBullet: ITemplateItem; - private baselineArmour: ITemplateItem; - // Store the category IDs of all attachments in the handbook so we don't have to manually enter them in json - private attachmentCategoryIds: string[] = []; + private blacklistedItemsUpdatedCount = 0; + private nonBlacklistedItemsUpdatedCount = 0; + private ammoPricesUpdatedCount = 0; - public postDBLoad(container: DependencyContainer): void { + private config; + private advancedConfig; + + public async postDBLoadAsync(container: DependencyContainer) { this.logger = container.resolve("WinstonLogger"); - - // Easiest way to make mod compatible with Lua's flea updater is let the user choose when to load the mod... - setTimeout(() => this.initialiseMod(container), (advancedConfig.startDelayInSeconds || 7) * 1000); - } - - private initialiseMod( - container: DependencyContainer - ): void { + this.config = await jsonc.read(path.resolve(__dirname, "../config.jsonc")); + this.advancedConfig = await jsonc.read(path.resolve(__dirname, "../advancedConfig.jsonc")); + const databaseServer = container.resolve("DatabaseServer"); const tables = databaseServer.getTables(); const configServer = container.resolve("ConfigServer"); const ragfairConfig = configServer.getConfig(ConfigTypes.RAGFAIR); - const ragfairPriceService = container.resolve("RagfairPriceService"); - const ragfairOfferGenerator = container.resolve("RagfairOfferGenerator"); const itemTable = tables.templates.items; const handbookItems = tables.templates.handbook.Items; const prices = tables.templates.prices; + const globals = tables.globals; - ragfairConfig.dynamic.blacklist.enableBsgList = !config.disableBsgBlacklist; - ragfairConfig.dynamic.useTraderPriceForOffersIfHigher = advancedConfig.useTraderPriceForOffersIfHigher != null ? advancedConfig.useTraderPriceForOffersIfHigher : true; + this.baselineBullet = itemTable[this.advancedConfig.baselineBulletId]; - this.baselineBullet = itemTable[advancedConfig.baselineBulletId]; - this.baselineArmour = itemTable[advancedConfig.baselineArmourId]; - - let blacklistedItemsUpdatedCount = 0; - let nonBlacklistedItemsUpdatedCount = 0; - let ammoPricesUpdatedCount = 0; - let attachmentPriceLimitedCount = 0; - - if (config.limitMaxPriceOfAttachments) { - this.initialiseAttachmentCategoryIds(tables.templates.handbook.Categories); - } + this.updateRagfairConfig(ragfairConfig); + this.updateGlobals(globals); // Find all items to update by looping through handbook which is a better indicator of useable items. handbookItems.forEach(handbookItem => { const item = itemTable[handbookItem.Id]; - const customItemConfig = config.customItemConfigs.find(conf => conf.itemId === item._id); const originalPrice = prices[item._id]; - // We found a custom price override to use. That's all we care about for this item. Move on to the next item. - if (customItemConfig?.fleaPriceOverride) { - prices[item._id] = customItemConfig.fleaPriceOverride; - this.debug(`Updated ${item._id} - ${item._name} flea price from ${originalPrice} to ${prices[item._id]} (price override).`); - blacklistedItemsUpdatedCount++; - return; - } + const customItemConfig = this.config.customItemConfigs.find(conf => conf.itemId === item._id); - if (customItemConfig?.blacklisted) { - this.debug(`Blacklisted item ${item._id} - ${item._name} due to its customItemConfig.`); - ragfairConfig.dynamic.blacklist.custom.push(item._id); + // We found a custom item config override to use. That's all we care about for this item. Move on to the next item. + if (customItemConfig && this.updateItemUsingCustomItemConfig(customItemConfig, item, prices, originalPrice, ragfairConfig)) { return; } - if (config.limitMaxPriceOfAttachments && this.attachmentCategoryIds.includes(handbookItem.ParentId)) { - const handbookPrice = handbookItem.Price; - const existingFleaPrice = prices[item._id]; - const maxFleaPrice = handbookPrice * config.maxFleaPriceOfAttachmentsToHandbookPrice; - - if (existingFleaPrice > maxFleaPrice) { - prices[item._id] = maxFleaPrice; - attachmentPriceLimitedCount++; - this.debug(`Attachment ${item._id} - ${item._name} was updated from ${existingFleaPrice} to ${maxFleaPrice}.`) - } - } - const itemProps = item._props; - if (config.useBalancedPricingForAllAmmo && this.isBulletOrShotgunShell(item)) { - const newPrice = this.getUpdatedAmmoPrice(item); - prices[item._id] = newPrice; - - if (!itemProps.CanSellOnRagfair) { - blacklistedItemsUpdatedCount++; - // Set to true so we avoid recalculating ammo price again for blacklisted ammo below. - itemProps.CanSellOnRagfair = true; - } else { - nonBlacklistedItemsUpdatedCount++; - } - ammoPricesUpdatedCount++; + if (isBulletOrShotgunShell(item)) { + this.updateAmmoPrice(item, prices); } if (!itemProps.CanSellOnRagfair) { // Some blacklisted items are hard to balance or just shouldn't be allowed so we will keep them blacklisted. - if (advancedConfig.excludedCategories.some(category => category === handbookItem.ParentId)) { + if (this.advancedConfig.excludedCategories.some(category => category === handbookItem.ParentId)) { ragfairConfig.dynamic.blacklist.custom.push(item._id); - this.debug(`Blacklisted item ${item._id} - ${item._name} because we are excluding handbook category ${handbookItem.ParentId}.`); + this.debug(`Ignored item ${item._id} - ${item._name} because we are excluding handbook category ${handbookItem.ParentId}.`); return; } - itemProps.CanSellOnRagfair = config.disableBsgBlacklist; - - prices[item._id] = this.getUpdatedPrice(item, prices); + prices[item._id] = this.getUpdatedPrice(handbookItem, item, prices); if (!prices[item._id]) { this.debug(`There are no flea prices for ${item._id} - ${item._name}!`); return; } + if (!isNaN(customItemConfig?.priceMultiplier)) { + prices[item._id] *= customItemConfig.priceMultiplier; + } + this.debug(`Updated ${item._id} - ${item._name} flea price from ${originalPrice} to ${prices[item._id]}.`); - blacklistedItemsUpdatedCount++; - } - - const itemSpecificPriceMultiplier = customItemConfig?.priceMultiplier || 1; - prices[item._id] *= itemSpecificPriceMultiplier; - }); - - // Typescript hack to call protected method - (ragfairPriceService as any).generateDynamicPrices(); - ragfairOfferGenerator.generateDynamicOffers().then(() => { - this.logger.success(`${this.modName}: Success! Found ${blacklistedItemsUpdatedCount} blacklisted & ${nonBlacklistedItemsUpdatedCount} non-blacklisted items to update.`); - if (config.limitMaxPriceOfAttachments) { - this.logger.success(`${this.modName}: config.limitMaxPriceOfAttachments is enabled! Updated ${attachmentPriceLimitedCount} flea prices of attachments.`); - } - if (config.useBalancedPricingForAllAmmo) { - this.logger.success(`${this.modName}: config.useBalancedPricingForAllAmmo is enabled! Updated ${ammoPricesUpdatedCount} ammo prices.`); + this.blacklistedItemsUpdatedCount++; } }); + + this.logger.success(`${this.modName}: Success! Found ${this.blacklistedItemsUpdatedCount} blacklisted & ${this.nonBlacklistedItemsUpdatedCount} non-blacklisted items to update.`); + + if (this.config.useBalancedPricingForAllAmmo) { + this.logger.success(`${this.modName}: config.useBalancedPricingForAllAmmo is enabled! Updated ${this.ammoPricesUpdatedCount} ammo prices.`); + } } - private initialiseAttachmentCategoryIds(handbookCategories: Category[]) { - const weaponPartsAndModsId = "5b5f71a686f77447ed5636ab"; - const weaponPartsChildrenCategories = this.getChildCategoriesRecursively(handbookCategories, weaponPartsAndModsId); - const childrenIds = weaponPartsChildrenCategories.map(category => category.Id); + private updateRagfairConfig(ragfairConfig: IRagfairConfig) { + ragfairConfig.dynamic.blacklist.enableBsgList = !this.config.disableBsgBlacklist; - this.attachmentCategoryIds.push(weaponPartsAndModsId); - this.attachmentCategoryIds = this.attachmentCategoryIds.concat(childrenIds); - } - - private getChildCategoriesRecursively(handbookCategories: Category[], parentId: string): Category[] { - const childCategories = handbookCategories.filter(category => category.ParentId === parentId); - const grandChildrenCategories = childCategories.reduce( - (memo, category) => memo.concat(this.getChildCategoriesRecursively(handbookCategories, category.Id)), - [] - ); - - return childCategories.concat(grandChildrenCategories); - } - - private getUpdatedPrice(item: ITemplateItem, prices: Record): number | undefined { - // Note that this price can be affected by other mods like Lua's market updater. - const currentFleaPrice = prices[item._id]; - let newPrice: number; - - if (this.isBulletOrShotgunShell(item)) { - newPrice = this.getUpdatedAmmoPrice(item); - } else if (this.isArmour(item)) { - newPrice = this.getUpdatedArmourPrice(item); - } else if (this.isGun(item) && currentFleaPrice == null) { - newPrice = this.getFallbackGunPrice(); + if (this.advancedConfig.useTraderPriceForOffersIfHigher != null) { + ragfairConfig.dynamic.useTraderPriceForOffersIfHigher = !!this.advancedConfig.useTraderPriceForOffersIfHigher; } - // Avoids NaN. Also we shouldn't have any prices of 0. - const price = newPrice || currentFleaPrice; - return price && price * config.blacklistedItemPriceMultiplier; + if (this.config.enableFasterSales && !isNaN(this.advancedConfig.runIntervalSecondsOverride)) { + ragfairConfig.runIntervalValues.outOfRaid = this.advancedConfig.runIntervalSecondsOverride; + } + + if (this.config.enableScarceOffers) { + this.updateRagfairConfigToHaveScarceOffers(ragfairConfig); + } } - private isBulletOrShotgunShell(item: ITemplateItem): boolean { - const props = item._props; - return props.ammoType === "bullet" || props.ammoType === "buckshot"; + private updateRagfairConfigToHaveScarceOffers(ragfairConfig: IRagfairConfig) { + const minMaxPropertiesToOverride = ["offerItemCount", "stackablePercent", "nonStackableCount"]; + + for (const propertyToOverride of minMaxPropertiesToOverride) { + ragfairConfig.dynamic[propertyToOverride].max = this.advancedConfig[`${propertyToOverride}Override`].max; + ragfairConfig.dynamic[propertyToOverride].min = this.advancedConfig[`${propertyToOverride}Override`].min; + } + + ragfairConfig.dynamic.barter.chancePercent = 0; + ragfairConfig.dynamic.pack.chancePercent = 0; } - private isArmour(item: ITemplateItem): boolean { - return Number(item._props.armorClass) > 0 && item._props.armorZone?.some(zone => zone === "Chest") + private updateGlobals(globals: IGlobals) { + const ragfairConfig = globals.config.RagFair; + + if (this.config.addExtraOfferSlot) { + for (const settingForBracket of ragfairConfig.maxActiveOfferCount) { + settingForBracket.count += this.advancedConfig.extraOfferSlotsToAdd; + } + } } - // Some blacklisted guns are very cheap because they don't have a flea price, just a handbook price. The ones listed below will get a much higher default price. - private isGun(item: ITemplateItem): boolean { - const marksmanRiflesItemCategoryId = "5447b6194bdc2d67278b4567"; - const assaultRiflesItemCategoryId = "5447b5f14bdc2d61278b4567"; - const sniperRiflesItemCategoryId = "5447b6254bdc2dc3278b4568"; - const smgsItemCategoryId = "5447b5e04bdc2d62278b4567"; - const carbinesItemCategoryId = "5447b5fc4bdc2d87278b4567"; - const gunCategories = [marksmanRiflesItemCategoryId, assaultRiflesItemCategoryId, sniperRiflesItemCategoryId, smgsItemCategoryId, carbinesItemCategoryId]; + // Returns true if we updated something using the customItemConfig so we can skip to the next handbook item. + private updateItemUsingCustomItemConfig(customItemConfig, item: ITemplateItem , prices: Record, originalPrice: number, ragfairConfig: IRagfairConfig): boolean { + if (customItemConfig?.blacklisted) { + this.debug(`Blacklisted item ${item._id} - ${item._name} due to its customItemConfig.`); - return gunCategories.includes(item._parent); + ragfairConfig.dynamic.blacklist.custom.push(item._id); + + if (item._props.CanSellOnRagfair) { + this.nonBlacklistedItemsUpdatedCount++ + } + + return true; + } + + if (customItemConfig?.fleaPriceOverride) { + prices[item._id] = customItemConfig.fleaPriceOverride; + + this.debug(`Updated ${item._id} - ${item._name} flea price from ${originalPrice} to ${prices[item._id]} (price override).`); + + if (item._props.CanSellOnRagfair) { + this.nonBlacklistedItemsUpdatedCount++ + } + + return true; + } + + return false; } - private getUpdatedAmmoPrice(item: ITemplateItem) { + private updateAmmoPrice(item: ITemplateItem, prices: Record) { + const itemProps = item._props; + + // We don't care about this standard ammo item if we haven't enabled useBalancedPricingForAllAmmo + if (itemProps.CanSellOnRagfair && !this.config.useBalancedPricingForAllAmmo) { + return; + } + + const newPrice = this.getUpdatedAmmoPrice(item); + prices[item._id] = newPrice; + + if (!itemProps.CanSellOnRagfair) { + this.blacklistedItemsUpdatedCount++; + } else { + this.nonBlacklistedItemsUpdatedCount++; + } + + this.ammoPricesUpdatedCount++; + } + + private getUpdatedAmmoPrice(item: ITemplateItem): number { const baselinePen = this.baselineBullet._props.PenetrationPower; const baselineDamage = this.baselineBullet._props.Damage; - + const basePenetrationMultiplier = item._props.PenetrationPower / baselinePen; const baseDamageMultiplier = item._props.Damage / baselineDamage; - + let penetrationMultiplier: number; - if (basePenetrationMultiplier > 1) { + + // We are checking for > 0.99 because we want the baseline bullet (mult of 1) to be close to its baseline price. + if (basePenetrationMultiplier > 0.99) { // A good gradient to make higher power rounds more expensive - penetrationMultiplier = 7 * basePenetrationMultiplier - 6; + penetrationMultiplier = 3 * basePenetrationMultiplier - 2; } else { - // Due to maths above, its really easy to go < 1. The baseline ammo is mid tier with a reasonable 1000 rouble each. Ammo weaker than this tend to be pretty crap so we'll make it much cheaper + // The baseline ammo is mid tier with a reasonable 1000 rouble each. Ammo weaker than this tend to be pretty crap so we'll make it much cheaper const newMultiplier = basePenetrationMultiplier * 0.7; penetrationMultiplier = newMultiplier < 0.1 ? 0.1 : newMultiplier; } - + // Reduces the effect of the damage multiplier so high DMG rounds aren't super expensive. // Eg. let baseDamageMultiplier = 2 & bulletDamageMultiplierRedutionFactor = 0.7. Instead of a 2x price when a bullet is 2x damage, we instead get: // 2 + (1 - 2) * 0.7 = 2 - 0.7 = 1.3x the price. - const damageMultiplier = baseDamageMultiplier + (1 - baseDamageMultiplier) * advancedConfig.bulletDamageMultiplierRedutionFactor; - - return advancedConfig.baselineBulletPrice * penetrationMultiplier * damageMultiplier * config.blacklistedAmmoAdditionalPriceMultiplier; + const damageMultiplier = baseDamageMultiplier + (1 - baseDamageMultiplier) * this.advancedConfig.bulletDamageMultiplierRedutionFactor; + + return this.advancedConfig.baselineBulletPrice * penetrationMultiplier * damageMultiplier * this.config.blacklistedAmmoAdditionalPriceMultiplier; } - // Some default armour prices are too high like the Zabralo so I want a more balanced way to calculate the price. - private getUpdatedArmourPrice(item: ITemplateItem) { - const baselineArmourClass = Number(this.baselineArmour._props.armorClass); + private getUpdatedPrice(handbookItem: HandbookItem, item: ITemplateItem, prices: Record): number | undefined { + // If a flea price doesn't exist for an item, we can multiply its handbook price which usually exists. + if (prices[item._id] == null) { + const handbookPrice = handbookItem.Price; - // Instead of doing a simple multiplier by dividing the two armour classes, this will give us a much bigger price range for different tiered armours. - const armourClassCost = (Number(item._props.armorClass) - baselineArmourClass) * advancedConfig.pricePerArmourClassStep; - const baseArmourWeightMultiplier = advancedConfig.baselineArmourWeight / item._props.Weight; + return handbookPrice * this.advancedConfig.handbookPriceMultiplier; + } - // Reduces the effect of the weight multiplier so some lighter armour aren't super expensive. - // Eg. let baseArmourWeightMultiplier = 2 & armourWeightMultiplierReductionFactor = 0.7. Instead of a 2x price when an armour is half as light as the baseline, we instead get: - // 2 + (1 - 2) * 0.7 = 2 - 0.7 = 1.3x the price. - const armourWeightMultiplier = baseArmourWeightMultiplier + (1 - baseArmourWeightMultiplier) * advancedConfig.armourWeightMultiplierReductionFactor; - - return (advancedConfig.baselineArmourPrice + armourClassCost) * armourWeightMultiplier * config.blacklistedArmourAdditionalPriceMultiplier; - } - - private getFallbackGunPrice() { - return advancedConfig.gunPriceFallback || 100000; + return prices[item._id] * this.config.blacklistedItemPriceMultiplier; } private debug(message: string) { - if (advancedConfig.enableDebug) { + if (this.advancedConfig.enableDebug) { this.logger.debug(`${this.modName}: ${message}`); } } diff --git a/types/ErrorHandler.d.ts b/types/ErrorHandler.d.ts index 69b0bcd..33c0de6 100644 --- a/types/ErrorHandler.d.ts +++ b/types/ErrorHandler.d.ts @@ -2,5 +2,5 @@ export declare class ErrorHandler { private logger; private readLine; constructor(); - handleCriticalError(err: any): void; + handleCriticalError(err: Error): void; } diff --git a/types/Program.d.ts b/types/Program.d.ts index afe5216..f2b65df 100644 --- a/types/Program.d.ts +++ b/types/Program.d.ts @@ -1,5 +1,5 @@ export declare class Program { private errorHandler; constructor(); - start(): void; + start(): Promise; } diff --git a/types/callbacks/AchievementCallbacks.d.ts b/types/callbacks/AchievementCallbacks.d.ts new file mode 100644 index 0000000..61d3cf2 --- /dev/null +++ b/types/callbacks/AchievementCallbacks.d.ts @@ -0,0 +1,21 @@ +import { AchievementController } from "@spt-aki/controllers/AchievementController"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class AchievementCallbacks { + protected achievementController: AchievementController; + protected profileController: ProfileController; + protected httpResponse: HttpResponseUtil; + constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil); + /** + * Handle client/achievement/list + */ + getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/achievement/statistic + */ + statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; +} diff --git a/types/callbacks/BotCallbacks.d.ts b/types/callbacks/BotCallbacks.d.ts index 036e545..d406147 100644 --- a/types/callbacks/BotCallbacks.d.ts +++ b/types/callbacks/BotCallbacks.d.ts @@ -1,9 +1,9 @@ -import { BotController } from "../controllers/BotController"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IBotBase } from "../models/eft/common/tables/IBotBase"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { BotController } from "@spt-aki/controllers/BotController"; +import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; diff --git a/types/callbacks/BuildsCallbacks.d.ts b/types/callbacks/BuildsCallbacks.d.ts new file mode 100644 index 0000000..eb8843c --- /dev/null +++ b/types/callbacks/BuildsCallbacks.d.ts @@ -0,0 +1,34 @@ +import { BuildController } from "@spt-aki/controllers/BuildController"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class BuildsCallbacks { + protected httpResponse: HttpResponseUtil; + protected buildController: BuildController; + constructor(httpResponse: HttpResponseUtil, buildController: BuildController); + /** + * Handle client/builds/list + */ + getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData; + /** + * Handle client/builds/weapon/save + */ + setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/equipment/save + */ + setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData; + /** + * Handle client/builds/delete + */ + deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData; +} diff --git a/types/callbacks/BundleCallbacks.d.ts b/types/callbacks/BundleCallbacks.d.ts index 729b6cf..f6a664d 100644 --- a/types/callbacks/BundleCallbacks.d.ts +++ b/types/callbacks/BundleCallbacks.d.ts @@ -1,18 +1,13 @@ -import { BundleLoader } from "../loaders/BundleLoader"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { HttpFileUtil } from "../utils/HttpFileUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class BundleCallbacks { - protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); - sendBundle(sessionID: string, req: any, resp: any, body: any): any; + constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer); /** * Handle singleplayer/bundles */ diff --git a/types/callbacks/ClientLogCallbacks.d.ts b/types/callbacks/ClientLogCallbacks.d.ts new file mode 100644 index 0000000..1fb7acc --- /dev/null +++ b/types/callbacks/ClientLogCallbacks.d.ts @@ -0,0 +1,28 @@ +import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +/** Handle client logging related events */ +export declare class ClientLogCallbacks { + protected httpResponse: HttpResponseUtil; + protected clientLogController: ClientLogController; + protected configServer: ConfigServer; + protected localisationService: LocalisationService; + protected modLoadOrder: ModLoadOrder; + constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder); + /** + * Handle /singleplayer/log + */ + clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData; + /** + * Handle /singleplayer/release + */ + releaseNotes(): string; + /** + * Handle /singleplayer/enableBSGlogging + */ + bsgLogging(): string; +} diff --git a/types/callbacks/CustomizationCallbacks.d.ts b/types/callbacks/CustomizationCallbacks.d.ts index bb10f64..9ea8faa 100644 --- a/types/callbacks/CustomizationCallbacks.d.ts +++ b/types/callbacks/CustomizationCallbacks.d.ts @@ -1,14 +1,14 @@ -import { CustomizationController } from "../controllers/CustomizationController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ISuit } from "../models/eft/common/tables/ITrader"; -import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; -import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; -import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { CustomizationController } from "@spt-aki/controllers/CustomizationController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ISuit } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IBuyClothingRequestData } from "@spt-aki/models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "@spt-aki/models/eft/customization/IGetSuitsResponse"; +import { IWearClothingRequestData } from "@spt-aki/models/eft/customization/IWearClothingRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class CustomizationCallbacks { protected customizationController: CustomizationController; protected saveServer: SaveServer; diff --git a/types/callbacks/DataCallbacks.d.ts b/types/callbacks/DataCallbacks.d.ts index fb92560..fbac60b 100644 --- a/types/callbacks/DataCallbacks.d.ts +++ b/types/callbacks/DataCallbacks.d.ts @@ -1,18 +1,18 @@ -import { HideoutController } from "../controllers/HideoutController"; -import { RagfairController } from "../controllers/RagfairController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IGlobals } from "../models/eft/common/IGlobals"; -import { ICustomizationItem } from "../models/eft/common/tables/ICustomizationItem"; -import { IHandbookBase } from "../models/eft/common/tables/IHandbookBase"; -import { IGetItemPricesResponse } from "../models/eft/game/IGetItemPricesResponse"; -import { IHideoutArea } from "../models/eft/hideout/IHideoutArea"; -import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; -import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; -import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ISettingsBase } from "../models/spt/server/ISettingsBase"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { HideoutController } from "@spt-aki/controllers/HideoutController"; +import { RagfairController } from "@spt-aki/controllers/RagfairController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { ICustomizationItem } from "@spt-aki/models/eft/common/tables/ICustomizationItem"; +import { IHandbookBase } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { IGetItemPricesResponse } from "@spt-aki/models/eft/game/IGetItemPricesResponse"; +import { IHideoutArea } from "@spt-aki/models/eft/hideout/IHideoutArea"; +import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; +import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; +import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ISettingsBase } from "@spt-aki/models/spt/server/ISettingsBase"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** * Handle client requests */ diff --git a/types/callbacks/DialogueCallbacks.d.ts b/types/callbacks/DialogueCallbacks.d.ts index 23cb707..7ed60b9 100644 --- a/types/callbacks/DialogueCallbacks.d.ts +++ b/types/callbacks/DialogueCallbacks.d.ts @@ -1,31 +1,31 @@ -import { DialogueController } from "../controllers/DialogueController"; -import { OnUpdate } from "../di/OnUpdate"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData, ICancelFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData"; -import { IChatServer } from "../models/eft/dialog/IChatServer"; -import { IClearMailMessageRequest } from "../models/eft/dialog/IClearMailMessageRequest"; -import { IDeleteFriendRequest } from "../models/eft/dialog/IDeleteFriendRequest"; -import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; -import { IFriendRequestSendResponse } from "../models/eft/dialog/IFriendRequestSendResponse"; -import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; -import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; -import { IGetChatServerListRequestData } from "../models/eft/dialog/IGetChatServerListRequestData"; -import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; -import { IGetMailDialogInfoRequestData } from "../models/eft/dialog/IGetMailDialogInfoRequestData"; -import { IGetMailDialogListRequestData } from "../models/eft/dialog/IGetMailDialogListRequestData"; -import { IGetMailDialogViewRequestData } from "../models/eft/dialog/IGetMailDialogViewRequestData"; -import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IPinDialogRequestData } from "../models/eft/dialog/IPinDialogRequestData"; -import { IRemoveDialogRequestData } from "../models/eft/dialog/IRemoveDialogRequestData"; -import { IRemoveMailMessageRequest } from "../models/eft/dialog/IRemoveMailMessageRequest"; -import { ISendMessageRequest } from "../models/eft/dialog/ISendMessageRequest"; -import { ISetDialogReadRequestData } from "../models/eft/dialog/ISetDialogReadRequestData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { DialogueInfo } from "../models/eft/profile/IAkiProfile"; -import { HashUtil } from "../utils/HashUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { DialogueController } from "@spt-aki/controllers/DialogueController"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; +import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; +import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; +import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest"; +import { IFriendRequestData } from "@spt-aki/models/eft/dialog/IFriendRequestData"; +import { IFriendRequestSendResponse } from "@spt-aki/models/eft/dialog/IFriendRequestSendResponse"; +import { IGetAllAttachmentsRequestData } from "@spt-aki/models/eft/dialog/IGetAllAttachmentsRequestData"; +import { IGetAllAttachmentsResponse } from "@spt-aki/models/eft/dialog/IGetAllAttachmentsResponse"; +import { IGetChatServerListRequestData } from "@spt-aki/models/eft/dialog/IGetChatServerListRequestData"; +import { IGetFriendListDataResponse } from "@spt-aki/models/eft/dialog/IGetFriendListDataResponse"; +import { IGetMailDialogInfoRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogInfoRequestData"; +import { IGetMailDialogListRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogListRequestData"; +import { IGetMailDialogViewRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewRequestData"; +import { IGetMailDialogViewResponseData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewResponseData"; +import { IPinDialogRequestData } from "@spt-aki/models/eft/dialog/IPinDialogRequestData"; +import { IRemoveDialogRequestData } from "@spt-aki/models/eft/dialog/IRemoveDialogRequestData"; +import { IRemoveMailMessageRequest } from "@spt-aki/models/eft/dialog/IRemoveMailMessageRequest"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { ISetDialogReadRequestData } from "@spt-aki/models/eft/dialog/ISetDialogReadRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class DialogueCallbacks implements OnUpdate { protected hashUtil: HashUtil; protected timeUtil: TimeUtil; @@ -86,11 +86,11 @@ export declare class DialogueCallbacks implements OnUpdate { /** Handle client/friend/ignore/set */ ignoreFriend(url: string, request: { uid: string; - }, sessionID: string): any; + }, sessionID: string): INullResponseData; /** Handle client/friend/ignore/remove */ unIgnoreFriend(url: string, request: { uid: string; - }, sessionID: string): any; + }, sessionID: string): INullResponseData; clearMail(url: string, request: IClearMailMessageRequest, sessionID: string): IGetBodyResponseData; removeMail(url: string, request: IRemoveMailMessageRequest, sessionID: string): IGetBodyResponseData; onUpdate(timeSinceLastRun: number): Promise; diff --git a/types/callbacks/GameCallbacks.d.ts b/types/callbacks/GameCallbacks.d.ts index 46f79f9..51c7595 100644 --- a/types/callbacks/GameCallbacks.d.ts +++ b/types/callbacks/GameCallbacks.d.ts @@ -1,22 +1,24 @@ -import { GameController } from "../controllers/GameController"; -import { OnLoad } from "../di/OnLoad"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; -import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; -import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; -import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; -import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; -import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; -import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; -import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; -import { IServerDetails } from "../models/eft/game/IServerDetails"; -import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks implements OnLoad { +import { GameController } from "@spt-aki/controllers/GameController"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { ICheckVersionResponse } from "@spt-aki/models/eft/game/ICheckVersionResponse"; +import { ICurrentGroupResponse } from "@spt-aki/models/eft/game/ICurrentGroupResponse"; +import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigResponse"; +import { IGameEmptyCrcRequestData } from "@spt-aki/models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "@spt-aki/models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "@spt-aki/models/eft/game/IGameStartResponse"; +import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest"; +import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; +import { IReportNicknameRequestData } from "@spt-aki/models/eft/game/IReportNicknameRequestData"; +import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; +import { IVersionValidateRequestData } from "@spt-aki/models/eft/game/IVersionValidateRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { Watermark } from "@spt-aki/utils/Watermark"; +export declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; @@ -68,5 +70,9 @@ declare class GameCallbacks implements OnLoad { */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/getRaidTime + * @returns string + */ + getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse; } -export { GameCallbacks }; diff --git a/types/callbacks/HandbookCallbacks.d.ts b/types/callbacks/HandbookCallbacks.d.ts index 6bd3909..0a099e9 100644 --- a/types/callbacks/HandbookCallbacks.d.ts +++ b/types/callbacks/HandbookCallbacks.d.ts @@ -1,5 +1,5 @@ -import { HandbookController } from "../controllers/HandbookController"; -import { OnLoad } from "../di/OnLoad"; +import { HandbookController } from "@spt-aki/controllers/HandbookController"; +import { OnLoad } from "@spt-aki/di/OnLoad"; export declare class HandbookCallbacks implements OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); diff --git a/types/callbacks/HealthCallbacks.d.ts b/types/callbacks/HealthCallbacks.d.ts index bd3e507..24b633b 100644 --- a/types/callbacks/HealthCallbacks.d.ts +++ b/types/callbacks/HealthCallbacks.d.ts @@ -1,14 +1,14 @@ -import { HealthController } from "../controllers/HealthController"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; -import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; -import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; -import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IWorkoutData } from "../models/eft/health/IWorkoutData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { HealthController } from "@spt-aki/controllers/HealthController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHealthTreatmentRequestData } from "@spt-aki/models/eft/health/IHealthTreatmentRequestData"; +import { IOffraidEatRequestData } from "@spt-aki/models/eft/health/IOffraidEatRequestData"; +import { IOffraidHealRequestData } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { ISyncHealthRequestData } from "@spt-aki/models/eft/health/ISyncHealthRequestData"; +import { IWorkoutData } from "@spt-aki/models/eft/health/IWorkoutData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class HealthCallbacks { protected httpResponse: HttpResponseUtil; protected profileHelper: ProfileHelper; diff --git a/types/callbacks/HideoutCallbacks.d.ts b/types/callbacks/HideoutCallbacks.d.ts index efd0444..c1fa7a5 100644 --- a/types/callbacks/HideoutCallbacks.d.ts +++ b/types/callbacks/HideoutCallbacks.d.ts @@ -1,21 +1,22 @@ -import { HideoutController } from "../controllers/HideoutController"; -import { OnUpdate } from "../di/OnUpdate"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IHandleQTEEventRequestData } from "../models/eft/hideout/IHandleQTEEventRequestData"; -import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hideout/IHideoutContinuousProductionStartRequestData"; -import { IHideoutImproveAreaRequestData } from "../models/eft/hideout/IHideoutImproveAreaRequestData"; -import { IHideoutPutItemInRequestData } from "../models/eft/hideout/IHideoutPutItemInRequestData"; -import { IHideoutScavCaseStartRequestData } from "../models/eft/hideout/IHideoutScavCaseStartRequestData"; -import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; -import { IHideoutTakeItemOutRequestData } from "../models/eft/hideout/IHideoutTakeItemOutRequestData"; -import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IHideoutToggleAreaRequestData } from "../models/eft/hideout/IHideoutToggleAreaRequestData"; -import { IHideoutUpgradeCompleteRequestData } from "../models/eft/hideout/IHideoutUpgradeCompleteRequestData"; -import { IHideoutUpgradeRequestData } from "../models/eft/hideout/IHideoutUpgradeRequestData"; -import { IRecordShootingRangePoints } from "../models/eft/hideout/IRecordShootingRangePoints"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; -import { ConfigServer } from "../servers/ConfigServer"; +import { HideoutController } from "@spt-aki/controllers/HideoutController"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; +import { IHideoutCancelProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutCancelProductionRequestData"; +import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; +import { IHideoutImproveAreaRequestData } from "@spt-aki/models/eft/hideout/IHideoutImproveAreaRequestData"; +import { IHideoutPutItemInRequestData } from "@spt-aki/models/eft/hideout/IHideoutPutItemInRequestData"; +import { IHideoutScavCaseStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutScavCaseStartRequestData"; +import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; +import { IHideoutTakeItemOutRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeItemOutRequestData"; +import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IHideoutToggleAreaRequestData } from "@spt-aki/models/eft/hideout/IHideoutToggleAreaRequestData"; +import { IHideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/IHideoutUpgradeCompleteRequestData"; +import { IHideoutUpgradeRequestData } from "@spt-aki/models/eft/hideout/IHideoutUpgradeRequestData"; +import { IRecordShootingRangePoints } from "@spt-aki/models/eft/hideout/IRecordShootingRangePoints"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class HideoutCallbacks implements OnUpdate { protected hideoutController: HideoutController; protected configServer: ConfigServer; @@ -25,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutUpgrade event */ - upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutUpgradeComplete event */ - upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle HideoutPutItemsInAreaSlots */ @@ -61,15 +62,19 @@ export declare class HideoutCallbacks implements OnUpdate { /** * Handle HideoutQuickTimeEvent */ - handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse; + handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ - recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse; + recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Handle client/game/profile/items/moving - RecordShootingRangePoints */ improveArea(pmcData: IPmcData, request: IHideoutImproveAreaRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Handle client/game/profile/items/moving - HideoutCancelProductionCommand + */ + cancelProduction(pmcData: IPmcData, request: IHideoutCancelProductionRequestData, sessionId: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/types/callbacks/HttpCallbacks.d.ts b/types/callbacks/HttpCallbacks.d.ts index 10794fa..060301a 100644 --- a/types/callbacks/HttpCallbacks.d.ts +++ b/types/callbacks/HttpCallbacks.d.ts @@ -1,5 +1,5 @@ -import { OnLoad } from "../di/OnLoad"; -import { HttpServer } from "../servers/HttpServer"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { HttpServer } from "@spt-aki/servers/HttpServer"; export declare class HttpCallbacks implements OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); diff --git a/types/callbacks/InraidCallbacks.d.ts b/types/callbacks/InraidCallbacks.d.ts index d341956..29e2c96 100644 --- a/types/callbacks/InraidCallbacks.d.ts +++ b/types/callbacks/InraidCallbacks.d.ts @@ -1,8 +1,10 @@ -import { InraidController } from "../controllers/InraidController"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; -import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { InraidController } from "@spt-aki/controllers/InraidController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData"; +import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; +import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; /** * Handle client requests */ @@ -47,4 +49,19 @@ export declare class InraidCallbacks { * @returns JSON as string */ getAirdropConfig(): string; + /** + * Handle singleplayer/btr/config + * @returns JSON as string + */ + getBTRConfig(): string; + /** + * Handle singleplayer/traderServices/getTraderServices + */ + getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData; + getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string; + getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string; } diff --git a/types/callbacks/InsuranceCallbacks.d.ts b/types/callbacks/InsuranceCallbacks.d.ts index 450a2fa..1c57629 100644 --- a/types/callbacks/InsuranceCallbacks.d.ts +++ b/types/callbacks/InsuranceCallbacks.d.ts @@ -1,15 +1,15 @@ -import { InsuranceController } from "../controllers/InsuranceController"; -import { OnUpdate } from "../di/OnUpdate"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; -import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; -import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { InsuranceService } from "../services/InsuranceService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { InsuranceController } from "@spt-aki/controllers/InsuranceController"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostRequestData"; +import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; +import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class InsuranceCallbacks implements OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; diff --git a/types/callbacks/InventoryCallbacks.d.ts b/types/callbacks/InventoryCallbacks.d.ts index 5d4b51d..5aa0cb2 100644 --- a/types/callbacks/InventoryCallbacks.d.ts +++ b/types/callbacks/InventoryCallbacks.d.ts @@ -1,48 +1,61 @@ -import { InventoryController } from "../controllers/InventoryController"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; -import { IInventoryCreateMarkerRequestData } from "../models/eft/inventory/IInventoryCreateMarkerRequestData"; -import { IInventoryDeleteMarkerRequestData } from "../models/eft/inventory/IInventoryDeleteMarkerRequestData"; -import { IInventoryEditMarkerRequestData } from "../models/eft/inventory/IInventoryEditMarkerRequestData"; -import { IInventoryExamineRequestData } from "../models/eft/inventory/IInventoryExamineRequestData"; -import { IInventoryFoldRequestData } from "../models/eft/inventory/IInventoryFoldRequestData"; -import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMergeRequestData"; -import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; -import { IInventoryReadEncyclopediaRequestData } from "../models/eft/inventory/IInventoryReadEncyclopediaRequestData"; -import { IInventoryRemoveRequestData } from "../models/eft/inventory/IInventoryRemoveRequestData"; -import { IInventorySortRequestData } from "../models/eft/inventory/IInventorySortRequestData"; -import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; -import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwapRequestData"; -import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; -import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; -import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; -import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { InventoryController } from "@spt-aki/controllers/InventoryController"; +import { QuestController } from "@spt-aki/controllers/QuestController"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; +import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; +import { IInventoryDeleteMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryDeleteMarkerRequestData"; +import { IInventoryEditMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryEditMarkerRequestData"; +import { IInventoryExamineRequestData } from "@spt-aki/models/eft/inventory/IInventoryExamineRequestData"; +import { IInventoryFoldRequestData } from "@spt-aki/models/eft/inventory/IInventoryFoldRequestData"; +import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; +import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; +import { IInventoryReadEncyclopediaRequestData } from "@spt-aki/models/eft/inventory/IInventoryReadEncyclopediaRequestData"; +import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; +import { IInventorySortRequestData } from "@spt-aki/models/eft/inventory/IInventorySortRequestData"; +import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventorySwapRequestData } from "@spt-aki/models/eft/inventory/IInventorySwapRequestData"; +import { IInventoryTagRequestData } from "@spt-aki/models/eft/inventory/IInventoryTagRequestData"; +import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInventoryToggleRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; +import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; - constructor(inventoryController: InventoryController); - /** Handle Move event */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + protected questController: QuestController; + constructor(inventoryController: InventoryController, questController: QuestController); + /** Handle client/game/profile/items/moving Move event */ + moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Remove event */ - removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Split event */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; - bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** Handle ApplyInventoryChanges */ - sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; - createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; - deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; - editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** Handle OpenRandomLootContainer */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * TODO - MOVE INTO QUEST CODE + * Handle game/profile/items/moving - QuestFail + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/types/callbacks/ItemEventCallbacks.d.ts b/types/callbacks/ItemEventCallbacks.d.ts index fbb0b5f..b54d0f6 100644 --- a/types/callbacks/ItemEventCallbacks.d.ts +++ b/types/callbacks/ItemEventCallbacks.d.ts @@ -1,13 +1,19 @@ -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +import { IItemEventRouterRequest } from "@spt-aki/models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { ItemEventRouter } from "@spt-aki/routers/ItemEventRouter"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class ItemEventCallbacks { protected httpResponse: HttpResponseUtil; protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + /** + * Return true if the passed in list of warnings contains critical issues + * @param warnings The list of warnings to check for critical errors + * @returns + */ + private isCriticalError; protected getErrorCode(warnings: Warning[]): number; } diff --git a/types/callbacks/LauncherCallbacks.d.ts b/types/callbacks/LauncherCallbacks.d.ts index 20d99de..b452291 100644 --- a/types/callbacks/LauncherCallbacks.d.ts +++ b/types/callbacks/LauncherCallbacks.d.ts @@ -1,13 +1,13 @@ -import { LauncherController } from "../controllers/LauncherController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; -import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; -import { IRegisterData } from "../models/eft/launcher/IRegisterData"; -import { IRemoveProfileData } from "../models/eft/launcher/IRemoveProfileData"; -import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { Watermark } from "../utils/Watermark"; -declare class LauncherCallbacks { +import { LauncherController } from "@spt-aki/controllers/LauncherController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IChangeRequestData } from "@spt-aki/models/eft/launcher/IChangeRequestData"; +import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData"; +import { IRegisterData } from "@spt-aki/models/eft/launcher/IRegisterData"; +import { IRemoveProfileData } from "@spt-aki/models/eft/launcher/IRemoveProfileData"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { Watermark } from "@spt-aki/utils/Watermark"; +export declare class LauncherCallbacks { protected httpResponse: HttpResponseUtil; protected launcherController: LauncherController; protected saveServer: SaveServer; @@ -27,4 +27,3 @@ declare class LauncherCallbacks { getLoadedServerMods(): string; getServerModsProfileUsed(url: string, info: IEmptyRequestData, sessionId: string): string; } -export { LauncherCallbacks }; diff --git a/types/callbacks/LocationCallbacks.d.ts b/types/callbacks/LocationCallbacks.d.ts index da0d7cc..a370219 100644 --- a/types/callbacks/LocationCallbacks.d.ts +++ b/types/callbacks/LocationCallbacks.d.ts @@ -1,10 +1,10 @@ -import { LocationController } from "../controllers/LocationController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { ILocationBase } from "../models/eft/common/ILocationBase"; -import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocationController } from "@spt-aki/controllers/LocationController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { ILocationsGenerateAllResponse } from "@spt-aki/models/eft/common/ILocationsSourceDestinationBase"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IGetLocationRequestData } from "@spt-aki/models/eft/location/IGetLocationRequestData"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class LocationCallbacks { protected httpResponse: HttpResponseUtil; protected locationController: LocationController; diff --git a/types/callbacks/MatchCallbacks.d.ts b/types/callbacks/MatchCallbacks.d.ts index 0ed7d37..ae47754 100644 --- a/types/callbacks/MatchCallbacks.d.ts +++ b/types/callbacks/MatchCallbacks.d.ts @@ -1,26 +1,25 @@ -import { MatchController } from "../controllers/MatchController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { IAcceptGroupInviteRequest } from "../models/eft/match/IAcceptGroupInviteRequest"; -import { IAcceptGroupInviteResponse } from "../models/eft/match/IAcceptGroupInviteResponse"; -import { ICancelGroupInviteRequest } from "../models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "../models/eft/match/ICreateGroupRequestData"; -import { IEndOfflineRaidRequestData } from "../models/eft/match/IEndOfflineRaidRequestData"; -import { IGetGroupStatusRequestData } from "../models/eft/match/IGetGroupStatusRequestData"; -import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestData"; -import { IGetRaidConfigurationRequestData } from "../models/eft/match/IGetRaidConfigurationRequestData"; -import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; -import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; -import { IPutMetricsRequestData } from "../models/eft/match/IPutMetricsRequestData"; -import { IRemovePlayerFromGroupRequest } from "../models/eft/match/IRemovePlayerFromGroupRequest"; -import { ISendGroupInviteRequest } from "../models/eft/match/ISendGroupInviteRequest"; -import { ITransferGroupRequest } from "../models/eft/match/ITransferGroupRequest"; -import { IUpdatePingRequestData } from "../models/eft/match/IUpdatePingRequestData"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; +import { MatchController } from "@spt-aki/controllers/MatchController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; +import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; +import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; +import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; +import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; +import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; +import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; +import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; +import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; +import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; +import { IPutMetricsRequestData } from "@spt-aki/models/eft/match/IPutMetricsRequestData"; +import { IRemovePlayerFromGroupRequest } from "@spt-aki/models/eft/match/IRemovePlayerFromGroupRequest"; +import { ISendGroupInviteRequest } from "@spt-aki/models/eft/match/ISendGroupInviteRequest"; +import { ITransferGroupRequest } from "@spt-aki/models/eft/match/ITransferGroupRequest"; +import { IUpdatePingRequestData } from "@spt-aki/models/eft/match/IUpdatePingRequestData"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class MatchCallbacks { protected httpResponse: HttpResponseUtil; protected jsonUtil: JsonUtil; @@ -38,29 +37,27 @@ export declare class MatchCallbacks { sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/decline */ + declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel */ cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/cancel-all */ - cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; - /** Handle raid/profile/list */ - getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** - * @deprecated - not called on raid start/end or game start/exit + * Called periodically while in a group * Handle client/match/group/status * @returns */ - getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; - /** Handle client/match/group/create */ - createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; + getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -70,4 +67,6 @@ export declare class MatchCallbacks { endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration-by-profile */ + getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/types/callbacks/ModCallbacks.d.ts b/types/callbacks/ModCallbacks.d.ts index d1ec7f7..6af1e68 100644 --- a/types/callbacks/ModCallbacks.d.ts +++ b/types/callbacks/ModCallbacks.d.ts @@ -1,12 +1,12 @@ -import { OnLoad } from "../di/OnLoad"; -import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { HttpFileUtil } from "../utils/HttpFileUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -declare class ModCallbacks implements OnLoad { +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { PostAkiModLoader } from "@spt-aki/loaders/PostAkiModLoader"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +export declare class ModCallbacks implements OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; @@ -18,4 +18,3 @@ declare class ModCallbacks implements OnLoad { onLoad(): Promise; getRoute(): string; } -export { ModCallbacks }; diff --git a/types/callbacks/NoteCallbacks.d.ts b/types/callbacks/NoteCallbacks.d.ts index cb1cbc8..a60d3bb 100644 --- a/types/callbacks/NoteCallbacks.d.ts +++ b/types/callbacks/NoteCallbacks.d.ts @@ -1,7 +1,7 @@ -import { NoteController } from "../controllers/NoteController"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { INoteActionData } from "../models/eft/notes/INoteActionData"; +import { NoteController } from "@spt-aki/controllers/NoteController"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData"; export declare class NoteCallbacks { protected noteController: NoteController; constructor(noteController: NoteController); diff --git a/types/callbacks/NotifierCallbacks.d.ts b/types/callbacks/NotifierCallbacks.d.ts index eb1ead9..59faade 100644 --- a/types/callbacks/NotifierCallbacks.d.ts +++ b/types/callbacks/NotifierCallbacks.d.ts @@ -1,12 +1,12 @@ -import { NotifierController } from "../controllers/NotifierController"; -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INotifierChannel } from "../models/eft/notifier/INotifier"; -import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; -import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; +import { NotifierController } from "@spt-aki/controllers/NotifierController"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INotifierChannel } from "@spt-aki/models/eft/notifier/INotifier"; +import { ISelectProfileRequestData } from "@spt-aki/models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "@spt-aki/models/eft/notifier/ISelectProfileResponse"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; protected httpResponse: HttpResponseUtil; diff --git a/types/callbacks/PresetBuildCallbacks.d.ts b/types/callbacks/PresetBuildCallbacks.d.ts index e5973a9..541715a 100644 --- a/types/callbacks/PresetBuildCallbacks.d.ts +++ b/types/callbacks/PresetBuildCallbacks.d.ts @@ -4,23 +4,13 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IPresetBuildActionRequestData } from "../models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "../models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "../models/eft/profile/IAkiProfile"; +import { WeaponBuild } from "../models/eft/profile/IAkiProfile"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class PresetBuildCallbacks { protected httpResponse: HttpResponseUtil; protected presetBuildController: PresetBuildController; constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); - /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle removeBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/callbacks/PresetCallbacks.d.ts b/types/callbacks/PresetCallbacks.d.ts index 37bf4e8..2741094 100644 --- a/types/callbacks/PresetCallbacks.d.ts +++ b/types/callbacks/PresetCallbacks.d.ts @@ -1,5 +1,5 @@ -import { PresetController } from "../controllers/PresetController"; -import { OnLoad } from "../di/OnLoad"; +import { PresetController } from "@spt-aki/controllers/PresetController"; +import { OnLoad } from "@spt-aki/di/OnLoad"; export declare class PresetCallbacks implements OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); diff --git a/types/callbacks/ProfileCallbacks.d.ts b/types/callbacks/ProfileCallbacks.d.ts index 77f6a27..e3d53e9 100644 --- a/types/callbacks/ProfileCallbacks.d.ts +++ b/types/callbacks/ProfileCallbacks.d.ts @@ -1,29 +1,34 @@ -import { ProfileController } from "../controllers/ProfileController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; -import { GetProfileStatusResponseData } from "../models/eft/profile/GetProfileStatusResponseData"; -import { IGetProfileSettingsRequest } from "../models/eft/profile/IGetProfileSettingsRequest"; -import { IProfileChangeNicknameRequestData } from "../models/eft/profile/IProfileChangeNicknameRequestData"; -import { IProfileChangeVoiceRequestData } from "../models/eft/profile/IProfileChangeVoiceRequestData"; -import { IProfileCreateRequestData } from "../models/eft/profile/IProfileCreateRequestData"; -import { ISearchFriendRequestData } from "../models/eft/profile/ISearchFriendRequestData"; -import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendResponse"; -import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ProfileController } from "@spt-aki/controllers/ProfileController"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; +import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; +import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; +import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; +import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; +import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; +import { ISearchFriendRequestData } from "@spt-aki/models/eft/profile/ISearchFriendRequestData"; +import { ISearchFriendResponse } from "@spt-aki/models/eft/profile/ISearchFriendResponse"; +import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; - constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + protected profileHelper: ProfileHelper; + constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper); /** * Handle client/game/profile/create */ - createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; + createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/game/profile/list * Get the complete player profile (scav + pmc character) @@ -61,6 +66,11 @@ export declare class ProfileCallbacks { * Called when creating a character when choosing a character face/voice */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/view + * Called when viewing another players profile + */ + getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData; /** * Handle client/profile/settings */ diff --git a/types/callbacks/QuestCallbacks.d.ts b/types/callbacks/QuestCallbacks.d.ts index b3b37dd..b5c5275 100644 --- a/types/callbacks/QuestCallbacks.d.ts +++ b/types/callbacks/QuestCallbacks.d.ts @@ -1,17 +1,17 @@ -import { QuestController } from "../controllers/QuestController"; -import { RepeatableQuestController } from "../controllers/RepeatableQuestController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest } from "../models/eft/common/tables/IQuest"; -import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; -import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; -import { IHandoverQuestRequestData } from "../models/eft/quests/IHandoverQuestRequestData"; -import { IListQuestsRequestData } from "../models/eft/quests/IListQuestsRequestData"; -import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { QuestController } from "@spt-aki/controllers/QuestController"; +import { RepeatableQuestController } from "@spt-aki/controllers/RepeatableQuestController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IQuest } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; +import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; +import { IListQuestsRequestData } from "@spt-aki/models/eft/quests/IListQuestsRequestData"; +import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class QuestCallbacks { protected httpResponse: HttpResponseUtil; protected questController: QuestController; diff --git a/types/callbacks/RagfairCallbacks.d.ts b/types/callbacks/RagfairCallbacks.d.ts index 5ba1176..5dc21d0 100644 --- a/types/callbacks/RagfairCallbacks.d.ts +++ b/types/callbacks/RagfairCallbacks.d.ts @@ -1,26 +1,28 @@ -import { OnLoad } from "../di/OnLoad"; -import { OnUpdate } from "../di/OnUpdate"; -import { RagfairController } from "../controllers/RagfairController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAddOfferRequestData } from "../models/eft/ragfair/IAddOfferRequestData"; -import { IExtendOfferRequestData } from "../models/eft/ragfair/IExtendOfferRequestData"; -import { IGetItemPriceResult } from "../models/eft/ragfair/IGetItemPriceResult"; -import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPriceRequestData"; -import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; -import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferRequestData"; -import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; -import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; -import { IStorePlayerOfferTaxAmountRequestData } from "../models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RagfairServer } from "../servers/RagfairServer"; -import { RagfairTaxService } from "../services/RagfairTaxService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; +import { RagfairController } from "@spt-aki/controllers/RagfairController"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAddOfferRequestData } from "@spt-aki/models/eft/ragfair/IAddOfferRequestData"; +import { IExtendOfferRequestData } from "@spt-aki/models/eft/ragfair/IExtendOfferRequestData"; +import { IGetItemPriceResult } from "@spt-aki/models/eft/ragfair/IGetItemPriceResult"; +import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMarketPriceRequestData"; +import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; +import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; +import { ISendRagfairReportRequestData } from "@spt-aki/models/eft/ragfair/ISendRagfairReportRequestData"; +import { IStorePlayerOfferTaxAmountRequestData } from "@spt-aki/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { RagfairServer } from "@spt-aki/servers/RagfairServer"; +import { RagfairTaxService } from "@spt-aki/services/RagfairTaxService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; /** * Handle ragfair related callback events */ @@ -45,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; - /** \Handle RagFairRemoveOffer event */ + /** Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; @@ -57,4 +59,6 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { /** Handle client/reports/ragfair/send */ sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; storePlayerOfferTaxAmount(url: string, request: IStorePlayerOfferTaxAmountRequestData, sessionId: string): INullResponseData; + /** Handle client/ragfair/offer/findbyid */ + getFleaOfferById(url: string, request: IGetRagfairOfferByIdRequest, sessionID: string): IGetBodyResponseData; } diff --git a/types/callbacks/RepairCallbacks.d.ts b/types/callbacks/RepairCallbacks.d.ts index 283e0a3..c8587dc 100644 --- a/types/callbacks/RepairCallbacks.d.ts +++ b/types/callbacks/RepairCallbacks.d.ts @@ -1,8 +1,8 @@ -import { RepairController } from "../controllers/RepairController"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IRepairActionDataRequest } from "../models/eft/repair/IRepairActionDataRequest"; -import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { RepairController } from "@spt-aki/controllers/RepairController"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRepairActionDataRequest } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; +import { ITraderRepairActionDataRequest } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); diff --git a/types/callbacks/SaveCallbacks.d.ts b/types/callbacks/SaveCallbacks.d.ts index 1997f46..74d463f 100644 --- a/types/callbacks/SaveCallbacks.d.ts +++ b/types/callbacks/SaveCallbacks.d.ts @@ -1,8 +1,8 @@ -import { OnLoad } from "../di/OnLoad"; -import { OnUpdate } from "../di/OnUpdate"; -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { SaveServer } from "../servers/SaveServer"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; export declare class SaveCallbacks implements OnLoad, OnUpdate { protected saveServer: SaveServer; protected configServer: ConfigServer; diff --git a/types/callbacks/TradeCallbacks.d.ts b/types/callbacks/TradeCallbacks.d.ts index 1c0cb32..bfa72b0 100644 --- a/types/callbacks/TradeCallbacks.d.ts +++ b/types/callbacks/TradeCallbacks.d.ts @@ -1,9 +1,9 @@ -import { TradeController } from "../controllers/TradeController"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "../models/eft/trade/IProcessRagfairTradeRequestData"; -import { ISellScavItemsToFenceRequestData } from "../models/eft/trade/ISellScavItemsToFenceRequestData"; +import { TradeController } from "@spt-aki/controllers/TradeController"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; +import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; export declare class TradeCallbacks { protected tradeController: TradeController; constructor(tradeController: TradeController); diff --git a/types/callbacks/TraderCallbacks.d.ts b/types/callbacks/TraderCallbacks.d.ts index 4097e00..6f0929f 100644 --- a/types/callbacks/TraderCallbacks.d.ts +++ b/types/callbacks/TraderCallbacks.d.ts @@ -1,14 +1,15 @@ -import { OnLoad } from "../di/OnLoad"; -import { OnUpdate } from "../di/OnUpdate"; -import { TraderController } from "../controllers/TraderController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TraderController } from "@spt-aki/controllers/TraderController"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class TraderCallbacks implements OnLoad, OnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; - constructor(httpResponse: HttpResponseUtil, traderController: TraderController); + constructor(httpResponse: HttpResponseUtil, // TODO: delay required + traderController: TraderController); onLoad(): Promise; onUpdate(): Promise; getRoute(): string; diff --git a/types/callbacks/WeatherCallbacks.d.ts b/types/callbacks/WeatherCallbacks.d.ts index f9d2002..2c6fdf6 100644 --- a/types/callbacks/WeatherCallbacks.d.ts +++ b/types/callbacks/WeatherCallbacks.d.ts @@ -1,8 +1,8 @@ -import { WeatherController } from "../controllers/WeatherController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { WeatherController } from "@spt-aki/controllers/WeatherController"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "@spt-aki/models/eft/weather/IWeatherData"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; diff --git a/types/callbacks/WishlistCallbacks.d.ts b/types/callbacks/WishlistCallbacks.d.ts index a118cc8..29c3e44 100644 --- a/types/callbacks/WishlistCallbacks.d.ts +++ b/types/callbacks/WishlistCallbacks.d.ts @@ -1,7 +1,7 @@ -import { WishlistController } from "../controllers/WishlistController"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IWishlistActionData } from "../models/eft/wishlist/IWishlistActionData"; +import { WishlistController } from "@spt-aki/controllers/WishlistController"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IWishlistActionData } from "@spt-aki/models/eft/wishlist/IWishlistActionData"; export declare class WishlistCallbacks { protected wishlistController: WishlistController; constructor(wishlistController: WishlistController); diff --git a/types/context/ApplicationContext.d.ts b/types/context/ApplicationContext.d.ts index 0a81be0..22c6c0e 100644 --- a/types/context/ApplicationContext.d.ts +++ b/types/context/ApplicationContext.d.ts @@ -1,20 +1,20 @@ -import { ContextVariable } from "./ContextVariable"; -import { ContextVariableType } from "./ContextVariableType"; +import { ContextVariable } from "@spt-aki/context/ContextVariable"; +import { ContextVariableType } from "@spt-aki/context/ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; /** * Called like: - * + * ``` * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); * * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue(); * - * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); - * @param type - * @returns + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue(); + * ``` */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; + clearValues(type: ContextVariableType): void; } diff --git a/types/context/ContextVariable.d.ts b/types/context/ContextVariable.d.ts index 0fe0a63..21bf7ef 100644 --- a/types/context/ContextVariable.d.ts +++ b/types/context/ContextVariable.d.ts @@ -1,4 +1,4 @@ -import { ContextVariableType } from "./ContextVariableType"; +import { ContextVariableType } from "@spt-aki/context/ContextVariableType"; export declare class ContextVariable { private value; private timestamp; diff --git a/types/context/ContextVariableType.d.ts b/types/context/ContextVariableType.d.ts index 49f3267..0722a98 100644 --- a/types/context/ContextVariableType.d.ts +++ b/types/context/ContextVariableType.d.ts @@ -6,5 +6,6 @@ export declare enum ContextVariableType { /** Timestamp when client first connected */ CLIENT_START_TIMESTAMP = 2, /** When player is loading into map and loot is requested */ - REGISTER_PLAYER_REQUEST = 3 + REGISTER_PLAYER_REQUEST = 3, + RAID_ADJUSTMENTS = 4 } diff --git a/types/controllers/AchievementController.d.ts b/types/controllers/AchievementController.d.ts new file mode 100644 index 0000000..32365c8 --- /dev/null +++ b/types/controllers/AchievementController.d.ts @@ -0,0 +1,23 @@ +import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; +import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +/** + * Logic for handling In Raid callbacks + */ +export declare class AchievementController { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Get base achievements + * @param sessionID Session id + */ + getAchievements(sessionID: string): IGetAchievementsResponse; + /** + * Shows % of 'other' players who've completed each achievement + * @param sessionId Session id + * @returns ICompletedAchievementsResponse + */ + getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse; +} diff --git a/types/controllers/BotController.d.ts b/types/controllers/BotController.d.ts index c343f95..d148abc 100644 --- a/types/controllers/BotController.d.ts +++ b/types/controllers/BotController.d.ts @@ -1,21 +1,24 @@ -import { ApplicationContext } from "../context/ApplicationContext"; -import { BotGenerator } from "../generators/BotGenerator"; -import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; -import { BotHelper } from "../helpers/BotHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; -import { IBotBase } from "../models/eft/common/tables/IBotBase"; -import { IBotCore } from "../models/eft/common/tables/IBotCore"; -import { Difficulty } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { LocalisationService } from "../services/LocalisationService"; -import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; -import { JsonUtil } from "../utils/JsonUtil"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { BotGenerator } from "@spt-aki/generators/BotGenerator"; +import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; +import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,23 +28,24 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil); /** - * Return the number of bot loadout varieties to be generated - * @param type bot Type we want the loadout gen count for + * Return the number of bot load-out varieties to be generated + * @param type bot Type we want the load-out gen count for * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; /** * Handle singleplayer/settings/bot/difficulty - * Get the core.json difficulty settings from database\bots + * Get the core.json difficulty settings from database/bots * @returns IBotCore */ getBotCoreDifficulty(): IBotCore; @@ -49,10 +53,10 @@ export declare class BotController { * Get bot difficulty settings * adjust PMC settings to ensure they engage the correct bot types * @param type what bot the server is requesting settings for - * @param difficulty difficulty level server requested settings for + * @param diffLevel difficulty level server requested settings for * @returns Difficulty object */ - getBotDifficulty(type: string, difficulty: string): Difficulty; + getBotDifficulty(type: string, diffLevel: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -61,7 +65,22 @@ export declare class BotController { */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * On first bot generation bots are generated and stored inside a cache, ready to be used later + * @param request Bot generation request object + * @param pmcProfile Player profile + * @param sessionId Session id + * @returns + */ + protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[]; + /** + * Pull a single bot out of cache and return, if cache is empty add bots to it and then return + * @param sessionId Session id + * @param request Bot generation request object + * @returns Single IBotBase object + */ + protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asonline", get selected difficulty from config * @param requestedDifficulty * @returns */ diff --git a/types/controllers/BuildController.d.ts b/types/controllers/BuildController.d.ts new file mode 100644 index 0000000..dd954a7 --- /dev/null +++ b/types/controllers/BuildController.d.ts @@ -0,0 +1,36 @@ +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class BuildController { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; + protected saveServer: SaveServer; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle client/builds/weapon/save */ + saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void; + /** Handle client/builds/equipment/save event */ + saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void; + /** Handle client/builds/delete*/ + removeBuild(sessionID: string, request: IRemoveBuildRequestData): void; + protected removePlayerBuild(id: string, sessionID: string): void; + /** + * Handle client/builds/magazine/save + */ + createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void; +} diff --git a/types/controllers/ClientLogController.d.ts b/types/controllers/ClientLogController.d.ts new file mode 100644 index 0000000..5d70ba4 --- /dev/null +++ b/types/controllers/ClientLogController.d.ts @@ -0,0 +1,10 @@ +import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +export declare class ClientLogController { + protected logger: ILogger; + constructor(logger: ILogger); + /** + * Handle /singleplayer/log + */ + clientLog(logRequest: IClientLogRequest): void; +} diff --git a/types/controllers/CustomizationController.d.ts b/types/controllers/CustomizationController.d.ts index f38feae..27de49a 100644 --- a/types/controllers/CustomizationController.d.ts +++ b/types/controllers/CustomizationController.d.ts @@ -1,14 +1,14 @@ -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ISuit } from "../models/eft/common/tables/ITrader"; -import { ClothingItem, IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; -import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocalisationService } from "../services/LocalisationService"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ISuit } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ClothingItem, IBuyClothingRequestData } from "@spt-aki/models/eft/customization/IBuyClothingRequestData"; +import { IWearClothingRequestData } from "@spt-aki/models/eft/customization/IWearClothingRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; diff --git a/types/controllers/DialogueController.d.ts b/types/controllers/DialogueController.d.ts index d673159..0cb31c1 100644 --- a/types/controllers/DialogueController.d.ts +++ b/types/controllers/DialogueController.d.ts @@ -1,34 +1,27 @@ -import { DialogueHelper } from "../helpers/DialogueHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; -import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; -import { IGetMailDialogViewRequestData } from "../models/eft/dialog/IGetMailDialogViewRequestData"; -import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { ISendMessageRequest } from "../models/eft/dialog/ISendMessageRequest"; -import { Dialogue, DialogueInfo, IAkiProfile, IUserDialogInfo, Message } from "../models/eft/profile/IAkiProfile"; -import { MessageType } from "../models/enums/MessageType"; -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { SaveServer } from "../servers/SaveServer"; -import { GiftService } from "../services/GiftService"; -import { MailSendService } from "../services/MailSendService"; -import { HashUtil } from "../utils/HashUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { IGetAllAttachmentsResponse } from "@spt-aki/models/eft/dialog/IGetAllAttachmentsResponse"; +import { IGetFriendListDataResponse } from "@spt-aki/models/eft/dialog/IGetFriendListDataResponse"; +import { IGetMailDialogViewRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewRequestData"; +import { IGetMailDialogViewResponseData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewResponseData"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { Dialogue, DialogueInfo, IAkiProfile, IUserDialogInfo, Message } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class DialogueController { protected logger: ILogger; protected saveServer: SaveServer; protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - protected profileHelper: ProfileHelper; - protected randomUtil: RandomUtil; protected mailSendService: MailSendService; - protected giftService: GiftService; - protected hashUtil: HashUtil; protected configServer: ConfigServer; - protected coreConfig: ICoreConfig; - constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, hashUtil: HashUtil, configServer: ConfigServer); + protected dialogueChatBots: IDialogueChatBot[]; + constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, mailSendService: MailSendService, configServer: ConfigServer, dialogueChatBots: IDialogueChatBot[]); + registerChatBot(chatBot: IDialogueChatBot): void; /** Handle onUpdate spt event */ update(): void; /** @@ -117,18 +110,11 @@ export declare class DialogueController { * Get all uncollected items attached to mail in a particular dialog * @param dialogueId Dialog to get mail attachments from * @param sessionId Session id - * @returns + * @returns IGetAllAttachmentsResponse */ getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ sendMessage(sessionId: string, request: ISendMessageRequest): string; - /** - * Send responses back to player when they communicate with SPT friend on friends list - * @param sessionId Session Id - * @param request send message request - */ - protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void; - protected getSptFriendData(friendId?: string): IUserDialogInfo; /** * Get messages from a specific dialog that have items not expired * @param sessionId Session id diff --git a/types/controllers/GameController.d.ts b/types/controllers/GameController.d.ts index b6903b7..9feb6cc 100644 --- a/types/controllers/GameController.d.ts +++ b/types/controllers/GameController.d.ts @@ -1,36 +1,41 @@ -import { ApplicationContext } from "../context/ApplicationContext"; -import { HideoutHelper } from "../helpers/HideoutHelper"; -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; -import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; -import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; -import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; -import { IServerDetails } from "../models/eft/game/IServerDetails"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ILocationConfig } from "../models/spt/config/ILocationConfig"; -import { ILootConfig } from "../models/spt/config/ILootConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; -import { GiftService } from "../services/GiftService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; -import { LocalisationService } from "../services/LocalisationService"; -import { OpenZoneService } from "../services/OpenZoneService"; -import { ProfileFixerService } from "../services/ProfileFixerService"; -import { SeasonalEventService } from "../services/SeasonalEventService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ICheckVersionResponse } from "@spt-aki/models/eft/game/ICheckVersionResponse"; +import { ICurrentGroupResponse } from "@spt-aki/models/eft/game/ICurrentGroupResponse"; +import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigResponse"; +import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse"; +import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest"; +import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; +import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { CustomLocationWaveService } from "@spt-aki/services/CustomLocationWaveService"; +import { GiftService } from "@spt-aki/services/GiftService"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { OpenZoneService } from "@spt-aki/services/OpenZoneService"; +import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -49,30 +54,30 @@ export declare class GameController { protected seasonalEventService: SeasonalEventService; protected itemBaseClassService: ItemBaseClassService; protected giftService: GiftService; + protected raidTimeAdjustmentService: RaidTimeAdjustmentService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; - protected os: any; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + protected botConfig: IBotConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer); load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected adjustLocationBotValues(): void; + /** + * Out of date/incorrectly made trader mods forget this data + */ + protected checkTraderRepairValuesExist(): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo40Secs(): 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 - */ - protected fixIncorrectAidValue(fullProfile: IAkiProfile): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -95,6 +100,10 @@ export declare class GameController { * Handle client/game/keepalive */ getKeepAlive(sessionId: string): IGameKeepAliveResponse; + /** + * Handle singleplayer/settings/getRaidTime + */ + getRaidTime(sessionId: string, request: IGetRaidTimeRequest): IGetRaidTimeResponse; /** * BSG have two values for shotgun dispersion, we make sure both have the same value */ @@ -107,8 +116,7 @@ export declare class GameController { protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer - * TODO - add body part HP regen - * @param pmcProfile + * @param pmcProfile Profile to adjust values for */ protected updateProfileHealthValues(pmcProfile: IPmcData): void; /** @@ -125,7 +133,8 @@ export declare class GameController { */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** - * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long + * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these + * waves to one bot when they're waiting to spawn for too long */ protected splitBotWavesIntoSingleWaves(): void; /** @@ -134,7 +143,7 @@ export declare class GameController { */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json */ protected validateQuestAssortUnlocksExist(): void; /** diff --git a/types/controllers/HandbookController.d.ts b/types/controllers/HandbookController.d.ts index 52d2dd8..4820f21 100644 --- a/types/controllers/HandbookController.d.ts +++ b/types/controllers/HandbookController.d.ts @@ -1,5 +1,5 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class HandbookController { protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; diff --git a/types/controllers/HealthController.d.ts b/types/controllers/HealthController.d.ts index 2d7ff09..5206cba 100644 --- a/types/controllers/HealthController.d.ts +++ b/types/controllers/HealthController.d.ts @@ -1,19 +1,19 @@ -import { HealthHelper } from "../helpers/HealthHelper"; -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; -import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; -import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; -import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; -import { IWorkoutData } from "../models/eft/health/IWorkoutData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { LocalisationService } from "../services/LocalisationService"; -import { PaymentService } from "../services/PaymentService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; +import { HealthHelper } from "@spt-aki/helpers/HealthHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHealthTreatmentRequestData } from "@spt-aki/models/eft/health/IHealthTreatmentRequestData"; +import { IOffraidEatRequestData } from "@spt-aki/models/eft/health/IOffraidEatRequestData"; +import { IOffraidHealRequestData } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { ISyncHealthRequestData } from "@spt-aki/models/eft/health/ISyncHealthRequestData"; +import { IWorkoutData } from "@spt-aki/models/eft/health/IWorkoutData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class HealthController { protected logger: ILogger; protected jsonUtil: JsonUtil; diff --git a/types/controllers/HideoutController.d.ts b/types/controllers/HideoutController.d.ts index a90a16d..23bdd1e 100644 --- a/types/controllers/HideoutController.d.ts +++ b/types/controllers/HideoutController.d.ts @@ -1,42 +1,44 @@ -import { ScavCaseRewardGenerator } from "../generators/ScavCaseRewardGenerator"; -import { HideoutHelper } from "../helpers/HideoutHelper"; -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { PaymentHelper } from "../helpers/PaymentHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutArea, Product } from "../models/eft/common/tables/IBotBase"; -import { HideoutUpgradeCompleteRequestData } from "../models/eft/hideout/HideoutUpgradeCompleteRequestData"; -import { IHandleQTEEventRequestData } from "../models/eft/hideout/IHandleQTEEventRequestData"; -import { IHideoutArea, Stage } from "../models/eft/hideout/IHideoutArea"; -import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hideout/IHideoutContinuousProductionStartRequestData"; -import { IHideoutImproveAreaRequestData } from "../models/eft/hideout/IHideoutImproveAreaRequestData"; -import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; -import { IHideoutPutItemInRequestData } from "../models/eft/hideout/IHideoutPutItemInRequestData"; -import { IHideoutScavCaseStartRequestData } from "../models/eft/hideout/IHideoutScavCaseStartRequestData"; -import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; -import { IHideoutTakeItemOutRequestData } from "../models/eft/hideout/IHideoutTakeItemOutRequestData"; -import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IHideoutToggleAreaRequestData } from "../models/eft/hideout/IHideoutToggleAreaRequestData"; -import { IHideoutUpgradeRequestData } from "../models/eft/hideout/IHideoutUpgradeRequestData"; -import { IQteData } from "../models/eft/hideout/IQteData"; -import { IRecordShootingRangePoints } from "../models/eft/hideout/IRecordShootingRangePoints"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { HideoutAreas } from "../models/enums/HideoutAreas"; -import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { PlayerService } from "../services/PlayerService"; -import { HashUtil } from "../utils/HashUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData"; +import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData"; +import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea"; +import { IHideoutCancelProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutCancelProductionRequestData"; +import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; +import { IHideoutImproveAreaRequestData } from "@spt-aki/models/eft/hideout/IHideoutImproveAreaRequestData"; +import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; +import { IHideoutPutItemInRequestData } from "@spt-aki/models/eft/hideout/IHideoutPutItemInRequestData"; +import { IHideoutScavCaseStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutScavCaseStartRequestData"; +import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; +import { IHideoutTakeItemOutRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeItemOutRequestData"; +import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IHideoutToggleAreaRequestData } from "@spt-aki/models/eft/hideout/IHideoutToggleAreaRequestData"; +import { IHideoutUpgradeRequestData } from "@spt-aki/models/eft/hideout/IHideoutUpgradeRequestData"; +import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; +import { IRecordShootingRangePoints } from "@spt-aki/models/eft/hideout/IRecordShootingRangePoints"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PlayerService } from "@spt-aki/services/PlayerService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -44,6 +46,7 @@ export declare class HideoutController { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected inventoryHelper: InventoryHelper; + protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected playerService: PlayerService; protected presetHelper: PresetHelper; @@ -57,34 +60,34 @@ export declare class HideoutController { protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected fenceService: FenceService; - protected static nameBackendCountersCrafting: string; + /** Key used in TaskConditionCounters array */ + protected static nameTaskConditionCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Upgrade wall status to visible in profile if medstation/water collector are both level 1 * @param pmcData Player profile */ protected checkAndUpgradeWall(pmcData: IPmcData): void; /** - * * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id @@ -101,8 +104,7 @@ export declare class HideoutController { */ protected addUpdateInventoryItemToProfile(pmcData: IPmcData, dbHideoutData: IHideoutArea, hideoutStage: Stage): void; /** - * - * @param output Objet to send to client + * @param output Object to send to client * @param sessionID Session/player id * @param areaType Hideout area that had stash added * @param hideoutDbData Hideout area that caused addition of stash @@ -203,32 +205,29 @@ export declare class HideoutController { * @param pmcData Player profile * @param request Remove production from area request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; + /** + * Get the "CounterHoursCrafting" TaskConditionCounter from a profile + * @param pmcData Profile to get counter from + * @param recipe Recipe being crafted + * @returns ITaskConditionCounter + */ + protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter; /** * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request * @param output Output object to update - * @returns IItemEventRouterResponse */ - protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Start area production for item by adding production to profiles' Hideout.Production array - * @param pmcData Player profile - * @param request Start production request - * @param sessionID Session id - * @returns IItemEventRouterResponse - */ - registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; /** * Get quick time event list for hideout * // TODO - implement this * @param sessionId Session id * @returns IQteData array - */ + */ getQteList(sessionId: string): IQteData[]; /** * Handle HideoutQuickTimeEvent on client/game/profile/items/moving @@ -237,7 +236,7 @@ export declare class HideoutController { * @param pmcData Profile to adjust * @param request QTE result object */ - handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse; + handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void; /** * Record a high score from the shooting range into a player profiles overallcounters * @param sessionId Session id @@ -245,14 +244,22 @@ export declare class HideoutController { * @param request shooting range score request * @returns IItemEventRouterResponse */ - recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse; + recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void; /** * Handle client/game/profile/items/moving - HideoutImproveArea * @param sessionId Session id - * @param pmcData profile to improve area in - * @param request improve area request data + * @param pmcData Profile to improve area in + * @param request Improve area request data */ improveArea(sessionId: string, pmcData: IPmcData, request: IHideoutImproveAreaRequestData): IItemEventRouterResponse; + /** + * Handle client/game/profile/items/moving HideoutCancelProductionCommand + * @param sessionId Session id + * @param pmcData Profile with craft to cancel + * @param request Cancel production request data + * @returns IItemEventRouterResponse + */ + cancelProduction(sessionId: string, pmcData: IPmcData, request: IHideoutCancelProductionRequestData): IItemEventRouterResponse; /** * Function called every x seconds as part of onUpdate event */ diff --git a/types/controllers/InraidController.d.ts b/types/controllers/InraidController.d.ts index 6e86c63..1f923dd 100644 --- a/types/controllers/InraidController.d.ts +++ b/types/controllers/InraidController.d.ts @@ -1,27 +1,36 @@ -import { ApplicationContext } from "../context/ApplicationContext"; -import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; -import { HealthHelper } from "../helpers/HealthHelper"; -import { InRaidHelper } from "../helpers/InRaidHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { QuestHelper } from "../helpers/QuestHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; -import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { PlayerRaidEndState } from "../models/enums/PlayerRaidEndState"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { InsuranceService } from "../services/InsuranceService"; -import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; -import { PmcChatResponseService } from "../services/PmcChatResponseService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { PlayerScavGenerator } from "@spt-aki/generators/PlayerScavGenerator"; +import { HealthHelper } from "@spt-aki/helpers/HealthHelper"; +import { InRaidHelper } from "@spt-aki/helpers/InRaidHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; +import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; +import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; +import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; +import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService"; +import { TraderServicesService } from "@spt-aki/services/TraderServicesService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Logic for handling In Raid callbacks */ @@ -39,13 +48,21 @@ export declare class InraidController { protected playerScavGenerator: PlayerScavGenerator; protected healthHelper: HealthHelper; protected traderHelper: TraderHelper; + protected traderServicesService: TraderServicesService; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; + protected mailSendService: MailSendService; + protected randomUtil: RandomUtil; protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + protected btrConfig: IBTRConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; + protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; + protected hideoutConfig: IHideoutConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id @@ -62,23 +79,21 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** - * Make changes to pmc profile after they've died in raid, - * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * Make changes to PMC profile after they've died in raid, + * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile - * @param insuranceEnabled Is insurance enabled - * @param preRaidGear Gear player had before raid * @param sessionID Session id * @returns Updated profile object */ - protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData; /** - * Adjust player characters bodypart hp post-raid + * Adjust player characters body part hp post-raid * @param postRaidSaveRequest post raid data * @param pmcData player profile */ @@ -86,15 +101,41 @@ export declare class InraidController { /** * Reduce body part hp to % of max * @param pmcData profile to edit - * @param multipler multipler to apply to max health + * @param multiplier multiplier to apply to max health */ - protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; + /** + * merge two dictionaries together + * Prioritise pair that has true as a value + * @param primary main dictionary + * @param secondary Secondary dictionary + */ + protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void; + /** + * Post-scav-raid any charisma increase must be propigated into PMC profile + * @param postRaidServerScavProfile Scav profile after adjustments made from raid + * @param postRaidServerPmcProfile Pmc profile after raid + * @param preRaidScavCharismaProgress charisma progress value pre-raid + */ + protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void; + /** + * Does provided profile contain any condition counters + * @param profile Profile to check for condition counters + * @returns Profile has condition counters + */ + protected profileHasConditionCounters(profile: IPmcData): boolean; + /** + * Scav quest progress isnt transferred automatically from scav to pmc, we do this manually + * @param scavProfile Scav profile with quest progress post-raid + * @param pmcProfile Server pmc profile to copy scav quest progress into + */ + protected migrateScavQuestProgressToPmcProfile(scavProfile: IPmcData, pmcProfile: IPmcData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object @@ -120,9 +161,8 @@ export declare class InraidController { * @param pmcData Pmc profile * @param offraidData Post-raid save request * @param scavData Scav profile - * @param sessionID Session id */ - protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void; /** * Get the inraid config from configs/inraid.json * @returns InRaid Config @@ -133,4 +173,20 @@ export declare class InraidController { * @returns Airdrop config */ getAirdropConfig(): IAirdropConfig; + /** + * Get BTR config from configs/btr.json + * @returns Airdrop config + */ + getBTRConfig(): IBTRConfig; + /** + * Handle singleplayer/traderServices/getTraderServices + * @returns Trader services data + */ + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; + /** + * Handle singleplayer/traderServices/itemDelivery + */ + itemDelivery(sessionId: string, traderId: string, items: Item[]): void; + getTraitorScavHostileChance(url: string, sessionID: string): number; + getSandboxMaxPatrolValue(url: string, sessionID: string): number; } diff --git a/types/controllers/InsuranceController.d.ts b/types/controllers/InsuranceController.d.ts index 061d0c9..e9e377d 100644 --- a/types/controllers/InsuranceController.d.ts +++ b/types/controllers/InsuranceController.d.ts @@ -1,29 +1,32 @@ -import { DialogueHelper } from "../helpers/DialogueHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; -import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; -import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; -import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { InsuranceService } from "../services/InsuranceService"; -import { MailSendService } from "../services/MailSendService"; -import { PaymentService } from "../services/PaymentService"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostRequestData"; +import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData"; +import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { InsuranceService } from "@spt-aki/services/InsuranceService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceController { protected logger: ILogger; protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,18 +40,19 @@ export declare class InsuranceController { protected mailSendService: MailSendService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); + protected roubleTpl: string; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** * Process insurance items of all profiles prior to being given back to the player through the mail service. * * @returns void - */ + */ processReturn(): void; /** * Process insurance items of a single profile prior to being given back to the player through the mail service. * * @returns void - */ + */ processReturnByProfile(sessionID: string): void; /** * Get all insured items that are ready to be processed in a specific profile. @@ -67,67 +71,108 @@ export declare class InsuranceController { */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; /** - * Build an array of items to delete from the insured items. - * - * This method orchestrates several steps: - * - Filters items based on their presence in the database and their raid moddability. - * - Sorts base and independent child items to consider for deletion. - * - Groups child items by their parent for later evaluation. - * - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll. - * - * @param insured - The insured items to build a removal array from. - * @returns An array of IDs representing items that should be deleted. + * Count all items in all insurance packages. + * @param insurance + * @returns */ - protected findItemsToDelete(insured: Insurance): string[]; + protected countAllInsuranceItems(insurance: Insurance[]): number; /** - * Filters an item based on its existence in the database, raid moddability, and slot requirements. + * Remove an insurance package from a profile using the package's system data information. * - * @param item The item to be filtered. - * @param parentItemDbDetails The database details of the parent item, or null if the item has no parent. - * @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database, - * and the second element is the item details if it does. - * @returns true if the item exists in the database and neither of the following conditions are met: - * - The item has the RaidModdable property set to false. - * - The item is attached to a required slot in its parent item. - * Otherwise, returns false. - */ - protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean; - /** - * Determines if an item is either a base item or a child item that is not equipped to its parent. - * - * @param item The item to check. - * @returns true if the item is a base or an independent child item, otherwise false. - */ - protected isBaseOrIndependentChild(item: Item): boolean; - /** - * Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added - * to the `toDelete` array. - * - * @param item The item for which the roll is made. - * @param traderId The ID of the trader to consider in the rollForItemDelete method. - * @param toDelete The array accumulating the IDs of items to be deleted. - * @returns true if the item is marked for deletion, otherwise false. - */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; - /** - * Groups child items by their parent IDs in a Map data structure. - * - * @param item The child item to be grouped by its parent. - * @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs. + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. * @returns void */ - protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map): void; + protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void; /** - * Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to - * determine if it should be deleted. The method then deletes the most valuable children based on the number of - * successful rolls made. + * Finds the items that should be deleted based on the given Insurance object. * - * @param children The array of children items to sort and filter. - * @param traderId The ID of the trader to consider in the rollForItemDelete method. + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate for deletion. + * @returns A Set containing the IDs of items that should be deleted. + */ + protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set; + /** + * Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this + * context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, + * not the backpack that the gun is located in (the gun's parent). + * + * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. + * @param insured - The insurance object containing the items to evaluate. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items. + */ + protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map): Map; + /** + * Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + * remain, the parent is removed from the map as well. + * + * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap - A Map object for quick item look-up by item ID. + * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. + */ + protected removeNonModdableAttachments(parentAttachmentsMap: Map, itemsMap: Map): Map; + /** + * Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" + * item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, + * they (and their attached, attachments, if any) are marked for deletion in the toDelete Set. + * + * @param insured The insurance object containing the items to evaluate. + * @param toDelete A Set to keep track of items marked for deletion. + * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. + * @returns void + */ + protected processRegularItems(insured: Insurance, toDelete: Set, parentAttachmentsMap: Map): void; + /** + * Process parent items and their attachments, updating the toDelete Set accordingly. + * + * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. + * @param itemsMap A Map object for quick item look-up by item ID. + * @param traderId The trader ID from the Insurance object. + * @param toDelete A Set object to keep track of items marked for deletion. + */ + protected processAttachments(mainParentToAttachmentsMap: Map, itemsMap: Map, traderId: string, toDelete: Set): void; + /** + * Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by + * their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the + * number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most + * valuable attachments first. + * + * @param attachments The array of attachment items to sort, filter, and roll. + * @param traderId The ID of the trader to that has ensured these items. * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set): void; + /** + * Sorts the attachment items by their max price in descending order. + * + * @param attachments The array of attachments items. + * @returns An array of items enriched with their max price and common locale-name. + */ + protected sortAttachmentsByPrice(attachments: Item[]): EnrichedItem[]; + /** + * Logs the details of each attachment item. + * + * @param attachments The array of attachment items. + */ + protected logAttachmentsDetails(attachments: EnrichedItem[]): void; + /** + * Counts the number of successful rolls for the attachment items. + * + * @param attachments The array of attachment items. + * @param traderId The ID of the trader that has insured these attachments. + * @returns The number of successful rolls. + */ + protected countSuccessfulRolls(attachments: Item[], traderId: string): number; + /** + * Marks the most valuable attachments for deletion based on the number of successful rolls made. + * + * @param attachments The array of attachment items. + * @param successfulRolls The number of successful rolls. + * @param toDelete The array that accumulates the IDs of the items to be deleted. + */ + protected attachmentDeletionByValue(attachments: EnrichedItem[], successfulRolls: number, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,26 +180,24 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. - * @param noItems Whether or not there are any items to return to the player. * @returns void */ - protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + protected sendMail(sessionID: string, insurance: Insurance): void; /** - * Determines whether a valid insured item should be removed from the player's inventory based on a random roll and + * Determines whether a insured item should be removed from the player's inventory based on a random roll and * trader-specific return chance. * - * @param insuredItem The insured item being evaluated for removal. * @param traderId The ID of the trader who insured the item. - * @param itemsBeingDeleted List of items that are already slated for removal. - * @returns true if the insured item should be removed from inventory, false otherwise. + * @param insuredItem Optional. The item to roll for. Only used for logging. + * @returns true if the insured item should be removed from inventory, false otherwise, or null on error. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null; /** * Handle Insure event * Add insurance to an item @@ -175,3 +218,8 @@ export declare class InsuranceController { */ cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData; } +interface EnrichedItem extends Item { + name: string; + maxPrice: number; +} +export {}; diff --git a/types/controllers/InventoryController.d.ts b/types/controllers/InventoryController.d.ts index 5e7d19a..7597437 100644 --- a/types/controllers/InventoryController.d.ts +++ b/types/controllers/InventoryController.d.ts @@ -1,39 +1,44 @@ -import { LootGenerator } from "../generators/LootGenerator"; -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentHelper } from "../helpers/PaymentHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { QuestHelper } from "../helpers/QuestHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; -import { IInventoryCreateMarkerRequestData } from "../models/eft/inventory/IInventoryCreateMarkerRequestData"; -import { IInventoryDeleteMarkerRequestData } from "../models/eft/inventory/IInventoryDeleteMarkerRequestData"; -import { IInventoryEditMarkerRequestData } from "../models/eft/inventory/IInventoryEditMarkerRequestData"; -import { IInventoryExamineRequestData } from "../models/eft/inventory/IInventoryExamineRequestData"; -import { IInventoryFoldRequestData } from "../models/eft/inventory/IInventoryFoldRequestData"; -import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMergeRequestData"; -import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; -import { IInventoryReadEncyclopediaRequestData } from "../models/eft/inventory/IInventoryReadEncyclopediaRequestData"; -import { IInventoryRemoveRequestData } from "../models/eft/inventory/IInventoryRemoveRequestData"; -import { IInventorySortRequestData } from "../models/eft/inventory/IInventorySortRequestData"; -import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; -import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwapRequestData"; -import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; -import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; -import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; -import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { RagfairOfferService } from "../services/RagfairOfferService"; -import { HashUtil } from "../utils/HashUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; +import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; +import { IInventoryDeleteMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryDeleteMarkerRequestData"; +import { IInventoryEditMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryEditMarkerRequestData"; +import { IInventoryExamineRequestData } from "@spt-aki/models/eft/inventory/IInventoryExamineRequestData"; +import { IInventoryFoldRequestData } from "@spt-aki/models/eft/inventory/IInventoryFoldRequestData"; +import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; +import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; +import { IInventoryReadEncyclopediaRequestData } from "@spt-aki/models/eft/inventory/IInventoryReadEncyclopediaRequestData"; +import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; +import { IInventorySortRequestData } from "@spt-aki/models/eft/inventory/IInventorySortRequestData"; +import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventorySwapRequestData } from "@spt-aki/models/eft/inventory/IInventorySwapRequestData"; +import { IInventoryTagRequestData } from "@spt-aki/models/eft/inventory/IInventoryTagRequestData"; +import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInventoryToggleRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData"; +import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData"; +import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PlayerService } from "@spt-aki/services/PlayerService"; +import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,81 +50,80 @@ export declare class InventoryController { protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected questHelper: QuestHelper; + protected hideoutHelper: HideoutHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected playerService: PlayerService; protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** - * Move Item - * change location of item with parentId and slotId - * transfers items from one profile to another if fromOwner/toOwner is set in the body. - * otherwise, move is contained within the same profile_f. + * Move Item + * change location of item with parentId and slotId + * transfers items from one profile to another if fromOwner/toOwner is set in the body. + * otherwise, move is contained within the same profile_f. * @param pmcData Profile * @param moveRequest Move request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Get a event router response with inventory trader message * @param output Item event router response * @returns Item event router response */ - protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; - /** - * Remove Item from Profile - * Deep tree item deletion, also removes items from insurance list - */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void; /** * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ - discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Split Item * spliting 1 stack into 2 * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param request Split request * @param sessionID Session/player id + * @param output Client response * @returns IItemEventRouterResponse */ - splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') * Deletes item from `body.item` and adding number of stacks into `body.with` * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param body Merge request * @param sessionID Player id + * @param output Client response * @returns IItemEventRouterResponse */ - mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; + mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * TODO: Adds no data to output to send to client, is this by design? - * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * Transfer items from one stack into another while keeping original stack * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * @param pmcData Player profile * @param body Transfer request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; + transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Swap Item - * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment - * Also used to swap items using quick selection on character screen - */ + * Swap Item + * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment + * Also used to swap items using quick selection on character screen + */ swapItem(pmcData: IPmcData, request: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; /** * Handles folding of Weapons */ - foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; + foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; /** * Toggles "Toggleable" items like night vision goggles and face shields. * @param pmcData player profile @@ -138,26 +142,38 @@ export declare class InventoryController { tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; /** * Bind an inventory item to the quick access menu at bottom of player screen + * Handle bind event * @param pmcData Player profile * @param bindRequest Reqeust object * @param sessionID Session id * @returns IItemEventRouterResponse */ - bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; + bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void; + /** + * Unbind an inventory item from quick access menu at bottom of player screen + * Handle unbind event + * @param pmcData Player profile + * @param bindRequest Request object + * @param sessionID Session id + * @param output Client response + */ + unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Handles examining an item * @param pmcData player profile * @param body request object * @param sessionID session id + * @param output Client response * @returns response */ - examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void; /** * Get the tplid of an item from the examine request object - * @param body response request - * @returns tplid + * @param request Response request + * @returns tplId */ - protected getExaminedItemTpl(body: IInventoryExamineRequestData): string; + protected getExaminedItemTpl(request: IInventoryExamineRequestData): string; readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle ApplyInventoryChanges @@ -165,33 +181,33 @@ export declare class InventoryController { * @param pmcData Player profile * @param request sort request * @param sessionID Session id - * @returns IItemEventRouterResponse */ - sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; + sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void; /** * Add note to a map * @param pmcData Player profile * @param request Add marker request * @param sessionID Session id + * @param output Client response * @returns IItemEventRouterResponse */ - createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; + createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Delete a map marker * @param pmcData Player profile * @param request Delete marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; + deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Edit an existing map marker * @param pmcData Player profile * @param request Edit marker request * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** * Strip out characters from note string that are not: letter/numbers/unicode/spaces * @param mapNoteText Marker text to sanitise @@ -202,9 +218,11 @@ export declare class InventoryController { * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data - * @param body open loot container request data + * @param body Open loot container request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output Client response */ - openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void; + redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void; + setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void; } diff --git a/types/controllers/LauncherController.d.ts b/types/controllers/LauncherController.d.ts index 66d1f7b..cfed796 100644 --- a/types/controllers/LauncherController.d.ts +++ b/types/controllers/LauncherController.d.ts @@ -1,20 +1,26 @@ -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; -import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; -import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; -import { IRegisterData } from "../models/eft/launcher/IRegisterData"; -import { Info, ModDetails } from "../models/eft/profile/IAkiProfile"; -import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; +import { IChangeRequestData } from "@spt-aki/models/eft/launcher/IChangeRequestData"; +import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData"; +import { IRegisterData } from "@spt-aki/models/eft/launcher/IRegisterData"; +import { Info, ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "@spt-aki/models/eft/profile/IConnectResponse"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IPackageJsonData } from "@spt-aki/models/spt/mod/IPackageJsonData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LauncherController { + protected logger: ILogger; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected profileHelper: ProfileHelper; @@ -23,17 +29,19 @@ export declare class LauncherController { protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** - * Get descriptive text for each of the profile edtions a player can choose - * @returns + * Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" + * @returns Dictionary of profile types with related descriptive text */ protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; protected createAccount(info: IRegisterData): string; + protected generateProfileId(): string; + protected formatID(timeStamp: number, counter: number): string; changeUsername(info: IChangeRequestData): string; changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; diff --git a/types/controllers/LocationController.d.ts b/types/controllers/LocationController.d.ts index 94f5fce..5595baf 100644 --- a/types/controllers/LocationController.d.ts +++ b/types/controllers/LocationController.d.ts @@ -1,22 +1,25 @@ -import { LocationGenerator } from "../generators/LocationGenerator"; -import { LootGenerator } from "../generators/LootGenerator"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ILocationBase } from "../models/eft/common/ILocationBase"; -import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; -import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; -import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; -import { AirdropTypeEnum } from "../models/enums/AirdropType"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { ILocationConfig } from "../models/spt/config/ILocationConfig"; -import { LootRequest } from "../models/spt/services/LootRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { LocationGenerator } from "@spt-aki/generators/LocationGenerator"; +import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { ILocationsGenerateAllResponse } from "@spt-aki/models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropLootResult } from "@spt-aki/models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "@spt-aki/models/eft/location/IGetLocationRequestData"; +import { AirdropTypeEnum } from "@spt-aki/models/enums/AirdropType"; +import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; @@ -25,13 +28,16 @@ export declare class LocationController { protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; + protected raidTimeAdjustmentService: RaidTimeAdjustmentService; + protected itemFilterService: ItemFilterService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected airdropConfig: IAirdropConfig; protected locationConfig: ILocationConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data @@ -55,7 +61,7 @@ export declare class LocationController { generateAll(sessionId: string): ILocationsGenerateAllResponse; /** * Handle client/location/getAirdropLoot - * Get loot for an airdop container + * Get loot for an airdrop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ diff --git a/types/controllers/MatchController.d.ts b/types/controllers/MatchController.d.ts index ce9bc7f..6b1a7c3 100644 --- a/types/controllers/MatchController.d.ts +++ b/types/controllers/MatchController.d.ts @@ -1,27 +1,35 @@ -import { ApplicationContext } from "../context/ApplicationContext"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ICreateGroupRequestData } from "../models/eft/match/ICreateGroupRequestData"; -import { IEndOfflineRaidRequestData } from "../models/eft/match/IEndOfflineRaidRequestData"; -import { IGetGroupStatusRequestData } from "../models/eft/match/IGetGroupStatusRequestData"; -import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestData"; -import { IGetRaidConfigurationRequestData } from "../models/eft/match/IGetRaidConfigurationRequestData"; -import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; -import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { IMatchConfig } from "../models/spt/config/IMatchConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { SaveServer } from "../servers/SaveServer"; -import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { BotLootCacheService } from "../services/BotLootCacheService"; -import { MatchLocationService } from "../services/MatchLocationService"; -import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { LootGenerator } from "@spt-aki/generators/LootGenerator"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; +import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; +import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; +import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; +import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; +import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; +import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { IMatchConfig } from "@spt-aki/models/spt/config/IMatchConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService"; +import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { MatchLocationService } from "@spt-aki/services/MatchLocationService"; +import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchController { protected logger: ILogger; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; @@ -29,22 +37,21 @@ export declare class MatchController { protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; protected botGenerationCacheService: BotGenerationCacheService; + protected mailSendService: MailSendService; + protected lootGenerator: LootGenerator; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; - protected inraidConfig: IInRaidConfig; + protected inRaidConfig: IInRaidConfig; + protected traderConfig: ITraderConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext); getEnabled(): boolean; - /** Handle raid/profile/list */ - getProfile(info: IGetProfileRequestData): IPmcData[]; - /** Handle client/match/group/create */ - createGroup(sessionID: string, info: ICreateGroupRequestData): any; /** Handle client/match/group/delete */ deleteGroup(info: any): void; /** Handle match/group/start_game */ joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult; /** Handle client/match/group/status */ - getGroupStatus(info: IGetGroupStatusRequestData): any; + getGroupStatus(info: IGetGroupStatusRequestData): IGetGroupStatusResponse; /** * Handle /client/raid/configuration * @param request Raid config request @@ -59,6 +66,19 @@ export declare class MatchController { protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; /** Handle client/match/offline/end */ endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; + /** + * Did player take a COOP extract + * @param extractName Name of extract player took + * @returns True if coop extract + */ + protected extractWasViaCoop(extractName: string): boolean; + protected sendCoopTakenFenceMessage(sessionId: string): void; + /** + * Handle when a player extracts using a coop extract - add rep to fence + * @param pmcData Profile + * @param extractName Name of extract taken + */ + protected handleCoopExtract(pmcData: IPmcData, extractName: string): void; /** * Was extract by car * @param extractName name of extract @@ -73,10 +93,11 @@ export declare class MatchController { */ protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void; /** - * Update players fence trader standing value in profile - * @param pmcData Player profile - * @param fenceId Id of fence trader - * @param extractName Name of extract used + * Get the fence rep gain from using a car or coop extract + * @param pmcData Profile + * @param baseGain amount gained for the first extract + * @param extractCount Number of times extract was taken + * @returns Fence standing after taking extract */ - protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void; + protected getFenceStandingAfterExtract(pmcData: IPmcData, baseGain: number, extractCount: number): number; } diff --git a/types/controllers/NoteController.d.ts b/types/controllers/NoteController.d.ts index 9e2e250..ef07d6d 100644 --- a/types/controllers/NoteController.d.ts +++ b/types/controllers/NoteController.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { INoteActionData } from "../models/eft/notes/INoteActionData"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; export declare class NoteController { protected eventOutputHolder: EventOutputHolder; constructor(eventOutputHolder: EventOutputHolder); diff --git a/types/controllers/NotifierController.d.ts b/types/controllers/NotifierController.d.ts index de354ec..ad3d025 100644 --- a/types/controllers/NotifierController.d.ts +++ b/types/controllers/NotifierController.d.ts @@ -1,7 +1,7 @@ -import { NotifierHelper } from "../helpers/NotifierHelper"; -import { NotificationService } from "../services/NotificationService"; -import { INotifierChannel } from "../models/eft/notifier/INotifier"; -import { HttpServerHelper } from "../helpers/HttpServerHelper"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; +import { INotifierChannel } from "@spt-aki/models/eft/notifier/INotifier"; +import { NotificationService } from "@spt-aki/services/NotificationService"; export declare class NotifierController { protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; diff --git a/types/controllers/PresetBuildController.d.ts b/types/controllers/PresetBuildController.d.ts index d7bd3f3..65ae0c4 100644 --- a/types/controllers/PresetBuildController.d.ts +++ b/types/controllers/PresetBuildController.d.ts @@ -2,35 +2,17 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IPresetBuildActionRequestData } from "../models/eft/presetBuild/IPresetBuildActionRequestData"; -import { IRemoveBuildRequestData } from "../models/eft/presetBuild/IRemoveBuildRequestData"; -import { IUserBuilds } from "../models/eft/profile/IAkiProfile"; -import { ILogger } from "../models/spt/utils/ILogger"; +import { WeaponBuild } from "../models/eft/profile/IAkiProfile"; import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class PresetBuildController { - protected logger: ILogger; protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; - protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected saveServer: SaveServer; - constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); - /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): IUserBuilds; - /** Handle SaveWeaponBuild event */ - saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; - /** Handle SaveEquipmentBuild event */ - saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveWeaponBuild event*/ - removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveEquipmentBuild event*/ - removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; + constructor(hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, saveServer: SaveServer); + getUserBuilds(sessionID: string): WeaponBuild[]; + saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/controllers/PresetController.d.ts b/types/controllers/PresetController.d.ts index ca1af1a..2e40723 100644 --- a/types/controllers/PresetController.d.ts +++ b/types/controllers/PresetController.d.ts @@ -1,8 +1,10 @@ -import { PresetHelper } from "../helpers/PresetHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class PresetController { + protected logger: ILogger; protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; - constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer); initialize(): void; } diff --git a/types/controllers/ProfileController.d.ts b/types/controllers/ProfileController.d.ts index ffccdaf..41d8658 100644 --- a/types/controllers/ProfileController.d.ts +++ b/types/controllers/ProfileController.d.ts @@ -1,28 +1,32 @@ -import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; -import { DialogueHelper } from "../helpers/DialogueHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { QuestHelper } from "../helpers/QuestHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IMiniProfile } from "../models/eft/launcher/IMiniProfile"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { IProfileChangeNicknameRequestData } from "../models/eft/profile/IProfileChangeNicknameRequestData"; -import { IProfileChangeVoiceRequestData } from "../models/eft/profile/IProfileChangeVoiceRequestData"; -import { IProfileCreateRequestData } from "../models/eft/profile/IProfileCreateRequestData"; -import { ISearchFriendRequestData } from "../models/eft/profile/ISearchFriendRequestData"; -import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendResponse"; -import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { MailSendService } from "../services/MailSendService"; -import { ProfileFixerService } from "../services/ProfileFixerService"; -import { HashUtil } from "../utils/HashUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { PlayerScavGenerator } from "@spt-aki/generators/PlayerScavGenerator"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile"; +import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest"; +import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse"; +import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; +import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; +import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; +import { ISearchFriendRequestData } from "@spt-aki/models/eft/profile/ISearchFriendRequestData"; +import { ISearchFriendResponse } from "@spt-aki/models/eft/profile/ISearchFriendResponse"; +import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ProfileController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -32,6 +36,7 @@ export declare class ProfileController { protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; + protected seasonalEventService: SeasonalEventService; protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; @@ -39,7 +44,7 @@ export declare class ProfileController { protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); /** * Handle /launcher/profiles */ @@ -54,8 +59,16 @@ export declare class ProfileController { getCompleteProfile(sessionID: string): IPmcData[]; /** * Handle client/game/profile/create + * @param info Client reqeust object + * @param sessionID Player id + * @returns Profiles _id value */ - createProfile(info: IProfileCreateRequestData, sessionID: string): void; + createProfile(info: IProfileCreateRequestData, sessionID: string): string; + /** + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ + protected updateInventoryEquipmentId(pmcData: IPmcData): void; /** * Delete a profile * @param sessionID Id of profile to delete @@ -98,4 +111,9 @@ export declare class ProfileController { * Handle client/game/profile/search */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; + /** + * Handle client/profile/status + */ + getProfileStatus(sessionId: string): GetProfileStatusResponseData; + getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse; } diff --git a/types/controllers/QuestController.d.ts b/types/controllers/QuestController.d.ts index bd8a70f..786b3d3 100644 --- a/types/controllers/QuestController.d.ts +++ b/types/controllers/QuestController.d.ts @@ -1,31 +1,32 @@ -import { DialogueHelper } from "../helpers/DialogueHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; -import { QuestHelper } from "../helpers/QuestHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuestStatus } from "../models/eft/common/tables/IBotBase"; -import { Item } from "../models/eft/common/tables/IItem"; -import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; -import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; -import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; -import { IHandoverQuestRequestData } from "../models/eft/quests/IHandoverQuestRequestData"; -import { IQuestConfig } from "../models/spt/config/IQuestConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocaleService } from "../services/LocaleService"; -import { LocalisationService } from "../services/LocalisationService"; -import { MailSendService } from "../services/MailSendService"; -import { PlayerService } from "../services/PlayerService"; -import { SeasonalEventService } from "../services/SeasonalEventService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; +import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; +import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; +import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { PlayerService } from "@spt-aki/services/PlayerService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -68,12 +69,6 @@ export declare class QuestController { * @returns true = show to player */ protected showEventQuestToPlayer(questId: string): boolean; - /** - * Is the quest for the opposite side the player is on - * @param playerSide Player side (usec/bear) - * @param questId QuestId to check - */ - protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle QuestAccept event * Handle the client accepting a quest and starting it @@ -82,7 +77,7 @@ export declare class QuestController { * @param pmcData Profile to update * @param acceptedQuest Quest accepted * @param sessionID Session id - * @returns client response + * @returns Client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -113,6 +108,18 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]; + /** + * Remove a quest entirely from a profile + * @param sessionId Player id + * @param questIdToRemove Qid of quest to remove + */ + protected removeQuestFromScavProfile(sessionId: string, questIdToRemove: string): void; /** * Return quests that have different statuses * @param preQuestStatusus Quests before @@ -127,7 +134,7 @@ export declare class QuestController { * @param completedQuestId Completed quest id * @param questRewards Rewards given to player */ - protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void; + protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void; /** * Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile * @param pmcData Player profile to update @@ -135,12 +142,6 @@ export declare class QuestController { * @param completedQuestId Quest just completed */ protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void; - /** - * Returns a list of quests that should be failed when a quest is completed - * @param completedQuestId quest completed id - * @returns array of quests - */ - protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status @@ -173,7 +174,7 @@ export declare class QuestController { * @param output Response to send to user * @returns IItemEventRouterResponse */ - protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist @@ -182,5 +183,13 @@ export declare class QuestController { * @param questId quest id counter is associated with * @param counterValue value to increment the backend counter with */ - protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; + /** + * Handle /client/game/profile/items/moving - QuestFail + * @param pmcData Pmc profile + * @param request Fail qeust request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/types/controllers/RagfairController.d.ts b/types/controllers/RagfairController.d.ts index bda37cd..0c01b7d 100644 --- a/types/controllers/RagfairController.d.ts +++ b/types/controllers/RagfairController.d.ts @@ -1,42 +1,44 @@ -import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentHelper } from "../helpers/PaymentHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { RagfairHelper } from "../helpers/RagfairHelper"; -import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; -import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; -import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; -import { IExtendOfferRequestData } from "../models/eft/ragfair/IExtendOfferRequestData"; -import { IGetItemPriceResult } from "../models/eft/ragfair/IGetItemPriceResult"; -import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPriceRequestData"; -import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; -import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; -import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RagfairServer } from "../servers/RagfairServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { PaymentService } from "../services/PaymentService"; -import { RagfairOfferService } from "../services/RagfairOfferService"; -import { RagfairPriceService } from "../services/RagfairPriceService"; -import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; -import { RagfairTaxService } from "../services/RagfairTaxService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { RagfairOfferGenerator } from "@spt-aki/generators/RagfairOfferGenerator"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { RagfairHelper } from "@spt-aki/helpers/RagfairHelper"; +import { RagfairOfferHelper } from "@spt-aki/helpers/RagfairOfferHelper"; +import { RagfairSellHelper } from "@spt-aki/helpers/RagfairSellHelper"; +import { RagfairSortHelper } from "@spt-aki/helpers/RagfairSortHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IAddOfferRequestData, Requirement } from "@spt-aki/models/eft/ragfair/IAddOfferRequestData"; +import { IExtendOfferRequestData } from "@spt-aki/models/eft/ragfair/IExtendOfferRequestData"; +import { IGetItemPriceResult } from "@spt-aki/models/eft/ragfair/IGetItemPriceResult"; +import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMarketPriceRequestData"; +import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult"; +import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RagfairServer } from "@spt-aki/servers/RagfairServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; +import { RagfairTaxService } from "@spt-aki/services/RagfairTaxService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Handle RagfairCallback events */ @@ -68,11 +70,26 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxService: RagfairTaxService, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; + /** + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea + * @param sessionId Player id + * @param request Request data + * @returns IRagfairOffer + */ + getOfferById(sessionId: string, request: IGetRagfairOfferByIdRequest): IRagfairOffer; /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -81,18 +98,10 @@ export declare class RagfairController { /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for - * @returns record with tpls + counts + * @param offers Ragfair offers to get categories for + * @returns record with templates + counts */ - protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; - /** - * Add Required offers to offers result - * @param searchRequest Client search request data - * @param assorts - * @param pmcProfile Player profile - * @param result Result object being sent back to client - */ - protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; /** * Add index to all offers passed in (0-indexed) * @param offers Offers to add index value to @@ -100,17 +109,30 @@ export declare class RagfairController { protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort - * @param offer flea offer to update - * @param profile full profile of player + * @param offer Flea offer to update + * @param fullProfile Players full profile */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void; /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void; + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean; + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean; + /** + * Check all profiles and sell player offers / send player money for listing if it sold + */ update(): void; /** * Called when creating an offer on flea, fills values in top right corner @@ -152,25 +174,33 @@ export declare class RagfairController { */ protected calculateRequirementsPriceInRub(requirements: Requirement[]): number; /** - * Using item ids from flea offer request, find corrispnding items from player inventory and return as array + * Using item ids from flea offer request, find corresponding items from player inventory and return as array * @param pmcData Player profile * @param itemIdsFromFleaOfferRequest Ids from request - * @param errorMessage if item is not found, add error message to this parameter * @returns Array of items from player inventory */ - protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[]; - createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; + protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { + items: Item[] | null; + errorMessage: string | null; + }; + createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; /** * User requested removal of the offer, actually reduces the time to 71 seconds, * allowing for the possibility of extending the auction before it's end time - * @param offerId offer to 'remove' - * @param sessionID Players id + * @param removeRequest Remove offer request + * @param sessionId Players id * @returns IItemEventRouterResponse */ - removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; - extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Extend a ragfair offers listing time + * @param extendRequest Extend offer request + * @param sessionId Players id + * @returns IItemEventRouterResponse + */ + extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse; /** * Create a basic trader request object with price and currency type * @param currency What currency: RUB, EURO, USD diff --git a/types/controllers/RepairController.d.ts b/types/controllers/RepairController.d.ts index b19b1b7..7ec47ff 100644 --- a/types/controllers/RepairController.d.ts +++ b/types/controllers/RepairController.d.ts @@ -1,16 +1,17 @@ -import { QuestHelper } from "../helpers/QuestHelper"; -import { RepairHelper } from "../helpers/RepairHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IRepairActionDataRequest } from "../models/eft/repair/IRepairActionDataRequest"; -import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepairActionDataRequest"; -import { IRepairConfig } from "../models/spt/config/IRepairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { PaymentService } from "../services/PaymentService"; -import { RepairService } from "../services/RepairService"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRepairActionDataRequest } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; +import { ITraderRepairActionDataRequest } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { RepairService } from "@spt-aki/services/RepairService"; export declare class RepairController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; @@ -20,8 +21,9 @@ export declare class RepairController { protected paymentService: PaymentService; protected repairHelper: RepairHelper; protected repairService: RepairService; + protected profileHelper: ProfileHelper; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper); /** * Handle TraderRepair event * Repair with trader diff --git a/types/controllers/RepeatableQuestController.d.ts b/types/controllers/RepeatableQuestController.d.ts index e9d2e56..aae8473 100644 --- a/types/controllers/RepeatableQuestController.d.ts +++ b/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,44 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; -import { PaymentService } from "../services/PaymentService"; -import { ProfileFixerService } from "../services/ProfileFixerService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; -import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} +import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; +import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RepeatableQuestController { - protected timeUtil: TimeUtil; protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; - protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected questHelper: QuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -97,11 +60,19 @@ export declare class RepeatableQuestController { * (if the are on "Succeed" but not "Completed" we keep them, to allow the player to complete them and get the rewards) * The new quests generated are again persisted in profile.RepeatableQuests * + * @param {string} _info Request from client + * @param {string} sessionID Player's session id * - * @param {string} sessionId Player's session id - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get the number of quests to generate - takes into account charisma state of player + * @param repeatableConfig Config + * @param pmcData Player profile + * @returns Quest count + */ + protected getQuestCount(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): number; /** * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists * @param repeatableConfig daily/weekly config @@ -109,103 +80,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +93,25 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission + * Return the locations this PMC is allowed to get daily quests for based on their level + * @param locations The original list of locations + * @param pmcLevel The level of the player PMC + * @returns A filtered list of locations that allow the player PMC level to access it */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + protected getAllowedLocations(locations: Record, pmcLevel: number): Partial>; /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type + * Return true if the given pmcLevel is allowed on the given location + * @param location The location name to check + * @param pmcLevel The level of the pmc + * @returns True if the given pmc level is allowed to access the given location */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + protected attemptToGenerateRepeatableQuest(pmcData: IPmcData, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; } diff --git a/types/controllers/TradeController.d.ts b/types/controllers/TradeController.d.ts index 38e9c01..ce4d02d 100644 --- a/types/controllers/TradeController.d.ts +++ b/types/controllers/TradeController.d.ts @@ -1,29 +1,39 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { TradeHelper } from "../helpers/TradeHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item, Upd } from "../models/eft/common/tables/IItem"; -import { ITraderBase } from "../models/eft/common/tables/ITrader"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; -import { IProcessRagfairTradeRequestData } from "../models/eft/trade/IProcessRagfairTradeRequestData"; -import { ISellScavItemsToFenceRequestData } from "../models/eft/trade/ISellScavItemsToFenceRequestData"; -import { Traders } from "../models/enums/Traders"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RagfairServer } from "../servers/RagfairServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { RagfairPriceService } from "../services/RagfairPriceService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -declare class TradeController { +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TradeHelper } from "@spt-aki/helpers/TradeHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; +import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; +import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RagfairServer } from "@spt-aki/servers/RagfairServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +export declare class TradeController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; + protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected traderHelper: TraderHelper; @@ -32,26 +42,51 @@ declare class TradeController { protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; + protected roubleTpl: string; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ - confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle SellAllFromSavage event */ - sellScavItemsToFence(pmcData: IPmcData, body: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; + confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; /** - * Sell all sellable items to a trader from inventory - * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * Buy an item off the flea sold by a trader * @param sessionId Session id - * @param profileWithItemsToSell Profile with items to be sold to trader - * @param profileThatGetsMoney Profile that gets the money after selling items - * @param trader Trader to sell items to - * @returns IItemEventRouterResponse + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer request data from client + * @param output Output to send back to client */ - protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Buy an item off the flea sold by a PMC + * @param sessionId Session id + * @param pmcData Player profile + * @param fleaOffer Offer being purchased + * @param requestOffer Request data from client + * @param output Output to send back to client + */ + protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void; + /** + * Does Player have necessary trader loyalty to purchase flea offer + * @param sellerIsTrader is seller trader + * @param fleaOffer FLea offer being bought + * @param pmcData Player profile + * @returns True if player can buy offer + */ + protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean; + /** Handle SellAllFromSavage event */ + sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Send the specified rouble total to player as mail + * @param sessionId Session id + * @param trader Trader to sell items to + * @param output IItemEventRouterResponse + */ + protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void; /** * Looks up an items children and gets total handbook price for them * @param parentItemId parent item that has children we want to sum price of @@ -61,6 +96,4 @@ declare class TradeController { * @returns Rouble price */ protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; - protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } -export { TradeController }; diff --git a/types/controllers/TraderController.d.ts b/types/controllers/TraderController.d.ts index 5e31c43..6f1a92f 100644 --- a/types/controllers/TraderController.d.ts +++ b/types/controllers/TraderController.d.ts @@ -1,16 +1,20 @@ -import { FenceBaseAssortGenerator } from "../generators/FenceBaseAssortGenerator"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { FenceService } from "../services/FenceService"; -import { TraderAssortService } from "../services/TraderAssortService"; -import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; -import { JsonUtil } from "../utils/JsonUtil"; +import { FenceBaseAssortGenerator } from "@spt-aki/generators/FenceBaseAssortGenerator"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderController { protected logger: ILogger; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected traderAssortHelper: TraderAssortHelper; protected profileHelper: ProfileHelper; @@ -20,10 +24,12 @@ export declare class TraderController { protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Runs when onLoad event is fired - * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService * Store timestamp of next assort refresh in nextResupply property of traders .base object */ load(): void; diff --git a/types/controllers/WeatherController.d.ts b/types/controllers/WeatherController.d.ts index eeace8c..e25dc16 100644 --- a/types/controllers/WeatherController.d.ts +++ b/types/controllers/WeatherController.d.ts @@ -1,8 +1,8 @@ -import { WeatherGenerator } from "../generators/WeatherGenerator"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; -import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; +import { WeatherGenerator } from "@spt-aki/generators/WeatherGenerator"; +import { IWeatherData } from "@spt-aki/models/eft/weather/IWeatherData"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; protected logger: ILogger; diff --git a/types/controllers/WishlistController.d.ts b/types/controllers/WishlistController.d.ts index 53a240f..01c4465 100644 --- a/types/controllers/WishlistController.d.ts +++ b/types/controllers/WishlistController.d.ts @@ -1,7 +1,7 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IWishlistActionData } from "../models/eft/wishlist/IWishlistActionData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IWishlistActionData } from "@spt-aki/models/eft/wishlist/IWishlistActionData"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; export declare class WishlistController { protected eventOutputHolder: EventOutputHolder; constructor(eventOutputHolder: EventOutputHolder); diff --git a/types/di/Router.d.ts b/types/di/Router.d.ts index d2b4209..79f3324 100644 --- a/types/di/Router.d.ts +++ b/types/di/Router.d.ts @@ -1,6 +1,6 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export declare class Router { protected handledRoutes: HandledRoute[]; getTopLevelRoute(): string; @@ -21,11 +21,9 @@ export declare class DynamicRouter extends Router { getHandledRoutes(): HandledRoute[]; } export declare class ItemEventRouterDefinition extends Router { - constructor(); - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void; } export declare class SaveLoadRouter extends Router { - constructor(); handleLoad(profile: IAkiProfile): IAkiProfile; } export declare class HandledRoute { diff --git a/types/di/Serializer.d.ts b/types/di/Serializer.d.ts index 2617007..b760b8b 100644 --- a/types/di/Serializer.d.ts +++ b/types/di/Serializer.d.ts @@ -1,5 +1,5 @@ /// -import { IncomingMessage, ServerResponse } from "http"; +import { IncomingMessage, ServerResponse } from "node:http"; export declare class Serializer { serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; diff --git a/types/generators/BotEquipmentModGenerator.d.ts b/types/generators/BotEquipmentModGenerator.d.ts index f7abb84..dd1dcce 100644 --- a/types/generators/BotEquipmentModGenerator.d.ts +++ b/types/generators/BotEquipmentModGenerator.d.ts @@ -1,24 +1,31 @@ -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotHelper } from "../helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; -import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ModSpawn } from "@spt-aki/models/enums/ModSpawn"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { BotEquipmentFilterService } from "@spt-aki/services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "@spt-aki/services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "@spt-aki/services/BotWeaponModLimitService"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { IGenerateEquipmentProperties } from "./BotInventoryGenerator"; +import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult"; export declare class BotEquipmentModGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -34,45 +41,54 @@ export declare class BotEquipmentModGenerator { protected botHelper: BotHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to * @param modPool Mod list to choose frm * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[]; + /** + * Filter a bots plate pool based on its current level + * @param settings Bot equipment generation settings + * @param modSlot Armor slot being filtered + * @param existingPlateTplPool Plates tpls to choose from + * @param armorItem + * @returns Array of plate tpls to choose from + */ + protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult; /** * Add mods to a weapon using the provided mod pool * @param sessionId session id * @param weapon Weapon to add mods to * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon + * @param weaponId parentId of weapon * @param parentTemplate Weapon which mods will be generated on * @param modSpawnChances Mod spawn chances * @param ammoTpl Ammo tpl to use when generating magazines/cartridges * @param botRole Role of bot weapon is generated for - * @param botLevel lvel of the bot weapon is being generated for - * @param modLimits limits placed on certian mod types per gun + * @param botLevel Level of the bot weapon is being generated for + * @param modLimits limits placed on certain mod types per gun * @param botEquipmentRole role of bot when accessing bot.json equipment config settings * @returns Weapon + mods array */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; /** * Is this modslot a front or rear sight * @param modSlot Slot to check * @returns true if it's a front/rear sight */ - protected modIsFrontOrRearSight(modSlot: string): boolean; + protected modIsFrontOrRearSight(modSlot: string, tpl: string): boolean; /** * Does the provided mod details show the mod can hold a scope * @param modSlot e.g. mod_scope, mod_mount @@ -93,18 +109,17 @@ export declare class BotEquipmentModGenerator { * @param parentTemplate item template * @returns Slot item */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + protected getModItemSlotFromDb(modSlot: string, parentTemplate: ITemplateItem): Slot; /** * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn + * @param botEquipConfig Various config settings for generating this type of bot + * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn; /** - * * @param modSlot Slot mod will fit into * @param isRandomisableSlot Will generate a randomised mod pool if true * @param modsParent Parent slot the item will be a part of @@ -113,16 +128,46 @@ export declare class BotEquipmentModGenerator { * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem + * @returns itemHelper.getItem() result */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem]; + protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult; + /** + * Filter mod pool down based on various criteria: + * Is slot flagged as randomisable + * Is slot required + * Is slot flagged as default mod only + * @param itemModPool Existing pool of mods to choose + * @param modSpawnResult outcome of random roll to select if mod should be added + * @param parentTemplate Mods parent + * @param weaponTemplate Mods root parent (weapon/equipment) + * @param modSlot name of mod slot to choose for + * @param botEquipBlacklist + * @param isRandomisableSlot is flagged as a randomisable slot + * @returns + */ + protected getModPoolForSlot(itemModPool: Record, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[]; + /** + * Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl) + * @param weaponTemplate + * @param parentItemTpl + * @returns + */ + protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset; + /** + * Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible + * @param weapon Weapon + * @param modTpl Mod to check compatibility with weapon + * @returns True if incompatible + */ + protected weaponModComboIsIncompatible(weapon: Item[], modTpl: string): boolean; /** * Create a mod item with parameters as properties * @param modId _id * @param modTpl _tpl * @param parentId parentId * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object + * @param modTemplate Used to add additional properties in the upd object * @returns Item object */ protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; @@ -135,21 +180,22 @@ export declare class BotEquipmentModGenerator { /** * Get a random mod from an items compatible mods Filter array * @param modTpl ???? default value to return if nothing found - * @param parentSlot item mod will go into, used to get combatible items + * @param parentSlot item mod will go into, used to get compatible items * @param modSlot Slot to get mod to fill * @param items items to ensure picked mod is compatible with * @returns item tpl */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + protected getRandomModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Log errors if mod is not compatible with slot * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in + * @param slotAddedToTemplate slot the item will be placed in * @param modSlot slot the mod will fill - * @param parentTemplate template of the mods parent item + * @param parentTemplate template of the mods being added + * @param botRole * @returns true if valid */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean; /** * Find mod tpls of a provided type and add to modPool * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) @@ -179,15 +225,15 @@ export declare class BotEquipmentModGenerator { * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes + * @param modPool modPool which should include available cartridges * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** - * Take a record of camoras and merge the compatable shells into one array + * Take a record of camoras and merge the compatible shells into one array * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources + * @returns string array of shells for multiple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** diff --git a/types/generators/BotGenerator.d.ts b/types/generators/BotGenerator.d.ts index 270e4af..520c75d 100644 --- a/types/generators/BotGenerator.d.ts +++ b/types/generators/BotGenerator.d.ts @@ -1,24 +1,24 @@ -import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; -import { BotHelper } from "../helpers/BotHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; -import { Appearance, Health, IBotType } from "../models/eft/common/tables/IBotType"; -import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { LocalisationService } from "../services/LocalisationService"; -import { SeasonalEventService } from "../services/SeasonalEventService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { BotInventoryGenerator } from "./BotInventoryGenerator"; -import { BotLevelGenerator } from "./BotLevelGenerator"; +import { BotInventoryGenerator } from "@spt-aki/generators/BotInventoryGenerator"; +import { BotLevelGenerator } from "@spt-aki/generators/BotLevelGenerator"; +import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { BotEquipmentFilterService } from "@spt-aki/services/BotEquipmentFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -48,12 +48,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * Create 1 bots of the type/side/difficulty defined in botGenerationDetails * @param sessionId Session id * @param botGenerationDetails details on how to generate bots - * @returns array of bots + * @returns constructed bot */ - prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; + prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -78,11 +78,11 @@ export declare class BotGenerator { /** * Create a bot nickname * @param botJsonTemplate x.json from database - * @param isPlayerScav Will bot be player scav + * @param botGenerationDetails * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client @@ -113,8 +113,8 @@ export declare class BotGenerator { * @param bot bot to update * @returns updated IBotBase object */ - protected generateId(bot: IBotBase): IBotBase; - protected generateInventoryID(profile: IBotBase): IBotBase; + protected generateId(bot: IBotBase): void; + protected generateInventoryID(profile: IBotBase): void; /** * Randomise a bots game version and account category * Chooses from all the game versions (standard, eod etc) @@ -127,5 +127,5 @@ export declare class BotGenerator { * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase; + protected addDogtagToBot(bot: IBotBase): void; } diff --git a/types/generators/BotInventoryGenerator.d.ts b/types/generators/BotInventoryGenerator.d.ts index e660390..4ecd672 100644 --- a/types/generators/BotInventoryGenerator.d.ts +++ b/types/generators/BotInventoryGenerator.d.ts @@ -1,21 +1,21 @@ -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotHelper } from "../helpers/BotHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; -import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; -import { BotLootGenerator } from "./BotLootGenerator"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; +import { BotEquipmentModGenerator } from "@spt-aki/generators/BotEquipmentModGenerator"; +import { BotLootGenerator } from "@spt-aki/generators/BotLootGenerator"; +import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "@spt-aki/services/BotEquipmentModPoolService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -51,26 +51,31 @@ export declare class BotInventoryGenerator { /** * Add equipment to a bot * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances items will be added to bot + * @param wornItemChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithProtection(templateInventory: Inventory): void; + /** + * Remove armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): void; /** * Add a piece of equipment with mods to inventory from the provided pools - * @param equipmentSlot Slot to select an item for - * @param equipmentPool Possible items to choose from - * @param modPool Possible mods to apply to item chosen - * @param spawnChances Chances items will be chosen to be added - * @param botRole Role of bot e.g. assault - * @param inventory Inventory to add item into - * @param randomisationDetails settings from bot.json to adjust how item is generated + * @param settings Values to adjust how item is chosen and added to bot + * @returns true when item added */ - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + protected generateEquipment(settings: IGenerateEquipmentProperties): boolean; /** * Get all possible mods for item and filter down based on equipment blacklist from bot.json config - * @param itemTpl Item mod pool is being retreived and filtered + * @param itemTpl Item mod pool is being retrieved and filtered * @param equipmentBlacklist blacklist to filter mod pool with * @returns Filtered pool of mods */ @@ -112,3 +117,20 @@ export declare class BotInventoryGenerator { shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } +export interface IGenerateEquipmentProperties { + /** Root Slot being generated */ + rootEquipmentSlot: string; + /** Equipment pool for root slot being generated */ + rootEquipmentPool: Record; + modPool: Mods; + /** Dictionary of mod items and their chance to spawn for this bot type */ + spawnChances: Chances; + /** Role being generated for */ + botRole: string; + /** Level of bot being generated */ + botLevel: number; + inventory: PmcInventory; + botEquipmentConfig: EquipmentFilters; + /** Settings from bot.json to adjust how item is generated */ + randomisationDetails: RandomisationDetails; +} diff --git a/types/generators/BotLevelGenerator.d.ts b/types/generators/BotLevelGenerator.d.ts index 56005a5..220569b 100644 --- a/types/generators/BotLevelGenerator.d.ts +++ b/types/generators/BotLevelGenerator.d.ts @@ -1,11 +1,11 @@ -import { MinMax } from "../models/common/MinMax"; -import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; -import { IExpTable } from "../models/eft/common/IGlobals"; -import { IBotBase } from "../models/eft/common/tables/IBotBase"; -import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RandomUtil } from "../utils/RandomUtil"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IRandomisedBotLevelResult } from "@spt-aki/models/eft/bot/IRandomisedBotLevelResult"; +import { IExpTable } from "@spt-aki/models/eft/common/IGlobals"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLevelGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -20,10 +20,17 @@ export declare class BotLevelGenerator { */ generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; /** - * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * Get the highest level a bot can be relative to the players level, but no further than the max size from globals.exp_table * @param playerLevel Players current level * @param relativeDeltaMax max delta above player level to go * @returns highest level possible for bot */ protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: IExpTable[]): number; + /** + * Get the lowest level a bot can be relative to the players level, but no lower than 1 + * @param playerLevel Players current level + * @param relativeDeltaMin Min delta below player level to go + * @returns lowest level possible for bot + */ + protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/types/generators/BotLootGenerator.d.ts b/types/generators/BotLootGenerator.d.ts index d0e8758..014617e 100644 --- a/types/generators/BotLootGenerator.d.ts +++ b/types/generators/BotLootGenerator.d.ts @@ -1,40 +1,46 @@ -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotLootCacheService } from "../services/BotLootCacheService"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; +import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotLootGenerator { protected logger: ILogger; protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; + protected inventoryHelper: InventoryHelper; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botHelper: BotHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings; /** * Add loot to bots containers * @param sessionId Session id @@ -66,80 +72,72 @@ export declare class BotLootGenerator { */ protected getRandomisedCount(min: number, max: number, nValue: number): number; /** - * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached - * @param pool Pool of items to pick from + * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + * @param pool Pool of items to pick from with weight * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add * @param inventoryToAddItemsTo Bot inventory loot will be added to * @param botRole Role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param itemSpawnLimits Item spawn limits the bot must adhere to * @param totalValueLimitRub Total value of loot allowed in roubles * @param isPmc Is bot being generated for a pmc */ - protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; + protected addLootFromPool(pool: Record, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void; + protected createWalletLoot(walletId: string): Item[][]; + /** + * Some items need child items to function, add them to the itemToAddChildrenTo array + * @param itemToAddTemplate Db template of item to check + * @param itemToAddChildrenTo Item to add children to + * @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes) + * @param botRole role bot has that owns item + */ + protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void; /** * Add generated weapons to inventory as loot * @param botInventory inventory to add preset to * @param equipmentSlot slot to place the preset in (backpack) * @param templateInventory bots template, assault.json * @param modChances chances for mods to spawn on weapon - * @param botRole bots role, .e.g. pmcBot + * @param botRole bots role .e.g. pmcBot * @param isPmc are we generating for a pmc */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; - /** - * Get a random item from the pool parameter using the biasedRandomNumber system - * @param pool Pool of items to pick an item from - * @param isPmc Is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; - /** - * Get the loot nvalue from botconfig - * @param botRole Role of bot e.g. assault/bosstagilla/sptBear - * @returns nvalue as number - */ - protected getBotLootNValueByRole(botRole: string): number; /** * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc Is the bot a pmc * @param botRole Role the bot has * @param limitCount */ - protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; + protected initItemLimitArray(botRole: string, limitCount: Record): void; /** * Check if an item has reached its bot-specific spawn limit * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type - * @param isPmc Is bot we're working with a pmc - * @param limitCount Spawn limits for items on bot - * @param itemSpawnLimits The limits this bot is allowed to have + * @param itemSpawnLimits * @returns true if item has reached spawn limit */ - protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; + protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean; /** * Randomise the stack size of a money object, uses different values for pmc or scavs - * @param isPmc is this a PMC - * @param itemTemplate item details - * @param moneyItem Money stack to randomise + * @param botRole Role bot has that has money stack + * @param itemTemplate item details from db + * @param moneyItem Money item to randomise */ - protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void; + protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void; /** * Randomise the size of an ammo stack - * @param isPmc is this a PMC - * @param itemTemplate item details - * @param ammoItem Ammo stack to randomise + * @param isPmc Is ammo on a PMC bot + * @param itemTemplate item details from db + * @param ammoItem Ammo item to randomise */ protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void; /** * Get spawn limits for a specific bot type from bot.json config * If no limit found for a non pmc bot, fall back to defaults - * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have * @returns Dictionary of tplIds and limit */ - protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; + protected getItemSpawnLimitsForBotType(botRole: string): Record; /** * Get the parentId or tplId of item inside spawnLimits object if it exists * @param itemTemplate item we want to look for in spawn limits diff --git a/types/generators/BotWeaponGenerator.d.ts b/types/generators/BotWeaponGenerator.d.ts index ff3fb4c..125b43f 100644 --- a/types/generators/BotWeaponGenerator.d.ts +++ b/types/generators/BotWeaponGenerator.d.ts @@ -1,26 +1,26 @@ -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { GenerationData, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { GenerateWeaponResult } from "../models/spt/bots/GenerateWeaponResult"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { IRepairConfig } from "../models/spt/config/IRepairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { LocalisationService } from "../services/LocalisationService"; -import { RepairService } from "../services/RepairService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; -import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; +import { BotEquipmentModGenerator } from "@spt-aki/generators/BotEquipmentModGenerator"; +import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { GenerationData, Inventory, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { GenerateWeaponResult } from "@spt-aki/models/spt/bots/GenerateWeaponResult"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { BotWeaponModLimitService } from "@spt-aki/services/BotWeaponModLimitService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RepairService } from "@spt-aki/services/RepairService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -73,12 +73,13 @@ export declare class BotWeaponGenerator { */ generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** - * Insert a cartridge into a weapon + * Insert a cartridge(s) into a weapon + * Handles all chambers - patron_in_weapon, patron_in_weapon_000 etc * @param weaponWithModsArray Weapon and mods * @param ammoTpl Cartridge to add to weapon - * @param desiredSlotId name of slot, e.g. patron_in_weapon + * @param chamberSlotIds name of slots to create or add ammo to */ - protected addCartridgeToChamber(weaponWithModsArray: Item[], ammoTpl: string, desiredSlotId: string): void; + protected addCartridgeToChamber(weaponWithModsArray: Item[], ammoTpl: string, chamberSlotIds: string[]): void; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/types/generators/FenceBaseAssortGenerator.d.ts b/types/generators/FenceBaseAssortGenerator.d.ts index 486c4bd..c1eabde 100644 --- a/types/generators/FenceBaseAssortGenerator.d.ts +++ b/types/generators/FenceBaseAssortGenerator.d.ts @@ -1,26 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { SeasonalEventService } from "../services/SeasonalEventService"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Create base fence assorts dynamically and store in db + * Create base fence assorts dynamically and store in memory */ generateFenceBaseAssorts(): void; + protected getItemPrice(itemTpl: string, items: Item[]): number; + protected getAmmoBoxPrice(items: Item[]): number; + /** + * Add soft inserts + armor plates to an armor + * @param armor Armor item array to add mods into + * @param itemDbDetails Armor items db template + */ + protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void; /** * Check if item is valid for being added to fence assorts * @param item Item to check diff --git a/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts b/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts new file mode 100644 index 0000000..7e1dbfd --- /dev/null +++ b/types/generators/IFilterPlateModsForSlotByLevelResult.d.ts @@ -0,0 +1,11 @@ +export interface IFilterPlateModsForSlotByLevelResult { + result: Result; + plateModTpls: string[]; +} +export declare enum Result { + UNKNOWN_FAILURE = -1, + SUCCESS = 1, + NO_DEFAULT_FILTER = 2, + NOT_PLATE_HOLDING_SLOT = 3, + LACKS_PLATE_WEIGHTS = 4 +} diff --git a/types/generators/LocationGenerator.d.ts b/types/generators/LocationGenerator.d.ts index 46a514b..ae16be4 100644 --- a/types/generators/LocationGenerator.d.ts +++ b/types/generators/LocationGenerator.d.ts @@ -1,22 +1,21 @@ -import { ContainerHelper } from "../helpers/ContainerHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { IContainerMinMax, IStaticContainer } from "../models/eft/common/ILocation"; -import { ILocationBase } from "../models/eft/common/ILocationBase"; -import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IStaticAmmoDetails, IStaticContainerData, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ILocationConfig } from "../models/spt/config/ILocationConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { SeasonalEventService } from "../services/SeasonalEventService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; -import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation"; +import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IStaticAmmoDetails, IStaticContainerData, IStaticForcedProps, IStaticLootDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -34,7 +33,6 @@ export declare class LocationGenerator { protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; - protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; protected seasonalEventService: SeasonalEventService; @@ -43,7 +41,7 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Create an array of container objects with randomised loot * @param locationBase Map base to generate containers for @@ -121,11 +119,11 @@ export declare class LocationGenerator { generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; /** * Add forced spawn point loot into loot parameter array - * @param loot array to add forced loot to - * @param forcedSpawnPoints forced loot to add - * @param name of map currently generating forced loot for + * @param lootLocationTemplates array to add forced loot spawn locations to + * @param forcedSpawnPoints forced Forced loot locations that must be added + * @param locationName Name of map currently having force loot created for */ - protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[], locationName: string): void; + protected addForcedLoot(lootLocationTemplates: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[], locationName: string): void; /** * Create array of item (with child items) and return * @param chosenComposedKey Key we want to look up items for @@ -147,5 +145,5 @@ export declare class LocationGenerator { * @returns Item object */ protected getItemInArray(items: Item[], chosenTpl: string): Item; - protected createStaticLootItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; + protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; } diff --git a/types/generators/LootGenerator.d.ts b/types/generators/LootGenerator.d.ts index fd7f2c2..6af5c3a 100644 --- a/types/generators/LootGenerator.d.ts +++ b/types/generators/LootGenerator.d.ts @@ -1,20 +1,21 @@ -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IPreset } from "../models/eft/common/IGlobals"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; -import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; -import { LootItem } from "../models/spt/services/LootItem"; -import { LootRequest } from "../models/spt/services/LootRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; -import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; -import { HashUtil } from "../utils/HashUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; +import { LootItem } from "@spt-aki/models/spt/services/LootItem"; +import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; type ItemLimit = { current: number; max: number; @@ -24,6 +25,7 @@ export declare class LootGenerator { protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; @@ -31,13 +33,20 @@ export declare class LootGenerator { protected localisationService: LocalisationService; protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated * @returns An array of loot items */ createRandomLoot(options: LootRequest): LootItem[]; + /** + * Filter armor items by their main plates protection level + * @param armor Armor preset + * @param options Loot request options + * @returns True item passes checks + */ + protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean; /** * Construct item limit record to hold max and current item count for each item type * @param limits limits as defined in config @@ -71,43 +80,36 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) * @param containerSettings sealed weapon container settings - * @returns Array of items to add to player inventory + * @returns Array of item with children arrays */ - getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][]; /** * Get non-weapon mod rewards for a sealed container * @param containerSettings Sealed weapon container settings * @param weaponDetailsDb Details for the weapon to reward player - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][]; /** * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player * @param containerSettings Sealed weapon container settings * @param linkedItemsToWeapon All items that can be attached/inserted into weapon * @param chosenWeaponPreset The weapon preset given to player as reward - * @returns AddItem array + * @returns Array of item with children arrays */ - protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][]; /** * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards * @param rewardContainerDetails - * @returns AddItem array + * @returns Array of item with children arrays */ - getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; - /** - * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication - * Default adds 1, or increments count - * @param itemTplToAdd items tpl we want to add to array - * @param resultsArray Array to add item tpl to - */ - protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][]; } export {}; diff --git a/types/generators/PMCLootGenerator.d.ts b/types/generators/PMCLootGenerator.d.ts index abb5615..4f487be 100644 --- a/types/generators/PMCLootGenerator.d.ts +++ b/types/generators/PMCLootGenerator.d.ts @@ -1,10 +1,11 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { SeasonalEventService } from "../services/SeasonalEventService"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; /** * Handle the generation of dynamic PMC loot in pockets and backpacks * and the removal of blacklisted items @@ -14,22 +15,23 @@ export declare class PMCLootGenerator { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected itemFilterService: ItemFilterService; + protected ragfairPriceService: RagfairPriceService; protected seasonalEventService: SeasonalEventService; - protected pocketLootPool: string[]; - protected vestLootPool: string[]; - protected backpackLootPool: string[]; + protected pocketLootPool: Record; + protected vestLootPool: Record; + protected backpackLootPool: Record; protected pmcConfig: IPmcConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets * @returns string array of tpls */ - generatePMCPocketLootPool(): string[]; + generatePMCPocketLootPool(botRole: string): Record; /** * Create an array of loot items a PMC can have in their vests * @returns string array of tpls */ - generatePMCVestLootPool(): string[]; + generatePMCVestLootPool(botRole: string): Record; /** * Check if item has a width/height that lets it fit into a 2x2 slot * 1x1 / 1x2 / 2x1 / 2x2 @@ -41,5 +43,12 @@ export declare class PMCLootGenerator { * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls */ - generatePMCBackpackLootPool(): string[]; + generatePMCBackpackLootPool(botRole: string): Record; + /** + * Find the greated common divisor of all weights and use it on the passed in dictionary + * @param weightedDict + */ + protected reduceWeightValues(weightedDict: Record): void; + protected commonDivisor(numbers: number[]): number; + protected gcd(a: number, b: number): number; } diff --git a/types/generators/PlayerScavGenerator.d.ts b/types/generators/PlayerScavGenerator.d.ts index 3641268..67967dd 100644 --- a/types/generators/PlayerScavGenerator.d.ts +++ b/types/generators/PlayerScavGenerator.d.ts @@ -1,30 +1,28 @@ -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotHelper } from "../helpers/BotHelper"; -import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Skills, Stats } from "../models/eft/common/tables/IBotBase"; -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { IPlayerScavConfig, KarmaLevel } from "../models/spt/config/IPlayerScavConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { BotLootCacheService } from "../services/BotLootCacheService"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { BotGenerator } from "./BotGenerator"; +import { BotGenerator } from "@spt-aki/generators/BotGenerator"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; +import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PlayerScavGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; @@ -36,13 +34,20 @@ export declare class PlayerScavGenerator { protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated * @returns profile object */ generate(sessionID: string): IPmcData; + /** + * Add items picked from `playerscav.lootItemsToAddChancePercent` + * @param possibleItemsToAdd dict of tpl + % chance to be added + * @param scavData + * @param containersToAddTo Possible slotIds to add loot to + */ + protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record, scavData: IBotBase, containersToAddTo: string[]): void; /** * Get the scav karama level for a profile * Is also the fence trader rep level diff --git a/types/generators/RagfairAssortGenerator.d.ts b/types/generators/RagfairAssortGenerator.d.ts index b26b6e1..10f13f2 100644 --- a/types/generators/RagfairAssortGenerator.d.ts +++ b/types/generators/RagfairAssortGenerator.d.ts @@ -1,52 +1,52 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { IPreset } from "../models/eft/common/IGlobals"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SeasonalEventService } from "../services/SeasonalEventService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class RagfairAssortGenerator { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; - protected generatedAssortItems: Item[]; + protected generatedAssortItems: Item[][]; protected ragfairConfig: IRagfairConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected ragfairItemInvalidBaseTypes: string[]; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** - * Get an array of unique items that can be sold on the flea - * @returns array of unique items + * Get an array of arrays that can be sold on the flea + * Each sub array contains item + children (if any) + * @returns array of arrays */ - getAssortItems(): Item[]; + getAssortItems(): Item[][]; /** * Check internal generatedAssortItems array has objects * @returns true if array has objects */ protected assortsAreGenerated(): boolean; /** - * Generate an array of items the flea can sell - * @returns array of unique items + * Generate an array of arrays (item + children) the flea can sell + * @returns array of arrays (item + children) */ - protected generateRagfairAssortItems(): Item[]; + protected generateRagfairAssortItems(): Item[][]; /** - * Get presets from globals.json - * @returns Preset object array + * Get presets from globals to add to flea + * ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults + * @returns IPreset array */ - protected getPresets(): IPreset[]; - /** - * Get default presets from globals.json - * @returns Preset object array - */ - protected getDefaultPresets(): IPreset[]; + protected getPresetsToAdd(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item * @param id id to add to item - * @returns hydrated Item object + * @returns Hydrated Item object */ - protected createRagfairAssortItem(tplId: string, id?: string): Item; + protected createRagfairAssortRootItem(tplId: string, id?: string): Item; } diff --git a/types/generators/RagfairOfferGenerator.d.ts b/types/generators/RagfairOfferGenerator.d.ts index 58e0b68..46e61a3 100644 --- a/types/generators/RagfairOfferGenerator.d.ts +++ b/types/generators/RagfairOfferGenerator.d.ts @@ -1,27 +1,26 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentHelper } from "../helpers/PaymentHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; -import { RagfairOfferService } from "../services/RagfairOfferService"; -import { RagfairPriceService } from "../services/RagfairPriceService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { RagfairAssortGenerator } from "./RagfairAssortGenerator"; +import { RagfairAssortGenerator } from "@spt-aki/generators/RagfairAssortGenerator"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferGenerator { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -38,7 +37,6 @@ export declare class RagfairOfferGenerator { protected ragfairPriceService: RagfairPriceService; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; @@ -47,7 +45,9 @@ export declare class RagfairOfferGenerator { tpl: string; price: number; }[]; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + /** Internal counter to ensure each offer created has a unique value for its intId property */ + protected offerCounter: number; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); /** * Create a flea offer and store it in the Ragfair server offers array * @param userID Owner of the offer @@ -119,23 +119,28 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): Promise; + generateDynamicOffers(expiredOffers?: Item[][]): Promise; /** - * - * @param assortItemIndex Index of assort item - * @param assortItemsToProcess Item array containing index - * @param expiredOffers Currently expired offers on flea + * @param assortItemWithChildren Item with its children to process into offers + * @param isExpiredOffer is an expired offer * @param config Ragfair dynamic config */ - protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise; + /** + * iterate over an items chidren and look for plates above desired level and remove them + * @param presetWithChildren preset to check for plates + * @param plateSettings Settings + * @returns True if plate removed + */ + protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean; /** * Create one flea offer for a specific item - * @param items Item to create offer for + * @param itemWithChildren Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -145,11 +150,10 @@ export declare class RagfairOfferGenerator { * Get array of an item with its mods + condition properties (e.g durability) * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * @param userID id of owner of item - * @param itemWithMods Item and mods, get condition of first item (only first array item is used) + * @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemDetails db details of first item - * @returns */ - protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -159,24 +163,32 @@ export declare class RagfairOfferGenerator { /** * Alter an items condition based on its item base type * @param conditionSettingsId also the parentId of item being altered - * @param item Item to adjust condition details of + * @param itemWithMods Item to adjust condition details of * @param itemDetails db item details of first item in array */ - protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void; + protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void; /** * Adjust an items durability/maxDurability value - * @param item item (weapon/armor) to adjust - * @param multiplier Value to multiple durability by + * @param item item (weapon/armor) to Adjust + * @param itemDbDetails Weapon details from db + * @param maxMultiplier Value to multiply max durability by + * @param currentMultiplier Value to multiply current durability by */ - protected randomiseDurabilityValues(item: Item, multiplier: number): void; + protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void; + /** + * Randomise the durabiltiy values for an armors plates and soft inserts + * @param armorWithMods Armor item with its child mods + * @param currentMultiplier Chosen multipler to use for current durability value + * @param maxMultiplier Chosen multipler to use for max durability value + */ + protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void; /** * Add missing conditions to an item if needed * Durabiltiy for repairable items * HpResource for medical items * @param item item to add conditions to - * @returns Item with conditions added */ - protected addMissingConditions(item: Item): Item; + protected addMissingConditions(item: Item): void; /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer @@ -193,10 +205,10 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a random currency-based barter scheme for an array of items - * @param offerItems Items on offer + * @param offerWithChildren Items on offer * @param isPackOffer Is the barter scheme being created for a pack offer * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; + protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/types/generators/RepeatableQuestGenerator.d.ts b/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..d020fac --- /dev/null +++ b/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,138 @@ +import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper"; +import { Exit } from "@spt-aki/models/eft/common/ILocationBase"; +import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Get a number of kills neded to complete elimination quest + * @param targetKey Target type desired e.g. anyPmc/bossBully/Savage + * @param targetsConfig Config + * @param eliminationConfig Config + * @returns Number of AI to kill + */ + protected getEliminationKillCount(targetKey: string, targetsConfig: ProbabilityObjectArray, eliminationConfig: IEliminationConfig): number; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {IEliminationCondition} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition; + /** + * Create kill condition for an elimination quest + * @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage" + * @param targetedBodyParts Body parts player must hit + * @param distance Distance from which to kill (currently only >= supported + * @param allowedWeapon What weapon must be used - undefined = any + * @param allowedWeaponCategory What category of weapon must be used - undefined = any + * @returns IEliminationCondition object + */ + protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} itemTpl id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Filter a maps exits to just those for the desired side + * @param locationKey Map id (e.g. factory4_day) + * @param playerSide Scav/Pmc + * @returns Array of Exit objects + */ + protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]; + protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type Quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId Trader from which the quest will be provided + * @param {string} side Scav daily or pmc daily/weekly quest + * @returns {object} Object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/types/generators/RepeatableQuestRewardGenerator.d.ts b/types/generators/RepeatableQuestRewardGenerator.d.ts new file mode 100644 index 0000000..9ac6341 --- /dev/null +++ b/types/generators/RepeatableQuestRewardGenerator.d.ts @@ -0,0 +1,106 @@ +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestRewardGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards; + /** + * @param rewardItems List of reward items to filter + * @param roublesBudget The budget remaining for rewards + * @param minPrice The minimum priced item to include + * @returns True if any items remain in `rewardItems`, false otherwise + */ + protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): ITemplateItem[]; + /** + * Get a randomised number a reward items stack size should be based on its handbook price + * @param item Reward item to get stack size for + * @returns Stack size value + */ + protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number; + /** + * Should reward item have stack size increased (25% chance) + * @param item Item to possibly increase stack size of + * @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking + * @returns True if it should + */ + protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean; + protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number; + /** + * Select a number of items that have a colelctive value of the passed in parameter + * @param repeatableConfig Config + * @param roublesBudget Total value of items to return + * @returns Array of reward items that fit budget + */ + protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[]; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl ItemId of the rewarded item + * @param {integer} value Amount of items to give + * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index + * @returns {object} Object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig Config file + * @returns List of rewardable items [[_tpl, itemTemplate],...] + */ + getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns True if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean; + protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void; +} diff --git a/types/generators/ScavCaseRewardGenerator.d.ts b/types/generators/ScavCaseRewardGenerator.d.ts index d40b4d2..26f3412 100644 --- a/types/generators/ScavCaseRewardGenerator.d.ts +++ b/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,39 +1,44 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { Product } from "../models/eft/common/tables/IBotBase"; -import { Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; -import { IScavCaseConfig } from "../models/spt/config/IScavCaseConfig"; -import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../models/spt/hideout/ScavCaseRewardCountsAndPrices"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { RagfairPriceService } from "../services/RagfairPriceService"; -import { HashUtil } from "../utils/HashUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; +import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig"; +import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "@spt-aki/models/spt/hideout/ScavCaseRewardCountsAndPrices"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handle the creation of randomised scav case rewards */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected seasonalEventService: SeasonalEventService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; protected dbItemsCache: ITemplateItem[]; protected dbAmmoItemsCache: ITemplateItem[]; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param recipeId recipe of the scav case craft * @returns Product array */ - generate(recipeId: string): Product[]; + generate(recipeId: string): Item[][]; /** * Get all db items that are not blacklisted in scavcase config or global blacklist * Store in class field @@ -72,19 +77,8 @@ export declare class ScavCaseRewardGenerator { * @param rewardItems items to convert * @returns Product array */ - protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[]; + protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][]; /** - * Add a randomised stack count to ammo or money items - * @param item money or ammo item - * @param resultItem money or ammo item with a randomise stack size - */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { - _id: string; - _tpl: string; - upd: Upd; - }, rarity: string): void; - /** - * * @param dbItems all items from the items.json * @param itemFilters controls how the dbItems will be filtered and returned (handbook price) * @returns filtered dbItems array diff --git a/types/generators/WeatherGenerator.d.ts b/types/generators/WeatherGenerator.d.ts index 6471bb1..dec30cd 100644 --- a/types/generators/WeatherGenerator.d.ts +++ b/types/generators/WeatherGenerator.d.ts @@ -1,12 +1,12 @@ -import { ApplicationContext } from "../context/ApplicationContext"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; -import { WindDirection } from "../models/enums/WindDirection"; -import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IWeather, IWeatherData } from "@spt-aki/models/eft/weather/IWeatherData"; +import { WindDirection } from "@spt-aki/models/enums/WindDirection"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; @@ -15,6 +15,7 @@ export declare class WeatherGenerator { protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; + private serverStartTimestampMS; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Get current + raid datetime and format into correct BSG format and return @@ -28,13 +29,13 @@ export declare class WeatherGenerator { * @param currentDate current date * @returns formatted time */ - protected getBsgFormattedInRaidTime(currentDate: Date): string; + protected getBsgFormattedInRaidTime(): string; /** * Get the current in-raid time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ - getInRaidTime(currentDate: Date): Date; + getInRaidTime(): Date; /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style diff --git a/types/generators/weapongen/IInventoryMagGen.d.ts b/types/generators/weapongen/IInventoryMagGen.d.ts index 792f510..5586243 100644 --- a/types/generators/weapongen/IInventoryMagGen.d.ts +++ b/types/generators/weapongen/IInventoryMagGen.d.ts @@ -1,4 +1,4 @@ -import { InventoryMagGen } from "./InventoryMagGen"; +import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; export interface IInventoryMagGen { getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; diff --git a/types/generators/weapongen/InventoryMagGen.d.ts b/types/generators/weapongen/InventoryMagGen.d.ts index f827a61..778ac53 100644 --- a/types/generators/weapongen/InventoryMagGen.d.ts +++ b/types/generators/weapongen/InventoryMagGen.d.ts @@ -1,6 +1,6 @@ -import { Inventory } from "../../models/eft/common/tables/IBotBase"; -import { GenerationData } from "../../models/eft/common/tables/IBotType"; -import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export declare class InventoryMagGen { private magCounts; private magazineTemplate; diff --git a/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts index b754d5f..3e5e708 100644 --- a/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts +++ b/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -1,7 +1,7 @@ -import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; -import { RandomUtil } from "../../../utils/RandomUtil"; -import { IInventoryMagGen } from "../IInventoryMagGen"; -import { InventoryMagGen } from "../InventoryMagGen"; +import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; +import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BarrelInventoryMagGen implements IInventoryMagGen { protected randomUtil: RandomUtil; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; diff --git a/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 1589707..bc301a1 100644 --- a/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,16 +1,27 @@ -import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; -import { ItemHelper } from "../../../helpers/ItemHelper"; -import { ILogger } from "../../../models/spt/utils/ILogger"; -import { LocalisationService } from "../../../services/LocalisationService"; -import { IInventoryMagGen } from "../IInventoryMagGen"; -import { InventoryMagGen } from "../InventoryMagGen"; +import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; +import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + protected botGeneratorHelper: BotGeneratorHelper; + protected randomUtil: RandomUtil; + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; + /** + * Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool + * @param weaponTpl Weapon to get mag for + * @returns tpl of magazine + */ + protected getRandomExternalMagazineForInternalMagazineGun(weaponTpl: string, magazineBlacklist: string[]): ITemplateItem; } diff --git a/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts index 4548a04..70efdb5 100644 --- a/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts +++ b/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -1,6 +1,6 @@ -import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; -import { IInventoryMagGen } from "../IInventoryMagGen"; -import { InventoryMagGen } from "../InventoryMagGen"; +import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; +import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); diff --git a/types/generators/weapongen/implementations/UbglExternalMagGen.d.ts b/types/generators/weapongen/implementations/UbglExternalMagGen.d.ts index 75395be..02b7748 100644 --- a/types/generators/weapongen/implementations/UbglExternalMagGen.d.ts +++ b/types/generators/weapongen/implementations/UbglExternalMagGen.d.ts @@ -1,6 +1,6 @@ -import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; -import { IInventoryMagGen } from "../IInventoryMagGen"; -import { InventoryMagGen } from "../InventoryMagGen"; +import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; +import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen"; +import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper"; export declare class UbglExternalMagGen implements IInventoryMagGen { protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); diff --git a/types/helpers/AssortHelper.d.ts b/types/helpers/AssortHelper.d.ts index df674c5..2ed2174 100644 --- a/types/helpers/AssortHelper.d.ts +++ b/types/helpers/AssortHelper.d.ts @@ -1,11 +1,11 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; -import { QuestStatus } from "../models/enums/QuestStatus"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { ItemHelper } from "./ItemHelper"; -import { QuestHelper } from "./QuestHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; @@ -14,7 +14,7 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) * @param pmcProfile Player profile * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader diff --git a/types/helpers/BotDifficultyHelper.d.ts b/types/helpers/BotDifficultyHelper.d.ts index bb20955..84beba3 100644 --- a/types/helpers/BotDifficultyHelper.d.ts +++ b/types/helpers/BotDifficultyHelper.d.ts @@ -1,12 +1,12 @@ -import { Difficulty } from "../models/eft/common/tables/IBotType"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { BotHelper } from "./BotHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotDifficultyHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; diff --git a/types/helpers/BotGeneratorHelper.d.ts b/types/helpers/BotGeneratorHelper.d.ts index 81750bd..7f7555b 100644 --- a/types/helpers/BotGeneratorHelper.d.ts +++ b/types/helpers/BotGeneratorHelper.d.ts @@ -1,28 +1,34 @@ -import { ApplicationContext } from "../context/ApplicationContext"; -import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "../models/spt/config/IBotConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { ItemHelper } from "./ItemHelper"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; +import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult"; +import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult"; +import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGeneratorHelper { protected logger: ILogger; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; protected applicationContext: ApplicationContext; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected pmcConfig: IPmcConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -62,32 +68,36 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; + isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult; /** * Can item be added to another item without conflict - * @param items Items to check compatibilities with + * @param itemsEquipped Items to check compatibilities with * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into * @returns false if no incompatibilities, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { - incompatible: boolean; - reason: string; - }; + isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert * @returns Equipment role (e.g. pmc / assault / bossTagilla) */ getBotEquipmentRole(botRole: string): string; -} -/** TODO - move into own class */ -export declare class ExhaustableArray { - private itemPool; - private randomUtil; - private jsonUtil; - private pool; - constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; + /** + * Adds an item with all its children into specified equipmentSlots, wherever it fits. + * @param equipmentSlots Slot to add item+children into + * @param rootItemId Root item id to use as mod items parentid + * @param rootItemTplId Root itms tpl id + * @param itemWithChildren Item to add + * @param inventory Inventory to add item+children into + * @returns ItemAddedResult result object + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; + /** + * Is the provided item allowed inside a container + * @param slotGrid Items sub-grid we want to place item inside + * @param itemTpl Item tpl being placed + * @returns True if allowed + */ + protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean; } diff --git a/types/helpers/BotHelper.d.ts b/types/helpers/BotHelper.d.ts index 3bbdcb1..1026070 100644 --- a/types/helpers/BotHelper.d.ts +++ b/types/helpers/BotHelper.d.ts @@ -1,13 +1,13 @@ -import { MinMax } from "../models/common/MinMax"; -import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; -import { IPmcConfig } from "../models/spt/config/IPmcConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { Difficulty, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; diff --git a/types/helpers/BotWeaponGeneratorHelper.d.ts b/types/helpers/BotWeaponGeneratorHelper.d.ts index bc31d49..e38bebc 100644 --- a/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,29 +1,26 @@ -import { Inventory } from "../models/eft/common/tables/IBotBase"; -import { GenerationData } from "../models/eft/common/tables/IBotType"; -import { Item } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { ItemAddedResult } from "../models/enums/ItemAddedResult"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; -import { ItemHelper } from "./ItemHelper"; -import { WeightedRandomHelper } from "./WeightedRandomHelper"; +import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotWeaponGeneratorHelper { protected logger: ILogger; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; - protected inventoryHelper: InventoryHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected botGeneratorHelper: BotGeneratorHelper; protected localisationService: LocalisationService; - protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService); /** * Get a randomized number of bullets for a specific magazine * @param magCounts Weights of magazines @@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper { * @returns tpl of magazine */ getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - /** - * TODO - move into BotGeneratorHelper, this is not the class for it - * Adds an item with all its children into specified equipmentSlots, wherever it fits. - * @param equipmentSlots Slot to add item+children into - * @param parentId - * @param parentTpl - * @param itemWithChildren Item to add - * @param inventory Inventory to add item+children into - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; - /** - * is the provided item allowed inside a container - * @param slot location item wants to be placed in - * @param itemTpl item being placed - * @returns true if allowed - */ - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } diff --git a/types/helpers/ContainerHelper.d.ts b/types/helpers/ContainerHelper.d.ts index 125fbcb..37aef05 100644 --- a/types/helpers/ContainerHelper.d.ts +++ b/types/helpers/ContainerHelper.d.ts @@ -28,13 +28,12 @@ export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; /** * Find a free slot for an item to be placed at - * @param container2D Container to palce item in + * @param container2D Container to place item in * @param x Container x size * @param y Container y size * @param itemW Items width * @param itemH Items height * @param rotate is item rotated - * @returns Location to place item */ - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void; } diff --git a/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts b/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts new file mode 100644 index 0000000..cca1fb3 --- /dev/null +++ b/types/helpers/Dialogue/Commando/ICommandoCommand.d.ts @@ -0,0 +1,8 @@ +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +export interface ICommandoCommand { + getCommandPrefix(): string; + getCommandHelp(command: string): string; + getCommands(): Set; + handle(command: string, commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts b/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts new file mode 100644 index 0000000..62fb63e --- /dev/null +++ b/types/helpers/Dialogue/Commando/SptCommandoCommands.d.ts @@ -0,0 +1,15 @@ +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +export declare class SptCommandoCommands implements ICommandoCommand { + protected configServer: ConfigServer; + protected sptCommands: ISptCommand[]; + constructor(configServer: ConfigServer, sptCommands: ISptCommand[]); + registerSptCommandoCommand(command: ISptCommand): void; + getCommandHelp(command: string): string; + getCommandPrefix(): string; + getCommands(): Set; + handle(command: string, commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts b/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts new file mode 100644 index 0000000..33d05de --- /dev/null +++ b/types/helpers/Dialogue/Commando/SptCommands/GiveSptCommand.d.ts @@ -0,0 +1,21 @@ +import { ISptCommand } from "@spt-aki/helpers/Dialogue/Commando/SptCommands/ISptCommand"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class GiveSptCommand implements ISptCommand { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected presetHelper: PresetHelper; + protected mailSendService: MailSendService; + constructor(logger: ILogger, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, presetHelper: PresetHelper, mailSendService: MailSendService); + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/Dialogue/Commando/SptCommands/ISptCommand.d.ts b/types/helpers/Dialogue/Commando/SptCommands/ISptCommand.d.ts new file mode 100644 index 0000000..33732c7 --- /dev/null +++ b/types/helpers/Dialogue/Commando/SptCommands/ISptCommand.d.ts @@ -0,0 +1,7 @@ +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +export interface ISptCommand { + getCommand(): string; + getCommandHelp(): string; + performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts b/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts new file mode 100644 index 0000000..e1213a2 --- /dev/null +++ b/types/helpers/Dialogue/CommandoDialogueChatBot.d.ts @@ -0,0 +1,15 @@ +import { ICommandoCommand } from "@spt-aki/helpers/Dialogue/Commando/ICommandoCommand"; +import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +export declare class CommandoDialogueChatBot implements IDialogueChatBot { + protected logger: ILogger; + protected mailSendService: MailSendService; + protected commandoCommands: ICommandoCommand[]; + constructor(logger: ILogger, mailSendService: MailSendService, commandoCommands: ICommandoCommand[]); + registerCommandoCommand(commandoCommand: ICommandoCommand): void; + getChatBot(): IUserDialogInfo; + handleMessage(sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/Dialogue/IDialogueChatBot.d.ts b/types/helpers/Dialogue/IDialogueChatBot.d.ts new file mode 100644 index 0000000..b585d55 --- /dev/null +++ b/types/helpers/Dialogue/IDialogueChatBot.d.ts @@ -0,0 +1,6 @@ +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +export interface IDialogueChatBot { + getChatBot(): IUserDialogInfo; + handleMessage(sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/Dialogue/SptDialogueChatBot.d.ts b/types/helpers/Dialogue/SptDialogueChatBot.d.ts new file mode 100644 index 0000000..f858ab8 --- /dev/null +++ b/types/helpers/Dialogue/SptDialogueChatBot.d.ts @@ -0,0 +1,27 @@ +import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { GiftService } from "@spt-aki/services/GiftService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class SptDialogueChatBot implements IDialogueChatBot { + protected profileHelper: ProfileHelper; + protected randomUtil: RandomUtil; + protected mailSendService: MailSendService; + protected giftService: GiftService; + protected configServer: ConfigServer; + protected coreConfig: ICoreConfig; + protected weatherConfig: IWeatherConfig; + constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer); + getChatBot(): IUserDialogInfo; + /** + * Send responses back to player when they communicate with SPT friend on friends list + * @param sessionId Session Id + * @param request send message request + */ + handleMessage(sessionId: string, request: ISendMessageRequest): string; +} diff --git a/types/helpers/DialogueHelper.d.ts b/types/helpers/DialogueHelper.d.ts index ea3bae7..2ad4536 100644 --- a/types/helpers/DialogueHelper.d.ts +++ b/types/helpers/DialogueHelper.d.ts @@ -1,14 +1,13 @@ -import { Item } from "../models/eft/common/tables/IItem"; -import { Dialogue, MessageContent, MessagePreview } from "../models/eft/profile/IAkiProfile"; -import { MessageType } from "../models/enums/MessageType"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { ItemHelper } from "./ItemHelper"; -import { NotificationSendHelper } from "./NotificationSendHelper"; -import { NotifierHelper } from "./NotifierHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; +import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; export declare class DialogueHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,14 +18,6 @@ export declare class DialogueHelper { protected localisationService: LocalisationService; protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; - /** - * @deprecated Use MailSendService.sendMessage() or helpers - */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue diff --git a/types/helpers/DurabilityLimitsHelper.d.ts b/types/helpers/DurabilityLimitsHelper.d.ts index 671559f..efccdf5 100644 --- a/types/helpers/DurabilityLimitsHelper.d.ts +++ b/types/helpers/DurabilityLimitsHelper.d.ts @@ -1,8 +1,8 @@ -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { BotHelper } from "./BotHelper"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class DurabilityLimitsHelper { protected randomUtil: RandomUtil; protected botHelper: BotHelper; diff --git a/types/helpers/GameEventHelper.d.ts b/types/helpers/GameEventHelper.d.ts index f502c95..555cda2 100644 --- a/types/helpers/GameEventHelper.d.ts +++ b/types/helpers/GameEventHelper.d.ts @@ -1,6 +1,6 @@ -import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; +import { ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; protected configServer: ConfigServer; diff --git a/types/helpers/HandbookHelper.d.ts b/types/helpers/HandbookHelper.d.ts index 856c23a..c6311e0 100644 --- a/types/helpers/HandbookHelper.d.ts +++ b/types/helpers/HandbookHelper.d.ts @@ -1,4 +1,9 @@ -import { DatabaseServer } from "../servers/DatabaseServer"; +import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; declare class LookupItem { readonly byId: Map; readonly byParent: Map; @@ -11,9 +16,12 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected itemConfig: IItemConfig; protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; - constructor(databaseServer: DatabaseServer); + constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class */ @@ -25,6 +33,7 @@ export declare class HandbookHelper { * @returns price in roubles */ getTemplatePrice(tpl: string): number; + getTemplatePriceForItems(items: Item[]): number; /** * Get all items in template with the given parent category * @param parentId @@ -57,5 +66,6 @@ export declare class HandbookHelper { * @returns currency count in desired type */ fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; + getCategoryById(handbookId: string): Category; } export {}; diff --git a/types/helpers/HealthHelper.d.ts b/types/helpers/HealthHelper.d.ts index e4cdcd6..6aae71f 100644 --- a/types/helpers/HealthHelper.d.ts +++ b/types/helpers/HealthHelper.d.ts @@ -1,12 +1,12 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; -import { Effects, IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { IHealthConfig } from "../models/spt/config/IHealthConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { SaveServer } from "../servers/SaveServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ISyncHealthRequestData } from "@spt-aki/models/eft/health/ISyncHealthRequestData"; +import { Effects, IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IHealthConfig } from "@spt-aki/models/spt/config/IHealthConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HealthHelper { protected jsonUtil: JsonUtil; protected logger: ILogger; diff --git a/types/helpers/HideoutHelper.d.ts b/types/helpers/HideoutHelper.d.ts index 80ac27c..282b2f0 100644 --- a/types/helpers/HideoutHelper.d.ts +++ b/types/helpers/HideoutHelper.d.ts @@ -1,25 +1,27 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Common, HideoutArea, IHideoutImprovement, Production, Productive } from "../models/eft/common/tables/IBotBase"; -import { Upd } from "../models/eft/common/tables/IItem"; -import { StageBonus } from "../models/eft/hideout/IHideoutArea"; -import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hideout/IHideoutContinuousProductionStartRequestData"; -import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; -import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData"; -import { IHideoutTakeProductionRequestData } from "../models/eft/hideout/IHideoutTakeProductionRequestData"; -import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { PlayerService } from "../services/PlayerService"; -import { HashUtil } from "../utils/HashUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { InventoryHelper } from "./InventoryHelper"; -import { ProfileHelper } from "./ProfileHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; +import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; +import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; +import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; +import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PlayerService } from "@spt-aki/services/PlayerService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HideoutHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -31,14 +33,17 @@ export declare class HideoutHelper { protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; + protected itemHelper: ItemHelper; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; static bitcoinFarm: string; + static bitcoinProductionId: string; static waterCollector: string; - static bitcoin: string; + static bitcoinTpl: string; static expeditionaryFuelTank: string; static maxSkillPoint: number; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil); /** * Add production to profiles' Hideout.Production array * @param pmcData Profile to add production to @@ -80,6 +85,16 @@ export declare class HideoutHelper { waterCollectorHasFilter: boolean; }; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; /** * Update progress timer for water collector * @param pmcData profile to update @@ -91,16 +106,6 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - /** - * Iterate over productions and update their progress timers - * @param pmcData Profile to check for productions and update - * @param hideoutProperties Hideout properties - */ - protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { - btcFarmCGs: number; - isGeneratorOn: boolean; - waterCollectorHasFilter: boolean; - }): void; /** * Update a productions progress value based on the amount of time that has passed * @param pmcData Player profile @@ -138,17 +143,34 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; + /** + * Decrease fuel from generator slots based on amount of time since last time this occured + * @param generatorArea Hideout area + * @param pmcData Player profile + * @param isGeneratorOn Is the generator turned on since last update + */ + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Get craft time and make adjustments to account for dev profile + crafting skill level + * @param pmcData Player profile making craft + * @param recipeId Recipe being crafted + * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation + * @returns Items craft time with bonuses subtracted + */ + protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update * @param production production object * @param isGeneratorOn is generator enabled * @param pmcData Player profile - * @returns Updated HideoutArea object */ - protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void; /** * Get an adjusted water filter drain rate based on time elapsed since last run, * handle edge case when craft time has gone on longer than total production time @@ -156,9 +178,9 @@ export declare class HideoutHelper { * @param totalProductionTime Total time collecting water * @param productionProgress how far water collector has progressed * @param baseFilterDrainRate Base drain rate - * @returns + * @returns drain rate (adjusted) */ - protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; + protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -178,8 +200,8 @@ export declare class HideoutHelper { * @param resourceUnitsConsumed * @returns Upd */ - protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; + protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; /** * Add bitcoin object to btc production products array and set progress time @@ -196,27 +218,15 @@ export declare class HideoutHelper { */ protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** - * Get a count of how many BTC can be gathered by the profile + * Get a count of how many possible BTC can be gathered by the profile * @param pmcData Profile to look up - * @returns coin slot count + * @returns Coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; /** - * Does profile have elite hideout management skill - * @param pmcData Profile to look at - * @returns True if profile has skill + * Get a count of how many additional bitcoins player hideout can hold with elite skill */ - protected hasEliteHideoutManagementSkill(pmcData: IPmcData): boolean; - /** - * Get a count of bitcoins player miner can hold - */ - protected getBitcoinMinerContainerSlotSize(): number; - /** - * Get the hideout management skill from player profile - * @param pmcData Profile to look at - * @returns Hideout management skill object - */ - protected getHideoutManagementSkill(pmcData: IPmcData): Common; + protected getEliteSkillAdditionalBitcoinSlotCount(): number; /** * HideoutManagement skill gives a consumption bonus the higher the level * 0.5% per level per 1-51, (25.5% at max) @@ -225,12 +235,21 @@ export declare class HideoutHelper { */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Adjust craft time based on crafting skill level found in player profile + * Get a multipler based on players skill level and value per level + * @param pmcData Player profile + * @param skill Player skill from profile + * @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel` + * @returns Multipler from 0 to 1 + */ + protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number; + /** * @param pmcData Player profile * @param productionTime Time to complete hideout craft in seconds - * @returns Adjusted craft time in seconds + * @param skill Skill bonus to get reduction from + * @param amountPerLevel Skill bonus amount to apply + * @returns Seconds to reduce craft time by */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; + getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number; isProduction(productive: Productive): productive is Production; /** * Gather crafted BTC from hideout area and add to inventory @@ -238,15 +257,9 @@ export declare class HideoutHelper { * @param pmcData Player profile * @param request Take production request * @param sessionId Session id - * @returns IItemEventRouterResponse + * @param output Output object to update */ - getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse; - /** - * Create a single bitcoin request object - * @param pmcData Player profile - * @returns IAddItemRequestData - */ - protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; + getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void; /** * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in @@ -263,4 +276,17 @@ export declare class HideoutHelper { * @param pmcProfile Profile to adjust */ setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void; + /** + * Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + * @param pmcData Player profile + */ + applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void; + /** + * Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + * Reverse engineered from client code + * @param pmcData Player profile + * @param activeDogtags Active dogtags in place of fame dogtag slots + * @returns combat bonus + */ + protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number; } diff --git a/types/helpers/HttpServerHelper.d.ts b/types/helpers/HttpServerHelper.d.ts index b05cbdf..d67b4ec 100644 --- a/types/helpers/HttpServerHelper.d.ts +++ b/types/helpers/HttpServerHelper.d.ts @@ -1,5 +1,5 @@ -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ConfigServer } from "../servers/ConfigServer"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class HttpServerHelper { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; diff --git a/types/helpers/InRaidHelper.d.ts b/types/helpers/InRaidHelper.d.ts index b4c0c1c..a72c598 100644 --- a/types/helpers/InRaidHelper.d.ts +++ b/types/helpers/InRaidHelper.d.ts @@ -1,35 +1,41 @@ -import { IPmcData, IPostRaidPmcData } from "../models/eft/common/IPmcData"; -import { IQuestStatus, TraderInfo, Victim } from "../models/eft/common/tables/IBotBase"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ILostOnDeathConfig } from "../models/spt/config/ILostOnDeathConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { ProfileFixerService } from "../services/ProfileFixerService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { InventoryHelper } from "./InventoryHelper"; -import { ItemHelper } from "./ItemHelper"; -import { PaymentHelper } from "./PaymentHelper"; -import { QuestHelper } from "./QuestHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { QuestHelper } from "@spt-aki/helpers/QuestHelper"; +import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; +import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +import { ProfileHelper } from "./ProfileHelper"; export declare class InRaidHelper { protected logger: ILogger; + protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; + protected profileHelper: ProfileHelper; protected questHelper: QuestHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; + protected randomUtil: RandomUtil; protected lostOnDeathConfig: ILostOnDeathConfig; protected inRaidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory @@ -41,39 +47,45 @@ export declare class InRaidHelper { * @param items Items array to check */ addUpdToMoneyFromRaid(items: Item[]): void; - /** - * Add karma changes up and return the new value - * @param existingFenceStanding Current fence standing level - * @param victims Array of kills player performed - * @returns adjusted karma level after kills are taken into account - */ - calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number; - /** - * Get the standing gain/loss for killing an npc - * @param victim Who was killed by player - * @returns a numerical standing gain or loss - */ - protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property * Increment exp - * Remove Labs keycard * @param profileData Profile to update * @param saveProgressRequest post raid save data request data * @param sessionID Session id * @returns Reset profile object */ - updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): void; /** - * Look for quests not are now status = fail that were not failed pre-raid and run the failQuest() function + * Reset the skill points earned in a raid to 0, ready for next raid + * @param profile Profile to update + */ + protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; + /** Check counters are correct in profile */ + protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + /** + * Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic + * @param pmcData Server PMC profile + * @param saveProgressRequest Post-raid request data + * @param sessionId Session id + */ + updatePmcProfileDataPostRaid(pmcData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionId: string): void; + /** + * Update scav quest values on server profile with updated values post-raid + * @param scavData Server scav profile + * @param saveProgressRequest Post-raid request data + * @param sessionId Session id + */ + updateScavProfileDataPostRaid(scavData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionId: string): void; + /** + * Look for quests with a status different from what it began the raid with * @param sessionId Player id * @param pmcData Player profile * @param preRaidQuests Quests prior to starting raid - * @param postRaidQuests Quest after raid + * @param postRaidProfile Profile sent by client with post-raid quests */ - protected processFailedQuests(sessionId: string, pmcData: IPmcData, preRaidQuests: IQuestStatus[], postRaidQuests: IQuestStatus[]): void; - protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; + protected processAlteredQuests(sessionId: string, pmcData: IPmcData, preRaidQuests: IQuestStatus[], postRaidProfile: IPostRaidPmcData): void; /** * Take body part effects from client profile and apply to server profile * @param saveProgressRequest post-raid request @@ -87,12 +99,11 @@ export declare class InRaidHelper { */ protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void; /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id @@ -111,18 +122,17 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void; /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - deleteInventory(pmcData: IPmcData, sessionID: string): void; + deleteInventory(pmcData: IPmcData, sessionId: string): void; /** * Get an array of items from a profile that will be lost on death * @param pmcProfile Profile to get items from diff --git a/types/helpers/InventoryHelper.d.ts b/types/helpers/InventoryHelper.d.ts index f71b361..47a98bf 100644 --- a/types/helpers/InventoryHelper.d.ts +++ b/types/helpers/InventoryHelper.d.ts @@ -1,29 +1,33 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Inventory } from "../models/eft/common/tables/IBotBase"; -import { Item } from "../models/eft/common/tables/IItem"; -import { AddItem, IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; -import { IAddItemTempObject } from "../models/eft/inventory/IAddItemTempObject"; -import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMergeRequestData"; -import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; -import { IInventoryRemoveRequestData } from "../models/eft/inventory/IInventoryRemoveRequestData"; -import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { ContainerHelper } from "./ContainerHelper"; -import { DialogueHelper } from "./DialogueHelper"; -import { ItemHelper } from "./ItemHelper"; -import { PaymentHelper } from "./PaymentHelper"; -import { ProfileHelper } from "./ProfileHelper"; -import { TraderAssortHelper } from "./TraderAssortHelper"; -export interface OwnerInventoryItems { +import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest"; +import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData"; +import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject"; +import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest"; +import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; +import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; +import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; +import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export interface IOwnerInventoryItems { /** Inventory items from source */ from: Item[]; /** Inventory items at destination */ @@ -44,54 +48,84 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected presetHelper: PresetHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory) - * @param pmcData Profile to add items to - * @param request request data to add items - * @param output response to send back to client - * @param sessionID Session id - * @param callback Code to execute later (function) - * @param foundInRaid Will results added to inventory be set as found in raid - * @param addUpd Additional upd properties for items being added to inventory - * @param useSortingTable Allow items to go into sorting table when stash has no space - * @returns IItemEventRouterResponse - */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; - /** - * Take the given item, find a free slot in passed in inventory and place it there - * If no space in inventory, place in sorting table - * @param itemToAdd Item to add to inventory - * @param stashFS2D Two dimentional stash map - * @param sortingTableFS2D Two dimentional sorting table stash map - * @param itemLib + * Add multiple items to player stash (assuming they all fit) + * @param sessionId Session id + * @param request IAddItemsDirectRequest request * @param pmcData Player profile - * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item - * @param output Client output object - * @returns Client error output if placing item failed + * @param output Client response object */ - protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; + addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * Add ammo to ammo boxes - * @param itemToAdd Item to check is ammo box - * @param parentId Ammo box parent id - * @param output IItemEventRouterResponse object - * @param sessionID Session id - * @param pmcData Profile to add ammobox to - * @param output object to send to client - * @param foundInRaid should ammo be FiR + * Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits) + * @param sessionId Session id + * @param request addItemDirect request + * @param pmcData Player profile + * @param output Client response object */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; + addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void; /** - * + * Set FiR status for an item + its children + * @param itemWithChildren An item + * @param foundInRaid Item was found in raid + */ + protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void; + /** + * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player + * @param upd Object to update + */ + protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void; + /** + * Can all probided items be added into player inventory + * @param sessionId Player id + * @param itemsWithChildren array of items with children to try and fit + * @returns True all items fit + */ + canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean; + /** + * Do the provided items all fit into the grid + * @param containerFS2D Container grid to fit items into + * @param itemsWithChildren items to try and fit into grid + * @returns True all fit + */ + canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean; + /** + * Does an item fit into a container grid + * @param containerFS2D Container grid + * @param itemWithChildren item to check fits + * @returns True it fits + */ + canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean; + /** + * Find a free location inside a container to fit the item + * @param containerFS2D Container grid to add item to + * @param itemWithChildren Item to add to grid + * @param containerId Id of the container we're fitting item into + * @param desiredSlotId slot id value to use, default is "hideout" + */ + placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void; + /** + * Find a location to place an item into inventory and place it + * @param stashFS2D 2-dimensional representation of the container slots + * @param sortingTableFS2D 2-dimensional representation of the sorting table slots + * @param itemWithChildren Item to place + * @param playerInventory + * @param useSortingTable Should sorting table to be used if main stash has no space + * @param output output to send back to client + */ + protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void; + /** + * Split an items stack size based on its StackMaxSize value * @param assortItems Items to add to inventory * @param requestItem Details of purchased item to add to inventory - * @param result Array split stacks are added to + * @param result Array split stacks are appended to */ - protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; + protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** * Handle Remove event * Remove item from player inventory + insured items array @@ -99,16 +133,51 @@ export declare class InventoryHelper { * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id - * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void; + /** + * Delete desired item from a player profiles mail + * @param sessionId Session id + * @param removeRequest Remove request + * @param output OPTIONAL - IItemEventRouterResponse + */ + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void; + /** + * Find item by id in player inventory and remove x of its count + * @param pmcData player profile + * @param itemId Item id to decrement StackObjectsCount of + * @param countToRemove Number of item to remove + * @param sessionID Session id + * @param output IItemEventRouterResponse * @returns IItemEventRouterResponse */ - removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; - removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; - getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; + removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the height and width of an item - can have children that alter size + * @param itemTpl Item to get size of + * @param itemID Items id to get size of + * @param inventoryItems + * @returns [width, height] + */ + getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; + /** + * Get a blank two-dimentional representation of a container + * @param containerH Horizontal size of container + * @param containerY Vertical size of container + * @returns Two-dimensional representation of container + */ + protected getBlankContainerMap(containerH: number, containerY: number): number[][]; + /** + * @param containerH Horizontal size of container + * @param containerV Vertical size of container + * @param itemList + * @param containerId Id of the container + * @returns Two-dimensional representation of container + */ + getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; - getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** * Return the inventory that needs to be modified (scav/pmc etc) * Changes made to result apply to character inventory @@ -117,19 +186,31 @@ export declare class InventoryHelper { * @param sessionId Session id / playerid * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems; /** - * Made a 2d array table with 0 - free slot and 1 - used slot - * @param {Object} pmcData - * @param {string} sessionID - * @returns Array + * Get a two dimensional array to represent stash slots + * 0 value = free, 1 = taken + * @param pmcData Player profile + * @param sessionID session id + * @returns 2-dimensional array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; + /** + * Get a blank two-dimensional array representation of a container + * @param containerTpl Container to get data for + * @returns blank two-dimensional array + */ + getContainerSlotMap(containerTpl: string): number[][]; + /** + * Get a two-dimensional array representation of the players sorting table + * @param pmcData Player profile + * @returns two-dimensional array + */ protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; /** - * Get Player Stash Proper Size - * @param sessionID Playerid - * @returns Array of 2 values, x and y stash size + * Get Players Stash Size + * @param sessionID Players id + * @returns Array of 2 values, horizontal and vertical stash size */ protected getPlayerStashSize(sessionID: string): Record; /** @@ -163,8 +244,8 @@ export declare class InventoryHelper { */ protected updateFastPanelBinding(pmcData: IPmcData, itemBeingMoved: Item): void; /** - * Internal helper function to handle cartridges in inventory if any of them exist. - */ + * Internal helper function to handle cartridges in inventory if any of them exist. + */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; /** * Get details for how a random loot container should be handled, max rewards, possible reward tpls @@ -173,6 +254,15 @@ export declare class InventoryHelper { */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; getInventoryConfig(): IInventoryConfig; + /** + * Recursively checks if the given item is + * inside the stash, that is it has the stash as + * ancestor with slotId=hideout + * @param pmcData Player profile + * @param itemToCheck Item to look for + * @returns True if item exists inside stash + */ + isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/types/helpers/ItemHelper.d.ts b/types/helpers/ItemHelper.d.ts index f58ca4d..3e91ef7 100644 --- a/types/helpers/ItemHelper.d.ts +++ b/types/helpers/ItemHelper.d.ts @@ -1,20 +1,21 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { InsuredItem } from "../models/eft/common/tables/IBotBase"; -import { Item, Repairable } from "../models/eft/common/tables/IItem"; -import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; -import { LocaleService } from "../services/LocaleService"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; -import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; -import { HandbookHelper } from "./HandbookHelper"; -declare class ItemHelper { +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { InsuredItem } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ObjectId } from "@spt-aki/utils/ObjectId"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; @@ -24,14 +25,15 @@ declare class ItemHelper { protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemBaseClassService: ItemBaseClassService; + protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected localeService: LocaleService; protected readonly defaultInvalidBaseTypes: string[]; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash - * @param {string} tpl the template id / tpl - * @returns boolean; true for items that may be in player possession and not quest items + * @param {string} tpl the template id / tpl + * @returns boolean; true for items that may be in player possession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; /** @@ -49,6 +51,44 @@ declare class ItemHelper { * @returns true if any supplied base classes match */ isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; + /** + * Does the provided item have the chance to require soft armor inserts + * Only applies to helmets/vest/armors. + * Not all head gear needs them + * @param itemTpl item to check + * @returns Does item have the possibility ot need soft inserts + */ + armorItemCanHoldMods(itemTpl: string): boolean; + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean; + /** + * Does the pased in tpl have ability to hold removable plate items + * @param itemTpl item tpl to check for plate support + * @returns True when armor can hold plates + */ + armorItemHasRemovablePlateSlots(itemTpl: string): boolean; + /** + * Does the provided item tpl require soft inserts to become a valid armor item + * @param itemTpl Item tpl to check + * @returns True if it needs armor inserts + */ + itemRequiresSoftInserts(itemTpl: string): boolean; + /** + * Get all soft insert slot ids + * @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top) + */ + getSoftInsertSlotIds(): string[]; + /** + * Returns the items total price based on the handbook or as a fallback from the prices.json if the item is not + * found in the handbook. If the price can't be found at all return 0 + * @param tpls item tpls to look up the price of + * @returns Total price in roubles + */ + getItemAndChildrenPrice(tpls: string[]): number; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -81,43 +121,6 @@ declare class ItemHelper { * @returns Fixed item */ fixItemStackCount(item: Item): Item; - /** - * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. - * Here's what a filled AmmoBox looks like: - * { - * "_id": "b1bbe982daa00ac841d4ae4d", - * "_tpl": "57372c89245977685d4159b1", - * "parentId": "5fe49a0e2694b0755a504876", - * "slotId": "hideout", - * "location": { - * "x": 3, - * "y": 4, - * "r": 0 - * }, - * "upd": { - * "StackObjectsCount": 1 - * } - * }, - * { - * "_id": "b997b4117199033afd274a06", - * "_tpl": "56dff061d2720bb5668b4567", - * "parentId": "b1bbe982daa00ac841d4ae4d", - * "slotId": "cartridges", - * "location": 0, - * "upd": { - * "StackObjectsCount": 30 - * } - * } - * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. - * StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic - * to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one - * StackSlot, this function takes account of this and creates and returns an array of StackSlotItems - * - * @param {object} item The item template of the AmmoBox as given in items.json - * @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of - * @returns {array} The array of StackSlotItems - */ - generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; /** * Get cloned copy of all item data from items.json * @returns array of ITemplateItem objects @@ -129,7 +132,14 @@ declare class ItemHelper { * @returns bool - is valid + template item object as array */ getItem(tpl: string): [boolean, ITemplateItem]; + itemHasSlots(itemTpl: string): boolean; isItemInDb(tpl: string): boolean; + /** + * Calcualte the average quality of an item and its children + * @param items An offers item to process + * @returns % quality modifer between 0 and 1 + */ + getItemQualityModifierForOfferItems(items: Item[]): number; /** * get normalized value (0-1) based on item condition * @param item @@ -147,17 +157,18 @@ declare class ItemHelper { /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results * @param items Array of items (item + possible children) - * @param itemId Parent items id + * @param baseItemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; + findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. - * @param items - * @param baseItemId + * @param items Array of items (item + possible children) + * @param baseItemId Parent items id + * @param modsOnly Include only mod items, exclude items stored inside root item * @returns An array of Item objects */ - findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[]; + findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[]; /** * Find children of the item in a given assort (weapons parts for example, need recursive loop function) * @param itemIdToFind Template id of item to check for @@ -190,28 +201,42 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its items StackMaxSize property + * Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent * @param itemToSplit Item to split into smaller stacks - * @returns Array of split items + * @returns Array of root item + children */ splitStack(itemToSplit: Item): Item[]; + /** + * Turn items like money into separate stacks that adhere to max stack size + * @param itemToSplit Item to split into smaller stacks + * @returns + */ + splitStackIntoSeparateItems(itemToSplit: Item): Item[][]; /** * Find Barter items from array of items * @param {string} by tpl or id - * @param {Item[]} items Array of items to iterate over - * @param {string} barterItemId + * @param {Item[]} itemsToSearch Array of items to iterate over + * @param {string} desiredBarterItemIds * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[]; /** - * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This + * function will not mutate the original items array, but will return a new array with new GUIDs. + * + * @param originalItems Items to adjust the IDs of * @param pmcData Player profile - * @param items Items to adjust ID values of - * @param insuredItems insured items to not replace ids for - * @param fastPanel + * @param insuredItems Insured items that should not have their IDs replaced + * @param fastPanel Quick slot panel * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; + replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[]; + /** + * Mark the passed in array of items as found in raid. + * Modifies passed in items + * @param items The list of items to mark as FiR + */ + setFoundInRaid(items: Item[]): void; /** * WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl Items tpl to check parents of @@ -225,6 +250,58 @@ declare class ItemHelper { * @returns true if item is flagged as quest item */ isQuestItem(tpl: string): boolean; + /** + * Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the + * parent items existence in the database, the existence (and value) of the items RaidModdable property, and that + * the parents slot-required property exists, matches that of the item, and it's value. + * + * Note: this function does not preform any checks to see if the item and parent are *actually* related. + * + * @param item The item to be checked + * @param parent The parent of the item to be checked + * @returns True if the item is actually moddable, false if it is not, and null if the check cannot be performed. + */ + isRaidModdable(item: Item, parent: Item): boolean | null; + /** + * Retrieves the main parent item for a given attachment item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent + * item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it + * will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately + * attached to, even if that gun is located within multiple containers. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the main parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists. + */ + getAttachmentMainParent(itemId: string, itemsMap: Map): Item | null; + /** + * Determines if an item is an attachment that is currently attached to it's parent item. + * + * @param item The item to check. + * @returns true if the item is attached attachment, otherwise false. + */ + isAttachmentAttached(item: Item): boolean; + /** + * Retrieves the equipment parent item for a given item. + * + * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment + * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, + * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. + * + * It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items + * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates + * some of the performance concerns, as it allows for quick lookups of items by ID. + * + * @param itemId - The unique identifier of the item for which to find the equipment parent. + * @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. + * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. + */ + getEquipmentParent(itemId: string, itemsMap: Map): Item | null; /** * Get the inventory size of an item * @param items Item with children @@ -237,13 +314,19 @@ declare class ItemHelper { * @param item Db item template to look up Cartridge filter values from * @returns Caliber of cartridge */ - getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null; /** * Add cartridges to the ammo box with correct max stack sizes * @param ammoBox Box to add cartridges to * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Add a single stack of cartridges to the ammo box + * @param ammoBox Box to add cartridges to + * @param ammoBoxDetails Item template from items db + */ + addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; /** * Check if item is stored inside of a container * @param item Item to check is inside of container @@ -259,16 +342,17 @@ declare class ItemHelper { * @param staticAmmoDist Cartridge distribution * @param caliber Caliber of cartridge to add to magazine * @param minSizePercent % the magazine must be filled to + * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) */ - fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number): void; + fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void; /** * Add child items to a magazine of a specific cartridge - * @param magazine Magazine to add child items to + * @param magazineWithChildCartridges Magazine to add child items to * @param magTemplate Db template of magazine * @param cartridgeTpl Cartridge to add to magazine * @param minSizePercent % the magazine must be filled to */ - fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; /** * Choose a random bullet type from the list of possible a magazine has * @param magTemplate Magazine template from Db @@ -279,18 +363,20 @@ declare class ItemHelper { * Chose a randomly weighted cartridge that fits * @param caliber Desired caliber * @param staticAmmoDist Cartridges and thier weights - * @returns Tpl of cartrdige + * @param cartridgeWhitelist OPTIONAL whitelist for cartridges + * @returns Tpl of cartridge */ - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record, cartridgeWhitelist?: string[]): string; /** * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent * @param location Location inside parent (e.g. 0, 1) + * @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession) * @returns Item */ - createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item; + createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item; /** * Get the size of a stack, return 1 if no stack object count property found * @param item Item to get stack size of @@ -303,6 +389,72 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; + /** + * Add child slot items to an item, chooses random child item if multiple choices exist + * @param itemToAdd array with single object (root item) + * @param itemToAddTemplate Db tempalte for root item + * @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100) + * @param requiredOnly Only add required mods + * @returns Item with children + */ + addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record, requiredOnly?: boolean): Item[]; + /** + * Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + * @param possibleTpls Tpls to randomply choose from + * @param incompatibleModTpls Incompatible tpls to not allow + * @returns Chosen tpl or null + */ + getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set): string; + /** + * Is the provided item._props.Slots._name property a plate slot + * @param slotName Name of slot (_name) of Items Slot array + * @returns True if its a slot that holds a removable palte + */ + isRemovablePlateSlot(slotName: string): boolean; + /** + * Get a list of slot names that hold removable plates + * @returns Array of slot ids (e.g. front_plate) + */ + getRemovablePlateSlotIds(): string[]; + /** + * Generate new unique ids for child items while preserving hierarchy + * @param rootItem Base/primary item + * @param itemWithChildren Primary item + children of primary item + * @returns Item array with updated IDs + */ + reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[]; + /** + * Update a root items _id property value to be unique + * @param itemWithChildren Item to update root items _id property + * @param newId Optional: new id to use + * @returns New root id + */ + remapRootItemId(itemWithChildren: Item[], newId?: string): string; + /** + * Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been + * deleted from a group of items and there are children still referencing the missing parent. This method will + * remove the reference from the children to the parent and set item properties to root values. + * + * @param rootId The ID of the "root" of the container. + * @param items Array of Items that should be adjusted. + * @returns Array of Items that have been adopted. + */ + adoptOrphanedItems(rootId: string, items: Item[]): Item[]; + /** + * Populate a Map object of items for quick lookup using their ID. + * + * @param items An array of Items that should be added to a Map. + * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects. + */ + generateItemsMap(items: Item[]): Map; + /** + * Add a blank upd object to passed in item if it does not exist already + * @param item item to add upd to + * @param warningMessageWhenMissing text to write to log when upd object was not found + * @returns True when upd object was added + */ + addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean; } declare namespace ItemHelper { interface ItemSize { @@ -310,4 +462,4 @@ declare namespace ItemHelper { height: number; } } -export { ItemHelper }; +export {}; diff --git a/types/helpers/NotificationSendHelper.d.ts b/types/helpers/NotificationSendHelper.d.ts index d206a87..5f4a533 100644 --- a/types/helpers/NotificationSendHelper.d.ts +++ b/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ -import { INotification } from "../models/eft/notifier/INotifier"; -import { Dialogue, IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; -import { MessageType } from "../models/enums/MessageType"; -import { SaveServer } from "../servers/SaveServer"; -import { WebSocketServer } from "../servers/WebSocketServer"; -import { NotificationService } from "../services/NotificationService"; -import { HashUtil } from "../utils/HashUtil"; +import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; +import { Dialogue, IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { WebSocketServer } from "@spt-aki/servers/WebSocketServer"; +import { NotificationService } from "@spt-aki/services/NotificationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; export declare class NotificationSendHelper { protected webSocketServer: WebSocketServer; protected hashUtil: HashUtil; diff --git a/types/helpers/NotifierHelper.d.ts b/types/helpers/NotifierHelper.d.ts index d824fb2..9c27224 100644 --- a/types/helpers/NotifierHelper.d.ts +++ b/types/helpers/NotifierHelper.d.ts @@ -1,6 +1,6 @@ -import { INotification } from "../models/eft/notifier/INotifier"; -import { Message, MessageContentRagfair } from "../models/eft/profile/IAkiProfile"; -import { HttpServerHelper } from "./HttpServerHelper"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; +import { Message, MessageContentRagfair } from "@spt-aki/models/eft/profile/IAkiProfile"; export declare class NotifierHelper { protected httpServerHelper: HttpServerHelper; /** diff --git a/types/helpers/PaymentHelper.d.ts b/types/helpers/PaymentHelper.d.ts index 1534f4a..04d4163 100644 --- a/types/helpers/PaymentHelper.d.ts +++ b/types/helpers/PaymentHelper.d.ts @@ -1,5 +1,5 @@ -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; -import { ConfigServer } from "../servers/ConfigServer"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class PaymentHelper { protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; @@ -11,9 +11,9 @@ export declare class PaymentHelper { */ isMoneyTpl(tpl: string): boolean; /** - * Gets currency TPL from TAG - * @param {string} currency - * @returns string - */ + * Gets currency TPL from TAG + * @param {string} currency + * @returns string + */ getCurrency(currency: string): string; } diff --git a/types/helpers/PresetHelper.d.ts b/types/helpers/PresetHelper.d.ts index e50cae8..8864999 100644 --- a/types/helpers/PresetHelper.d.ts +++ b/types/helpers/PresetHelper.d.ts @@ -1,23 +1,47 @@ -import { IPreset } from "../models/eft/common/IGlobals"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { JsonUtil } from "../utils/JsonUtil"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { ItemHelper } from "./ItemHelper"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; protected lookup: Record; - protected defaultPresets: Record; - constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); + protected defaultEquipmentPresets: Record; + protected defaultWeaponPresets: Record; + constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper); hydratePresetStore(input: Record): void; + /** + * Get default weapon and equipment presets + * @returns Dictionary + */ getDefaultPresets(): Record; + /** + * Get default weapon presets + * @returns Dictionary + */ + getDefaultWeaponPresets(): Record; + /** + * Get default equipment presets + * @returns Dictionary + */ + getDefaultEquipmentPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; + getAllPresets(): IPreset[]; getPresets(templateId: string): IPreset[]; /** - * Get the default preset for passed in weapon id - * @param templateId Weapon id to get preset for + * Get the default preset for passed in item id + * @param templateId Item id to get preset for * @returns Null if no default preset, otherwise IPreset */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; + /** + * Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists + * @param tpl The item template to get the price of + * @returns The price of the given item preset, or base item if no preset exists + */ + getDefaultPresetOrItemPrice(tpl: string): number; } diff --git a/types/helpers/ProbabilityHelper.d.ts b/types/helpers/ProbabilityHelper.d.ts index 7a0676c..8aceb67 100644 --- a/types/helpers/ProbabilityHelper.d.ts +++ b/types/helpers/ProbabilityHelper.d.ts @@ -1,5 +1,5 @@ -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class ProbabilityHelper { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/types/helpers/ProfileHelper.d.ts b/types/helpers/ProfileHelper.d.ts index 3c33ae7..182806d 100644 --- a/types/helpers/ProfileHelper.d.ts +++ b/types/helpers/ProfileHelper.d.ts @@ -1,36 +1,50 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { CounterKeyValue, Stats } from "../models/eft/common/tables/IBotBase"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { Watermark } from "../utils/Watermark"; -import { ItemHelper } from "./ItemHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer); /** * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id * @param questConditionId Quest with condition to remove */ - removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; + removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles */ getProfiles(): Record; + /** + * Get the pmc and scav profiles as an array by profile id + * @param sessionID + * @returns Array of IPmcData objects + */ getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen @@ -42,37 +56,70 @@ export declare class ProfileHelper { * @param output pmc and scav profiles array * @param pmcProfile post-raid pmc profile * @param scavProfile post-raid scav profile - * @returns updated profile array + * @returns Updated profile array */ protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; /** * Check if a nickname is used by another profile loaded by the server - * @param nicknameRequest + * @param nicknameRequest nickname request object * @param sessionID Session id * @returns True if already used */ isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean; protected profileHasInfoProperty(profile: IAkiProfile): boolean; - protected nicknameMatches(profileName: string, nicknameRequest: string): boolean; - protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean; + protected stringsMatch(stringA: string, stringB: string): boolean; /** * Add experience to a PMC inside the players profile * @param sessionID Session id * @param experienceToAdd Experience to add to PMC character */ addExperienceToPmc(sessionID: string, experienceToAdd: number): void; + /** + * Iterate all profiles and find matching pmc profile by provided id + * @param pmcId Profile id to find + * @returns IPmcData + */ getProfileByPmcId(pmcId: string): IPmcData; + /** + * Get the experiecne for the given level + * @param level level to get xp for + * @returns Number of xp points for level + */ getExperience(level: number): number; + /** + * Get the max level a player can be + * @returns Max level + */ getMaxLevel(): number; getDefaultAkiDataObject(): any; + /** + * Get full representation of a players profile json + * @param sessionID Profile id to get + * @returns IAkiProfile object + */ getFullProfile(sessionID: string): IAkiProfile; + /** + * Get a PMC profile by its session id + * @param sessionID Profile id to return + * @returns IPmcData object + */ getPmcProfile(sessionID: string): IPmcData; + /** + * Get a full profiles scav-specific sub-profile + * @param sessionID Profiles id + * @returns IPmcData object + */ getScavProfile(sessionID: string): IPmcData; /** * Get baseline counter values for a fresh profile - * @returns Stats + * @returns Default profile Stats object */ getDefaultCounters(): Stats; + /** + * is this profile flagged for data removal + * @param sessionID Profile id + * @returns True if profile is to be wiped of data/progress + */ protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; /** @@ -101,4 +148,39 @@ export declare class ProfileHelper { * @param keyToIncrement Key */ incrementStatCounter(counters: CounterKeyValue[], keyToIncrement: string): void; + /** + * Check if player has a skill at elite level + * @param skillType Skill to check + * @param pmcProfile Profile to find skill in + * @returns True if player has skill at elite level + */ + hasEliteSkillLevel(skillType: SkillTypes, pmcProfile: IPmcData): boolean; + /** + * Add points to a specific skill in player profile + * @param skill Skill to add points to + * @param pointsToAdd Points to add + * @param pmcProfile Player profile with skill + * @param useSkillProgressRateMultipler Skills are multiplied by a value in globals, default is off to maintain compatibility with legacy code + * @returns + */ + addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void; + /** + * Get a speciic common skill from supplied profile + * @param pmcData Player profile + * @param skill Skill to look up and return value from + * @returns Common skill object from desired profile + */ + getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; + /** + * Is the provided session id for a developer account + * @param sessionID Profile id ot check + * @returns True if account is developer + */ + isDeveloperAccount(sessionID: string): boolean; + /** + * Add stash row bonus to profile or increments rows given count if it already exists + * @param sessionId Profile id to give rows to + * @param rowsToAdd How many rows to give profile + */ + addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void; } diff --git a/types/helpers/QuestConditionHelper.d.ts b/types/helpers/QuestConditionHelper.d.ts index a84bc81..afb76f2 100644 --- a/types/helpers/QuestConditionHelper.d.ts +++ b/types/helpers/QuestConditionHelper.d.ts @@ -1,8 +1,8 @@ -import { AvailableForConditions } from "../models/eft/common/tables/IQuest"; +import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest"; export declare class QuestConditionHelper { - getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; - protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; + protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[]; } diff --git a/types/helpers/QuestHelper.d.ts b/types/helpers/QuestHelper.d.ts index babdf1d..ca7270e 100644 --- a/types/helpers/QuestHelper.d.ts +++ b/types/helpers/QuestHelper.d.ts @@ -1,29 +1,30 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuestStatus } from "../models/eft/common/tables/IBotBase"; -import { Item } from "../models/eft/common/tables/IItem"; -import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; -import { IFailQuestRequestData } from "../models/eft/quests/IFailQuestRequestData"; -import { QuestStatus } from "../models/enums/QuestStatus"; -import { IQuestConfig } from "../models/spt/config/IQuestConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocaleService } from "../services/LocaleService"; -import { LocalisationService } from "../services/LocalisationService"; -import { MailSendService } from "../services/MailSendService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; -import { ItemHelper } from "./ItemHelper"; -import { PaymentHelper } from "./PaymentHelper"; -import { ProfileHelper } from "./ProfileHelper"; -import { QuestConditionHelper } from "./QuestConditionHelper"; -import { RagfairServerHelper } from "./RagfairServerHelper"; -import { TraderHelper } from "./TraderHelper"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper"; +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; +import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData"; +import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; +import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class QuestHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -40,16 +41,17 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + protected presetHelper: PresetHelper; protected mailSendService: MailSendService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer); /** - * Get status of a quest in player profile by its id - * @param pmcData Profile to search - * @param questId Quest id to look up - * @returns QuestStatus enum - */ + * Get status of a quest in player profile by its id + * @param pmcData Profile to search + * @param questId Quest id to look up + * @returns QuestStatus enum + */ getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied @@ -57,7 +59,7 @@ export declare class QuestHelper { * @param condition Quest condition * @returns true if player level is greater than or equal to quest */ - doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean; /** * Get the quests found in both arrays (inner join) * @param before Array of quests #1 @@ -66,14 +68,12 @@ export declare class QuestHelper { */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** - * Increase skill points of a skill on player profile - * Dupe of PlayerService.incrementSkillLevel() - * @param sessionID Session id - * @param pmcData Player profile - * @param skillName Name of skill to increase skill points of - * @param progressAmount Amount of skill points to add to skill + * Adjust skill experience for low skill levels, mimicing the official client + * @param profileSkill the skill experience is being added to + * @param progressAmount the amount of experience being added to the skill + * @returns the adjusted skill progress gain */ - rewardSkillPoints(sessionID: string, pmcData: IPmcData, skillName: string, progressAmount: number): void; + adjustSkillExpForLowLevels(profileSkill: Common, progressAmount: number): number; /** * Get quest name by quest id * @param questId id to get @@ -86,28 +86,34 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ - traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; /** * Check if trader has sufficient standing to fulfill quest requirement * @param questProperties Quest props * @param profile Player profile * @returns true if standing is high enough to fulfill quest requirement */ - traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean; protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** - * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids - * @param reward Reward item to fix + * Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param questReward Reward item to fix * @returns Fixed rewards */ - protected processReward(reward: Reward): Reward[]; + protected processReward(questReward: IQuestReward): Item[]; + /** + * Add missing mod items to a quest armor reward + * @param originalRewardRootItem Original armor reward item from IQuestReward.items object + * @param questReward Armor reward from quest + */ + protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -122,6 +128,12 @@ export declare class QuestHelper { * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check + */ + questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player @@ -172,9 +184,8 @@ export declare class QuestHelper { * @param failRequest Fail quest request data * @param sessionID Session id * @param output Client output - * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void; /** * Get List of All Quests from db * NOT CLONED @@ -208,16 +219,23 @@ export declare class QuestHelper { * @param questId Id of the quest to alter the status of */ updateQuestState(pmcData: IPmcData, newQuestState: QuestStatus, questId: string): void; + /** + * Resets a quests values back to its chosen state + * @param pmcData Profile to update + * @param newQuestState New state the quest should be in + * @param questId Id of the quest to alter the status of + */ + resetQuestState(pmcData: IPmcData, newQuestState: QuestStatus, questId: string): void; /** * Give player quest rewards - Skills/exp/trader standing/items/assort unlocks - Returns reward items player earned - * @param pmcData Player profile + * @param profileData Player profile (scav or pmc) * @param questId questId of quest to get rewards for * @param state State of the quest to get rewards for * @param sessionId Session id * @param questResponse Response to send back to client * @returns Array of reward objects */ - applyQuestReward(pmcData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[]; + applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[]; /** * WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile * also update client response recipeUnlocked array with craft id @@ -227,7 +245,7 @@ export declare class QuestHelper { * @param sessionID Session id * @param response Response to send back to client */ - protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; + protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** * Get players money reward bonus from profile * @param pmcData player profile @@ -247,4 +265,11 @@ export declare class QuestHelper { * @param statuses statuses quests should have */ addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void; + findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void; + /** + * Return a list of quests that would fail when supplied quest is completed + * @param completedQuestId quest completed id + * @returns array of IQuest objects + */ + getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; } diff --git a/types/helpers/RagfairHelper.d.ts b/types/helpers/RagfairHelper.d.ts index 2c8dbb5..55e6fe8 100644 --- a/types/helpers/RagfairHelper.d.ts +++ b/types/helpers/RagfairHelper.d.ts @@ -1,17 +1,16 @@ -import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; -import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; -import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { HandbookHelper } from "./HandbookHelper"; -import { ItemHelper } from "./ItemHelper"; -import { TraderAssortHelper } from "./TraderAssortHelper"; -import { UtilityHelper } from "./UtilityHelper"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; +import { UtilityHelper } from "@spt-aki/helpers/UtilityHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class RagfairHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,19 +24,24 @@ export declare class RagfairHelper { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, traderAssortHelper: TraderAssortHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, ragfairLinkedItemService: RagfairLinkedItemService, utilityHelper: UtilityHelper, configServer: ConfigServer); /** - * Gets currency TAG from TPL - * @param {string} currency - * @returns string - */ + * Gets currency TAG from TPL + * @param {string} currency + * @returns string + */ getCurrencyTag(currency: string): string; - filterCategories(sessionID: string, info: ISearchRequestData): string[]; + filterCategories(sessionID: string, request: ISearchRequestData): string[]; getDisplayableAssorts(sessionID: string): Record; protected getCategoryList(handbookId: string): string[]; - countCategories(result: IGetOffersResult): void; /** * Merges Root Items * Ragfair allows abnormally large stacks. */ mergeStackable(items: Item[]): Item[]; + /** + * Return the symbol for a currency + * e.g. 5449016a4bdc2d6f028b456f return ₽ + * @param currencyTpl currency to get symbol for + * @returns symbol of currency + */ getCurrencySymbol(currencyTpl: string): string; } diff --git a/types/helpers/RagfairOfferHelper.d.ts b/types/helpers/RagfairOfferHelper.d.ts index 0699259..31bdc05 100644 --- a/types/helpers/RagfairOfferHelper.d.ts +++ b/types/helpers/RagfairOfferHelper.d.ts @@ -1,31 +1,32 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; -import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; -import { IQuestConfig } from "../models/spt/config/IQuestConfig"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { LocaleService } from "../services/LocaleService"; -import { LocalisationService } from "../services/LocalisationService"; -import { MailSendService } from "../services/MailSendService"; -import { RagfairOfferService } from "../services/RagfairOfferService"; -import { HashUtil } from "../utils/HashUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { ItemHelper } from "./ItemHelper"; -import { PaymentHelper } from "./PaymentHelper"; -import { PresetHelper } from "./PresetHelper"; -import { ProfileHelper } from "./ProfileHelper"; -import { RagfairHelper } from "./RagfairHelper"; -import { RagfairServerHelper } from "./RagfairServerHelper"; -import { RagfairSortHelper } from "./RagfairSortHelper"; -import { TraderHelper } from "./TraderHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { RagfairHelper } from "@spt-aki/helpers/RagfairHelper"; +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; +import { RagfairSortHelper } from "@spt-aki/helpers/RagfairSortHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; +import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -42,6 +43,7 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected localeService: LocaleService; protected localisationService: LocalisationService; protected mailSendService: MailSendService; @@ -49,25 +51,32 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns Offers the player should see */ - getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; + /** + * Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level + * @param searchRequest Search request from client + * @param pmcDataPlayer profile + * @returns Matching IRagfairOffer objects + */ + getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[]; /** * Get offers from flea/traders specifically when building weapon preset * @param searchRequest Search request data * @param itemsToAdd string array of item tpls to search for * @param traderAssorts All trader assorts player can access/buy - * @param pmcProfile Player profile + * @param pmcData Player profile * @returns IRagfairOffer array */ - getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcData: IPmcData): IRagfairOffer[]; /** * Check if offer is from trader standing the player does not have * @param offer Offer to check @@ -140,6 +149,21 @@ export declare class RagfairOfferHelper { * @returns Localised message text */ protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; + /** + * Check an offer passes the various search criteria the player requested + * @param searchRequest + * @param offer + * @param pmcData + * @returns True + */ + protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean; + /** + * Check that the passed in offer item is functional + * @param offerRootItem The root item of the offer + * @param offer The flea offer + * @returns True if the given item is functional + */ + isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -150,6 +174,13 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean; + /** + * Does the passed in item have a condition property + * @param item Item to check + * @returns True if has condition + */ + protected isConditionItem(item: Item): boolean; /** * Is items quality value within desired range * @param item Item to check quality of diff --git a/types/helpers/RagfairSellHelper.d.ts b/types/helpers/RagfairSellHelper.d.ts index 913b408..7a4de8a 100644 --- a/types/helpers/RagfairSellHelper.d.ts +++ b/types/helpers/RagfairSellHelper.d.ts @@ -1,16 +1,18 @@ -import { SellResult } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { SellResult } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairSellHelper { protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price * @param averageOfferPriceRub Price of average offer in roubles @@ -19,13 +21,6 @@ export declare class RagfairSellHelper { * @returns percent value */ calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; - /** - * Get percent chance to sell an item when price is below items average listing price - * @param playerListedPriceRub Price player listed item for in roubles - * @param averageOfferPriceRub Price of average offer in roubles - * @returns percent value - */ - protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Get array of item count and sell time (empty array = no sell) * @param sellChancePercent chance item will sell diff --git a/types/helpers/RagfairServerHelper.d.ts b/types/helpers/RagfairServerHelper.d.ts index 3d73605..e93a2d8 100644 --- a/types/helpers/RagfairServerHelper.d.ts +++ b/types/helpers/RagfairServerHelper.d.ts @@ -1,26 +1,28 @@ -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { MemberCategory } from "../models/enums/MemberCategory"; -import { IQuestConfig } from "../models/spt/config/IQuestConfig"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocaleService } from "../services/LocaleService"; -import { MailSendService } from "../services/MailSendService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; -import { ItemHelper } from "./ItemHelper"; -import { ProfileHelper } from "./ProfileHelper"; -import { TraderHelper } from "./TraderHelper"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; +import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { ItemFilterService } from "@spt-aki/services/ItemFilterService"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Helper class for common ragfair server actions */ export declare class RagfairServerHelper { + protected logger: ILogger; protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected timeUtil: TimeUtil; @@ -38,7 +40,7 @@ export declare class RagfairServerHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, mailSendService: MailSendService, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, mailSendService: MailSendService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails @@ -51,6 +53,12 @@ export declare class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * Is supplied parent id on the ragfair custom item category blacklist + * @param parentId Parent Id to check is blacklisted + * @returns true if blacklisted + */ + protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean; /** * is supplied id a trader * @param traderId @@ -76,14 +84,22 @@ export declare class RagfairServerHelper { */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; - getNickname(userID: string): string; - getPresetItems(item: any): Item[]; - getPresetItemsByTpl(item: Item): Item[]; /** - * Generate new unique ids for the children while preserving hierarchy - * @param item base item - * @param preset - * @returns Item array with new IDs + * Get a player or traders nickname from their profile by their user id + * @param userID Sessionid/userid + * @returns Nickname of individual */ - reparentPresets(item: Item, preset: Item[]): Item[]; + getNickname(userID: string): string; + /** + * Given a preset id from globals.json, return an array of items[] with unique ids + * @param item Preset item + * @returns Array of weapon and its children + */ + getPresetItems(item: Item): Item[]; + /** + * Possible bug, returns all items associated with an items tpl, could be multiple presets from globals.json + * @param item Preset item + * @returns + */ + getPresetItemsByTpl(item: Item): Item[]; } diff --git a/types/helpers/RagfairSortHelper.d.ts b/types/helpers/RagfairSortHelper.d.ts index 6a06528..5bd8f96 100644 --- a/types/helpers/RagfairSortHelper.d.ts +++ b/types/helpers/RagfairSortHelper.d.ts @@ -1,7 +1,7 @@ -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; -import { RagfairSort } from "../models/enums/RagfairSort"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocaleService } from "../services/LocaleService"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "@spt-aki/models/enums/RagfairSort"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; diff --git a/types/helpers/RagfairTaxHelper.d.ts b/types/helpers/RagfairTaxHelper.d.ts new file mode 100644 index 0000000..820facb --- /dev/null +++ b/types/helpers/RagfairTaxHelper.d.ts @@ -0,0 +1,16 @@ +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RagfairPriceService } from "../services/RagfairPriceService"; +import { ItemHelper } from "./ItemHelper"; +import { ILogger } from "../models/spt/utils/ILogger"; +export declare class RagfairTaxHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected ragfairPriceService: RagfairPriceService; + protected itemHelper: ItemHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemHelper: ItemHelper); + 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; +} diff --git a/types/helpers/RepairHelper.d.ts b/types/helpers/RepairHelper.d.ts index 3ba54f6..9ef0eaa 100644 --- a/types/helpers/RepairHelper.d.ts +++ b/types/helpers/RepairHelper.d.ts @@ -1,11 +1,11 @@ -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { IRepairConfig } from "../models/spt/config/IRepairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class RepairHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,12 +25,22 @@ export declare class RepairHelper { * @param applyMaxDurabilityDegradation should item have max durability reduced */ updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; - protected getRandomisedArmorRepairDegradationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; - protected getRandomisedWeaponRepairDegradationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; /** - * Is the supplied tpl a weapon - * @param tpl tplId to check is a weapon - * @returns true if tpl is a weapon + * Repairing armor reduces the total durability value slightly, get a randomised (to 2dp) amount based on armor material + * @param armorMaterial What material is the armor being repaired made of + * @param isRepairKit Was a repair kit used + * @param armorMax Max amount of durability item can have + * @param traderQualityMultipler Different traders produce different loss values + * @returns Amount to reduce max durability by */ - isWeaponTemplate(tpl: string): boolean; + protected getRandomisedArmorRepairDegradationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + /** + * Repairing weapons reduces the total durability value slightly, get a randomised (to 2dp) amount + * @param itemProps Weapon properties + * @param isRepairKit Was a repair kit used + * @param weaponMax ax amount of durability item can have + * @param traderQualityMultipler Different traders produce different loss values + * @returns Amount to reduce max durability by + */ + protected getRandomisedWeaponRepairDegradationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; } diff --git a/types/helpers/RepeatableQuestHelper.d.ts b/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..6e0290d --- /dev/null +++ b/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "@spt-aki/utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/types/helpers/SecureContainerHelper.d.ts b/types/helpers/SecureContainerHelper.d.ts index 9e2bc32..36b227c 100644 --- a/types/helpers/SecureContainerHelper.d.ts +++ b/types/helpers/SecureContainerHelper.d.ts @@ -1,5 +1,5 @@ -import { Item } from "../models/eft/common/tables/IItem"; -import { ItemHelper } from "./ItemHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface OwnerInventoryItems { from: Item[]; to: Item[]; @@ -9,5 +9,10 @@ export interface OwnerInventoryItems { export declare class SecureContainerHelper { protected itemHelper: ItemHelper; constructor(itemHelper: ItemHelper); + /** + * Get an array of the item IDs (NOT tpls) inside a secure container + * @param items Inventory items to look for secure container in + * @returns Array of ids + */ getSecureContainerItems(items: Item[]): string[]; } diff --git a/types/helpers/TradeHelper.d.ts b/types/helpers/TradeHelper.d.ts index 28512f1..d997dae 100644 --- a/types/helpers/TradeHelper.d.ts +++ b/types/helpers/TradeHelper.d.ts @@ -1,57 +1,68 @@ -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item, Upd } from "../models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; -import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RagfairServer } from "../servers/RagfairServer"; -import { FenceService } from "../services/FenceService"; -import { PaymentService } from "../services/PaymentService"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; +import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { RagfairServer } from "@spt-aki/servers/RagfairServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class TradeHelper { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected fenceService: FenceService; + protected localisationService: LocalisationService; protected httpResponse: HttpResponseUtil; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; + protected traderAssortHelper: TraderAssortHelper; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); + protected inventoryConfig: IInventoryConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData Player profile * @param buyRequestData data from client * @param sessionID Session id * @param foundInRaid Should item be found in raid - * @param upd optional item details used when buying from flea - * @returns + * @param output IItemEventRouterResponse + * @returns IItemEventRouterResponse */ - buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; + buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void; /** * Sell item to trader * @param profileWithItemsToSell Profile to remove items from * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id - * @returns IItemEventRouterResponse + * @param output IItemEventRouterResponse */ - sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; /** - * Increment the assorts buy count by number of items purchased - * Show error on screen if player attempts to buy more than what the buy max allows - * @param assortBeingPurchased assort being bought - * @param itemsPurchasedCount number of items being bought + * Traders allow a limited number of purchases per refresh cycle (default 60 mins) + * @param sessionId Session id + * @param traderId Trader assort is purchased from + * @param assortBeingPurchased the item from trader being bought + * @param assortId Id of assort being purchased + * @param count How many of the item are being bought */ - protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; - protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; + protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/types/helpers/TraderAssortHelper.d.ts b/types/helpers/TraderAssortHelper.d.ts index a0294a1..0987ff4 100644 --- a/types/helpers/TraderAssortHelper.d.ts +++ b/types/helpers/TraderAssortHelper.d.ts @@ -1,22 +1,22 @@ -import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; -import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { TraderAssortService } from "../services/TraderAssortService"; -import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { AssortHelper } from "./AssortHelper"; -import { PaymentHelper } from "./PaymentHelper"; -import { ProfileHelper } from "./ProfileHelper"; -import { TraderHelper } from "./TraderHelper"; +import { RagfairAssortGenerator } from "@spt-aki/generators/RagfairAssortGenerator"; +import { RagfairOfferGenerator } from "@spt-aki/generators/RagfairOfferGenerator"; +import { AssortHelper } from "@spt-aki/helpers/AssortHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITrader, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { TraderAssortService } from "@spt-aki/services/TraderAssortService"; +import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -44,9 +44,15 @@ export declare class TraderAssortHelper { * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id * @param traderId traders id + * @param flea Should assorts player hasn't unlocked be returned - default false * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset every traders root item `BuyRestrictionCurrent` property to 0 + * @param assortItems Items to adjust + */ + protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void; /** * Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed */ diff --git a/types/helpers/TraderHelper.d.ts b/types/helpers/TraderHelper.d.ts index 7eb4edf..256ebf8 100644 --- a/types/helpers/TraderHelper.d.ts +++ b/types/helpers/TraderHelper.d.ts @@ -1,21 +1,21 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ProfileTraderTemplate } from "../models/eft/common/tables/IProfileTemplate"; -import { ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; -import { Traders } from "../models/enums/Traders"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; -import { LocalisationService } from "../services/LocalisationService"; -import { PlayerService } from "../services/PlayerService"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { HandbookHelper } from "./HandbookHelper"; -import { ItemHelper } from "./ItemHelper"; -import { ProfileHelper } from "./ProfileHelper"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ProfileTraderTemplate } from "@spt-aki/models/eft/common/tables/IProfileTemplate"; +import { ITraderAssort, ITraderBase, LoyaltyLevel } from "@spt-aki/models/eft/common/tables/ITrader"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { FenceService } from "@spt-aki/services/FenceService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PlayerService } from "@spt-aki/services/PlayerService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class TraderHelper { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -35,6 +35,13 @@ export declare class TraderHelper { /** Dictionary of item tpl and the highest trader buy back rouble price */ protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get a trader base object, update profile to reflect players current standing in profile + * when trader not found in profile + * @param traderID Traders Id to get + * @param sessionID Players id + * @returns Trader base + */ getTrader(traderID: string, sessionID: string): ITraderBase; /** * Get all assort data for a particular trader @@ -52,22 +59,28 @@ export declare class TraderHelper { /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels - * @param sessionID session id + * @param sessionID session id of player * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; + /** + * Get the starting standing of a trader based on the current profiles type (e.g. EoD, Standard etc) + * @param traderId Trader id to get standing for + * @param rawProfileTemplate Raw profile from profiles.json to look up standing from + * @returns Standing value + */ protected getStartingStanding(traderId: string, rawProfileTemplate: ProfileTraderTemplate): number; /** * Alter a traders unlocked status * @param traderId Trader to alter * @param status New status to use - * @param sessionId Session id + * @param sessionId Session id of player */ setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void; /** * Add standing to a trader and level them up if exp goes over level threshold - * @param sessionId Session id - * @param traderId Traders id + * @param sessionId Session id of player + * @param traderId Traders id to add standing to * @param standingToAdd Standing value to add to trader */ addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void; @@ -104,11 +117,11 @@ export declare class TraderHelper { */ addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { items: { - item_id: string; + itemId: string; count: number; }[]; - tid: string; - }): void; + traderId: string; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/types/helpers/WeightedRandomHelper.d.ts b/types/helpers/WeightedRandomHelper.d.ts index 5fd9edc..ab42805 100644 --- a/types/helpers/WeightedRandomHelper.d.ts +++ b/types/helpers/WeightedRandomHelper.d.ts @@ -8,6 +8,11 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + /** + * Choos an item from the passed in array based on the weightings of each + * @param itemArray Items and weights to use + * @returns Chosen item from array + */ getWeightedValue(itemArray: { [key: string]: unknown; } | ArrayLike): T; @@ -25,7 +30,7 @@ export declare class WeightedRandomHelper { * @param {number[]} weights * @returns {{item: any, index: number}} */ - weightedRandom(items: string | any[], weights: string | any[]): { + weightedRandom(items: any[], weights: any[]): { item: any; index: number; }; diff --git a/types/ide/BleedingEdgeEntry.d.ts b/types/ide/BleedingEdgeEntry.d.ts index fded23a..62f714e 100644 --- a/types/ide/BleedingEdgeEntry.d.ts +++ b/types/ide/BleedingEdgeEntry.d.ts @@ -1 +1,2 @@ import "reflect-metadata"; +import "source-map-support/register"; diff --git a/types/ide/BleedingEdgeModsEntry.d.ts b/types/ide/BleedingEdgeModsEntry.d.ts new file mode 100644 index 0000000..62f714e --- /dev/null +++ b/types/ide/BleedingEdgeModsEntry.d.ts @@ -0,0 +1,2 @@ +import "reflect-metadata"; +import "source-map-support/register"; diff --git a/types/ide/DebugEntry.d.ts b/types/ide/DebugEntry.d.ts index fded23a..62f714e 100644 --- a/types/ide/DebugEntry.d.ts +++ b/types/ide/DebugEntry.d.ts @@ -1 +1,2 @@ import "reflect-metadata"; +import "source-map-support/register"; diff --git a/types/ide/ReleaseEntry.d.ts b/types/ide/ReleaseEntry.d.ts index fded23a..62f714e 100644 --- a/types/ide/ReleaseEntry.d.ts +++ b/types/ide/ReleaseEntry.d.ts @@ -1 +1,2 @@ import "reflect-metadata"; +import "source-map-support/register"; diff --git a/types/ide/TestEntry.d.ts b/types/ide/TestEntry.d.ts index fded23a..62f714e 100644 --- a/types/ide/TestEntry.d.ts +++ b/types/ide/TestEntry.d.ts @@ -1 +1,2 @@ import "reflect-metadata"; +import "source-map-support/register"; diff --git a/types/loaders/BundleLoader.d.ts b/types/loaders/BundleLoader.d.ts index e043b39..90f4ea9 100644 --- a/types/loaders/BundleLoader.d.ts +++ b/types/loaders/BundleLoader.d.ts @@ -1,33 +1,33 @@ -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import { JsonUtil } from "../utils/JsonUtil"; -import { VFS } from "../utils/VFS"; -declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleInfo { + modpath: string; + filename: string; + crc: number; + dependencies: string[]; + constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number); } export declare class BundleLoader { protected httpServerHelper: HttpServerHelper; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected bundleHashCacheService: BundleHashCacheService; protected bundles: Record; - constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService); /** * Handle singleplayer/bundles */ - getBundles(local: boolean): BundleInfo[]; - getBundle(key: string, local: boolean): BundleInfo; + getBundles(): BundleInfo[]; + getBundle(key: string): BundleInfo; addBundles(modpath: string): void; addBundle(key: string, b: BundleInfo): void; } export interface BundleManifest { - manifest: Array; + manifest: BundleManifestEntry[]; } export interface BundleManifestEntry { key: string; - path: string; + dependencyKeys: string[]; } -export {}; diff --git a/types/loaders/ModLoadOrder.d.ts b/types/loaders/ModLoadOrder.d.ts new file mode 100644 index 0000000..2d03dc1 --- /dev/null +++ b/types/loaders/ModLoadOrder.d.ts @@ -0,0 +1,17 @@ +import { IPackageJsonData } from "@spt-aki/models/spt/mod/IPackageJsonData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +export declare class ModLoadOrder { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected mods: Map; + protected modsAvailable: Map; + protected loadOrder: Set; + constructor(logger: ILogger, localisationService: LocalisationService); + setModList(mods: Record): void; + getLoadOrder(): string[]; + getModsOnLoadBefore(mod: string): Set; + getModsOnLoadAfter(mod: string): Set; + protected invertLoadBefore(mod: string): void; + protected getLoadOrderRecursive(mod: string, visited: Set): void; +} diff --git a/types/loaders/ModTypeCheck.d.ts b/types/loaders/ModTypeCheck.d.ts index e907341..fb4912e 100644 --- a/types/loaders/ModTypeCheck.d.ts +++ b/types/loaders/ModTypeCheck.d.ts @@ -1,9 +1,9 @@ -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPostAkiLoadModAsync } from "../models/external/IPostAkiLoadModAsync"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; -import { IPostDBLoadModAsync } from "../models/external/IPostDBLoadModAsync"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPreAkiLoadModAsync } from "../models/external/IPreAkiLoadModAsync"; +import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod"; +import { IPostAkiLoadModAsync } from "@spt-aki/models/external/IPostAkiLoadModAsync"; +import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod"; +import { IPostDBLoadModAsync } from "@spt-aki/models/external/IPostDBLoadModAsync"; +import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod"; +import { IPreAkiLoadModAsync } from "@spt-aki/models/external/IPreAkiLoadModAsync"; export declare class ModTypeCheck { /** * Use defined safe guard to check if the mod is a IPreAkiLoadMod diff --git a/types/loaders/PostAkiModLoader.d.ts b/types/loaders/PostAkiModLoader.d.ts index 848e9f3..8219fc4 100644 --- a/types/loaders/PostAkiModLoader.d.ts +++ b/types/loaders/PostAkiModLoader.d.ts @@ -1,21 +1,17 @@ import { DependencyContainer } from "tsyringe"; -import { IModLoader } from "../models/spt/mod/IModLoader"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { VFS } from "../utils/VFS"; -import { BundleLoader } from "./BundleLoader"; -import { ModTypeCheck } from "./ModTypeCheck"; -import { PreAkiModLoader } from "./PreAkiModLoader"; +import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; +import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; +import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostAkiModLoader implements IModLoader { protected logger: ILogger; - protected bundleLoader: BundleLoader; - protected vfs: VFS; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); getModPath(mod: string): string; load(): Promise; - protected executeMods(container: DependencyContainer): Promise; - protected addBundles(): void; + protected executeModsAsync(): Promise; } diff --git a/types/loaders/PostDBModLoader.d.ts b/types/loaders/PostDBModLoader.d.ts index eef160b..1adac53 100644 --- a/types/loaders/PostDBModLoader.d.ts +++ b/types/loaders/PostDBModLoader.d.ts @@ -1,17 +1,21 @@ import { DependencyContainer } from "tsyringe"; -import { OnLoad } from "../di/OnLoad"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { ModTypeCheck } from "./ModTypeCheck"; -import { PreAkiModLoader } from "./PreAkiModLoader"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; +import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; +import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class PostDBModLoader implements OnLoad { protected logger: ILogger; + protected bundleLoader: BundleLoader; protected preAkiModLoader: PreAkiModLoader; protected localisationService: LocalisationService; protected modTypeCheck: ModTypeCheck; - constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); + protected container: DependencyContainer; + constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck); onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; - protected executeMods(container: DependencyContainer): Promise; + protected executeModsAsync(): Promise; + protected addBundles(): void; } diff --git a/types/loaders/PreAkiModLoader.d.ts b/types/loaders/PreAkiModLoader.d.ts index a1664e1..0d297d9 100644 --- a/types/loaders/PreAkiModLoader.d.ts +++ b/types/loaders/PreAkiModLoader.d.ts @@ -1,33 +1,34 @@ import { DependencyContainer } from "tsyringe"; -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { IModLoader } from "../models/spt/mod/IModLoader"; -import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { ModCompilerService } from "../services/ModCompilerService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { VFS } from "../utils/VFS"; -import { BundleLoader } from "./BundleLoader"; -import { ModTypeCheck } from "./ModTypeCheck"; +import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder"; +import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck"; +import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader"; +import { IPackageJsonData } from "@spt-aki/models/spt/mod/IPackageJsonData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { ModCompilerService } from "@spt-aki/services/ModCompilerService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; - protected bundleLoader: BundleLoader; protected localisationService: LocalisationService; protected configServer: ConfigServer; + protected modLoadOrder: ModLoadOrder; protected modTypeCheck: ModTypeCheck; - protected static container: DependencyContainer; + protected container: DependencyContainer; protected readonly basepath = "user/mods/"; protected readonly modOrderPath = "user/mods/order.json"; protected order: Record; protected imported: Record; protected akiConfig: ICoreConfig; protected serverDependencies: Record; - protected skippedMods: string[]; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modTypeCheck: ModTypeCheck); + protected skippedMods: Set; + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** * Returns a list of mods with preserved load order @@ -35,46 +36,64 @@ export declare class PreAkiModLoader implements IModLoader { */ getImportedModsNames(): string[]; getImportedModDetails(): Record; + getProfileModsGroupedByModName(profileMods: ModDetails[]): ModDetails[]; getModPath(mod: string): string; - protected importMods(): Promise; + protected importModsAsync(): Promise; protected sortMods(prev: string, next: string, missingFromOrderJSON: Record): number; /** * Check for duplicate mods loaded, show error if any - * @param modPackageData Dictionary of mod package.json data + * @param modPackageData map of mod package.json data */ - protected checkForDuplicateMods(modPackageData: Record): void; + protected checkForDuplicateMods(modPackageData: Map): void; /** - * Check for and return duplicate strings inside an array - * @param stringArray Array to check for duplicates - * @returns string array of duplicates, empty if none found - */ - protected getDuplicates(stringArray: string[]): string[]; - /** - * Get an array of mods with errors that prevent them from working with SPT + * Returns an array of valid mods. + * * @param mods mods to validate - * @returns Mod names as array + * @returns array of mod folder names */ - protected getBrokenMods(mods: string[]): string[]; + protected getValidMods(mods: string[]): string[]; /** * Get packageJson data for mods * @param mods mods to get packageJson for - * @returns dictionary + * @returns map + */ + protected getModsPackageData(mods: string[]): Map; + /** + * Is the passed in mod compatible with the running server version + * @param mod Mod to check compatibiltiy with AKI + * @returns True if compatible */ - protected getModsPackageData(mods: string[]): Record; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; - protected executeMods(container: DependencyContainer): Promise; + /** + * Execute each mod found in this.imported + * @returns void promise + */ + protected executeModsAsync(): Promise; + /** + * Read loadorder.json (create if doesnt exist) and return sorted list of mods + * @returns string array of sorted mod names + */ sortModsLoadOrder(): string[]; - protected addMod(mod: string): Promise; + /** + * Compile mod and add into class property "imported" + * @param mod Name of mod to compile/add + */ + protected addModAsync(mod: string, pkg: IPackageJsonData): Promise; + /** + * Checks if a given mod should be loaded or skipped. + * + * @param pkg mod package.json data + * @returns + */ + protected shouldSkipMod(pkg: IPackageJsonData): boolean; protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void; - protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; - protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; + protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Map): boolean; + protected isModCompatible(mod: IPackageJsonData, loadedMods: Map): boolean; /** * Validate a mod passes a number of checks * @param modName name of mod in /mods/ to validate * @returns true if valid */ protected validMod(modName: string): boolean; - protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; - protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; } diff --git a/types/models/eft/builds/ISetMagazineRequest.d.ts b/types/models/eft/builds/ISetMagazineRequest.d.ts new file mode 100644 index 0000000..4b002e8 --- /dev/null +++ b/types/models/eft/builds/ISetMagazineRequest.d.ts @@ -0,0 +1,9 @@ +import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile"; +export interface ISetMagazineRequest { + Id: string; + Name: string; + Caliber: string; + Items: IMagazineTemplateAmmoItem[]; + TopCount: number; + BottomCount: number; +} diff --git a/types/models/eft/common/IGlobals.d.ts b/types/models/eft/common/IGlobals.d.ts index c774511..e5aaa4a 100644 --- a/types/models/eft/common/IGlobals.d.ts +++ b/types/models/eft/common/IGlobals.d.ts @@ -1,10 +1,11 @@ -import { Ixyz } from "./Ixyz"; -import { Item } from "./tables/IItem"; +import { Ixyz } from "@spt-aki/models/eft/common/Ixyz"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGlobals { time: number; config: IConfig; bot_presets: IBotPreset[]; AudioSettings: IAudioSettings; + EnvironmentSettings: IEnvironmentSettings; BotWeaponScatterings: IBotWeaponScattering[]; ItemPresets: Record; } @@ -39,6 +40,7 @@ export interface IConfig { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; + BluntDamageReduceFromSoftArmorMod: number; Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; @@ -70,6 +72,10 @@ export interface IConfig { SkillPointsBeforeFatigue: number; SkillFatigueReset: number; DiscardLimitsEnabled: boolean; + EventSettings: IEventSettings; + FavoriteItemsSettings: IFavoriteItemsSettings; + VaultingSettings: IVaultingSettings; + BTRSettings: IBTRSettings; EventType: string[]; WalkSpeed: Ixyz; SprintSpeed: Ixyz; @@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings { WeaponPistolFastSwitchMaxSpeedMult: number; WeaponPistolFastSwitchMinSpeedMult: number; } +export interface IEventSettings { + EventActive: boolean; + EventTime: number; + EventWeather: IEventWeather; + ExitTimeMultiplier: number; + StaminaMultiplier: number; + SummonFailedWeather: IEventWeather; + SummonSuccessWeather: IEventWeather; + WeatherChangeTime: number; +} +export interface IEventWeather { + Cloudness: number; + Hour: number; + Minute: number; + Rain: number; + RainRandomness: number; + ScaterringFogDensity: number; + TopWindDirection: Ixyz; + Wind: number; + WindDirection: number; +} export interface IGraphicSettings { ExperimentalFogInCity: boolean; } @@ -656,6 +683,7 @@ export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; + EnvironmentDamageMultiplier: number; OverDamageReceivedMultiplier: number; } export interface IHealthFactorsSettings { @@ -826,6 +854,83 @@ export interface IRestrictionsInRaid { TemplateId: string; Value: number; } +export interface IFavoriteItemsSettings { + WeaponStandMaxItemsCount: number; + PlaceOfFameMaxItemsCount: number; +} +export interface IVaultingSettings { + IsActive: boolean; + VaultingInputTime: number; + GridSettings: IVaultingGridSettings; + MovesSettings: IVaultingMovesSettings; +} +export interface IVaultingGridSettings { + GridSizeX: number; + GridSizeY: number; + GridSizeZ: number; + SteppingLengthX: number; + SteppingLengthY: number; + SteppingLengthZ: number; + GridOffsetX: number; + GridOffsetY: number; + GridOffsetZ: number; + OffsetFactor: number; +} +export interface IVaultingMovesSettings { + VaultSettings: IVaultingSubMoveSettings; + ClimbSettings: IVaultingSubMoveSettings; +} +export interface IVaultingSubMoveSettings { + IsActive: boolean; + MaxWithoutHandHeight: number; + SpeedRange: Ixyz; + MoveRestrictions: IMoveRestrictions; + AutoMoveRestrictions: IMoveRestrictions; +} +export interface IMoveRestrictions { + IsActive: boolean; + MinDistantToInteract: number; + MinHeight: number; + MaxHeight: number; + MinLength: number; + MaxLength: number; +} +export interface IBTRSettings { + LocationsWithBTR: string[]; + BasePriceTaxi: number; + AddPriceTaxi: number; + CleanUpPrice: number; + DeliveryPrice: number; + ModDeliveryCost: number; + BearPriceMod: number; + UsecPriceMod: number; + ScavPriceMod: number; + CoefficientDiscountCharisma: number; + DeliveryMinPrice: number; + TaxiMinPrice: number; + BotCoverMinPrice: number; + MapsConfigs: Record; + DiameterWheel: number; + HeightWheel: number; + HeightWheelMaxPosLimit: number; + HeightWheelMinPosLimit: number; + SnapToSurfaceWheelsSpeed: number; + CheckSurfaceForWheelsTimer: number; + HeightWheelOffset: number; +} +export interface IBtrMapConfig { + mapID: string; + pathsConfigurations: IBtrMapConfig[]; +} +export interface IBtrMapConfig { + id: string; + enterPoint: string; + exitPoint: string; + pathPoints: string[]; + once: boolean; + circle: boolean; + circleCount: number; +} export interface ISquadSettings { CountOfRequestsToOnePlayer: number; SecondsForExpiredRequest: number; @@ -1240,6 +1345,11 @@ export interface IFenceLevel { BotHelpChance: number; BotSpreadoutChance: number; BotStopChance: number; + PriceModTaxi: number; + PriceModDelivery: number; + PriceModCleanUp: number; + DeliveryGridSize: Ixyz; + CanInteractWithBtr: boolean; } export interface IInertia { InertiaLimits: Ixyz; @@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset { OcclusionIntensity: number; OverallVolume: number; } +export interface IEnvironmentSettings { + SnowStepsVolumeMultiplier: number; + SurfaceMultipliers: ISurfaceMultiplier[]; +} +export interface ISurfaceMultiplier { + SurfaceType: string; + VolumeMult: number; +} export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; diff --git a/types/models/eft/common/ILocation.d.ts b/types/models/eft/common/ILocation.d.ts index f26ade6..1fa0a2b 100644 --- a/types/models/eft/common/ILocation.d.ts +++ b/types/models/eft/common/ILocation.d.ts @@ -1,9 +1,10 @@ -import { ILocationBase } from "./ILocationBase"; -import { ILooseLoot } from "./ILooseLoot"; +import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; statics: IStaticContainer; + allExtracts: Exit[]; } export interface IStaticContainer { containersGroups: Record; diff --git a/types/models/eft/common/ILocationBase.d.ts b/types/models/eft/common/ILocationBase.d.ts index 5f24907..99f5c9c 100644 --- a/types/models/eft/common/ILocationBase.d.ts +++ b/types/models/eft/common/ILocationBase.d.ts @@ -1,5 +1,5 @@ -import { MinMax } from "../../../models/common/MinMax"; -import { Ixyz } from "./Ixyz"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { Ixyz } from "@spt-aki/models/eft/common/Ixyz"; export interface ILocationBase { AccessKeys: string[]; AirdropParameters: AirdropParameter[]; @@ -132,6 +132,8 @@ export interface BossLocationSpawn { TriggerId: string; TriggerName: string; Delay?: number; + ForceSpawn?: boolean; + IgnoreMaxBots?: boolean; Supports?: BossSupport[]; sptId?: string; } @@ -171,6 +173,7 @@ export interface SpawnPointParam { BotZoneName: string; Categories: string[]; ColliderParams: ColliderParams; + CorePointId: number; DelayToCanSpawnSec: number; Id: string; Infiltration: string; @@ -187,9 +190,11 @@ export interface Props { Radius: number; } export interface Exit { + /** % Chance out of 100 exit will appear in raid */ Chance: number; Count: number; EntryPoints: string; + EventAvailable: boolean; ExfiltrationTime: number; ExfiltrationType: string; RequiredSlot?: string; @@ -200,6 +205,7 @@ export interface Exit { PassageRequirement: string; PlayersCount: number; RequirementTip: string; + Side?: string; } export interface MaxItemCountInLocation { TemplateId: string; diff --git a/types/models/eft/common/ILocationsSourceDestinationBase.d.ts b/types/models/eft/common/ILocationsSourceDestinationBase.d.ts index 7f8d915..1e8d80c 100644 --- a/types/models/eft/common/ILocationsSourceDestinationBase.d.ts +++ b/types/models/eft/common/ILocationsSourceDestinationBase.d.ts @@ -1,4 +1,4 @@ -import { ILocations } from "../../spt/server/ILocations"; +import { ILocations } from "@spt-aki/models/spt/server/ILocations"; export interface ILocationsGenerateAllResponse { locations: ILocations; paths: Path[]; diff --git a/types/models/eft/common/ILooseLoot.d.ts b/types/models/eft/common/ILooseLoot.d.ts index 09696d4..0dce230 100644 --- a/types/models/eft/common/ILooseLoot.d.ts +++ b/types/models/eft/common/ILooseLoot.d.ts @@ -1,5 +1,5 @@ -import { Ixyz } from "./Ixyz"; -import { Item } from "./tables/IItem"; +import { Ixyz } from "@spt-aki/models/eft/common/Ixyz"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface ILooseLoot { spawnpointCount: SpawnpointCount; spawnpointsForced: SpawnpointsForced[]; diff --git a/types/models/eft/common/IPmcData.d.ts b/types/models/eft/common/IPmcData.d.ts index 4e37b60..a9594d6 100644 --- a/types/models/eft/common/IPmcData.d.ts +++ b/types/models/eft/common/IPmcData.d.ts @@ -1,7 +1,11 @@ -import { IBotBase, IEftStats } from "./tables/IBotBase"; +import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase"; export interface IPmcData extends IBotBase { } export interface IPostRaidPmcData extends IBotBase { - /** Only found in profile we get from client post raid */ - EftStats: IEftStats; + Stats: IPostRaidStats; +} +export interface IPostRaidStats { + Eft: IEftStats; + /** Only found in profile we get from client post raid */ + Arena: IEftStats; } diff --git a/types/models/eft/common/tables/IAchievement.d.ts b/types/models/eft/common/tables/IAchievement.d.ts new file mode 100644 index 0000000..910b13d --- /dev/null +++ b/types/models/eft/common/tables/IAchievement.d.ts @@ -0,0 +1,18 @@ +import { IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IAchievement { + id: string; + imageUrl: string; + assetPath: string; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; + instantComplete: boolean; + showNotificationsInGame: boolean; + showProgress: boolean; + prefab: string; + rarity: string; + hidden: boolean; + showConditions: boolean; + progressBarEnabled: boolean; + side: string; + index: number; +} diff --git a/types/models/eft/common/tables/IBotBase.d.ts b/types/models/eft/common/tables/IBotBase.d.ts index 6c7b76f..cfcc831 100644 --- a/types/models/eft/common/tables/IBotBase.d.ts +++ b/types/models/eft/common/tables/IBotBase.d.ts @@ -1,9 +1,11 @@ -import { HideoutAreas } from "../../../enums/HideoutAreas"; -import { MemberCategory } from "../../../enums/MemberCategory"; -import { QuestStatus } from "../../../enums/QuestStatus"; -import { IRagfairOffer } from "../../ragfair/IRagfairOffer"; -import { Item, Upd } from "./IItem"; -import { IPmcDataRepeatableQuest } from "./IRepeatableQuests"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; +import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; export interface IBotBase { _id: string; aid: number; @@ -17,23 +19,32 @@ export interface IBotBase { Skills: Skills; Stats: Stats; Encyclopedia: Record; - ConditionCounters: ConditionCounters; - BackendCounters: Record; + TaskConditionCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; + /** Achievement id and timestamp */ + Achievements: Record; RepeatableQuests: IPmcDataRepeatableQuest[]; Bonuses: Bonus[]; Notes: Notes; - CarExtractCounts: CarExtractCounts; + CarExtractCounts: Record; + CoopExtractCounts: Record; SurvivorClass: SurvivorClass; WishList: string[]; /** SPT specific property used during bot generation in raid */ sptIsPmc?: boolean; } +export interface ITaskConditionCounter { + id: string; + type: string; + value: number; + /** Quest id */ + sourceId: string; +} export interface IUnlockedInfo { unlockedProductionRecipe: string[]; } @@ -43,6 +54,7 @@ export interface Info { LowerNickname: string; Side: string; SquadInviteRestriction: boolean; + HasCoopExtension: boolean; Voice: string; Level: number; Experience: number; @@ -126,6 +138,7 @@ export interface Inventory { /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ hideoutAreaStashes: Record; fastPanel: Record; + favoriteItems: string[]; } export interface IBaseJsonSkills { Common: Record; @@ -169,6 +182,7 @@ export interface IEftStats { LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem { QuestId: string; @@ -201,14 +215,6 @@ export interface CounterKeyValue { Key: string[]; Value: number; } -export interface ConditionCounters { - Counters: Counter[]; -} -export interface Counter { - id: string; - value: number; - qid: string; -} export interface Aggressor { AccountId: string; ProfileId: string; @@ -301,11 +307,17 @@ export interface Productive { ProductionTime?: number; GivenItemsInStart?: string[]; Interrupted?: boolean; - /** Used in hideout prodiction.json */ + /** Used in hideout production.json */ needFuelForAllProductionTime?: boolean; /** Used when sending data to client */ NeedFuelForAllProductionTime?: boolean; sptIsScavCase?: boolean; + /** Some crafts are always inProgress, but need to be reset, e.g. water collector */ + sptIsComplete?: boolean; + /** Is the craft a Continuous, e.g bitcoins/water collector */ + sptIsContinuous?: boolean; + /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ + sptRequiredTools?: Item[]; } export interface Production extends Productive { RecipeId: string; @@ -325,6 +337,7 @@ export interface HideoutArea { level: number; active: boolean; passiveBonusesEnabled: boolean; + /** Must be integer */ completeTime: number; constructing: boolean; slots: HideoutSlot[]; @@ -360,7 +373,7 @@ export interface IQuestStatus { startTime: number; status: QuestStatus; statusTimers?: Record; - /** SPT specific property */ + /** Property does not exist in live profile data, but is used by ProfileChanges.questsStatus when sent to client*/ completedConditions?: string[]; availableAfter?: number; } @@ -372,14 +385,6 @@ export interface TraderInfo { unlocked: boolean; disabled: boolean; } -/** This object is sent to the client as part of traderRelations */ -export interface TraderData { - salesSum: number; - standing: number; - loyalty: number; - unlocked: boolean; - disabled: boolean; -} export interface RagfairInfo { rating: number; isRatingGrowing: boolean; @@ -387,7 +392,7 @@ export interface RagfairInfo { } export interface Bonus { id?: string; - type: string; + type: BonusType; templateId?: string; passive?: boolean; production?: boolean; @@ -395,7 +400,7 @@ export interface Bonus { value?: number; icon?: string; filter?: string[]; - skillType?: string; + skillType?: BonusSkillType; } export interface Note { Time: number; diff --git a/types/models/eft/common/tables/IBotType.d.ts b/types/models/eft/common/tables/IBotType.d.ts index 7a9fbed..db6e56e 100644 --- a/types/models/eft/common/tables/IBotType.d.ts +++ b/types/models/eft/common/tables/IBotType.d.ts @@ -1,5 +1,5 @@ -import { MinMax } from "../../../common/MinMax"; -import { Skills } from "./IBotBase"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; export interface IBotType { appearance: Appearance; chances: Chances; @@ -15,13 +15,14 @@ export interface IBotType { export interface Appearance { body: Record; feet: Record; - hands: string[]; - head: string[]; - voice: string[]; + hands: Record; + head: Record; + voice: Record; } export interface Chances { equipment: EquipmentChances; - mods: ModsChances; + weaponMods: ModsChances; + equipmentMods: ModsChances; } export interface EquipmentChances { ArmBand: number; @@ -71,6 +72,7 @@ export interface ModsChances { mod_tactical_001: number; mod_tactical_002: number; mod_tactical_003: number; + mod_handguard: number; } export interface Difficulties { easy: Difficulty; @@ -118,7 +120,7 @@ export interface GenerationData { /** key: number of items, value: weighting */ weights: Record; /** Array of item tpls */ - whitelist: string[]; + whitelist: Record; } export interface Health { BodyParts: BodyPart[]; @@ -158,10 +160,10 @@ export interface Equipment { TacticalVest: Record; } export interface Items { - Backpack: string[]; - Pockets: string[]; - SecuredContainer: string[]; - SpecialLoot: string[]; - TacticalVest: string[]; + Backpack: Record; + Pockets: Record; + SecuredContainer: Record; + SpecialLoot: Record; + TacticalVest: Record; } export type Mods = Record>; diff --git a/types/models/eft/common/tables/ICustomizationItem.d.ts b/types/models/eft/common/tables/ICustomizationItem.d.ts index 98f2398..2bab177 100644 --- a/types/models/eft/common/tables/ICustomizationItem.d.ts +++ b/types/models/eft/common/tables/ICustomizationItem.d.ts @@ -1,4 +1,4 @@ -import { Ixyz } from "../Ixyz"; +import { Ixyz } from "@spt-aki/models/eft/common/Ixyz"; export interface ICustomizationItem { _id: string; _name: string; diff --git a/types/models/eft/common/tables/IItem.d.ts b/types/models/eft/common/tables/IItem.d.ts index 09a239c..8f60c4f 100644 --- a/types/models/eft/common/tables/IItem.d.ts +++ b/types/models/eft/common/tables/IItem.d.ts @@ -33,6 +33,7 @@ export interface Upd { Foldable?: Foldable; SideEffect?: SideEffect; RepairKit?: RepairKit; + CultistAmulet?: ICultistAmulet; } export interface Buff { rarity: string; @@ -119,3 +120,6 @@ export interface SideEffect { export interface RepairKit { Resource: number; } +export interface ICultistAmulet { + NumberOfUsages: number; +} diff --git a/types/models/eft/common/tables/ILootBase.d.ts b/types/models/eft/common/tables/ILootBase.d.ts index 681c32f..0bbb91d 100644 --- a/types/models/eft/common/tables/ILootBase.d.ts +++ b/types/models/eft/common/tables/ILootBase.d.ts @@ -1,5 +1,5 @@ -import { Ixyz } from "../Ixyz"; -import { Item } from "./IItem"; +import { Ixyz } from "@spt-aki/models/eft/common/Ixyz"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface ILootBase { staticAmmo: Record; staticContainers: Record; diff --git a/types/models/eft/common/tables/IProfileTemplate.d.ts b/types/models/eft/common/tables/IProfileTemplate.d.ts index 08280e2..9a1eb01 100644 --- a/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -1,16 +1,20 @@ -import { Dialogue, IUserBuilds } from "../../profile/IAkiProfile"; -import { IPmcData } from "../IPmcData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Dialogue, IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IProfileTemplates { Standard: IProfileSides; "Left Behind": IProfileSides; "Prepare To Escape": IProfileSides; "Edge Of Darkness": IProfileSides; + "SPT Developer": IProfileSides; + "SPT Easy start": IProfileSides; + "SPT Zero to hero": IProfileSides; } export interface IProfileSides { - usec: TemplateSide; - bear: TemplateSide; + descriptionLocaleKey: string; + usec: ITemplateSide; + bear: ITemplateSide; } -export interface TemplateSide { +export interface ITemplateSide { character: IPmcData; suits: string[]; dialogues: Record; @@ -18,7 +22,7 @@ export interface TemplateSide { trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { - initialLoyaltyLevel: number; + initialLoyaltyLevel: Record; setQuestsAvailableForStart?: boolean; setQuestsAvailableForFinish?: boolean; initialStanding: number; diff --git a/types/models/eft/common/tables/IQuest.d.ts b/types/models/eft/common/tables/IQuest.d.ts index 300a027..7e576ce 100644 --- a/types/models/eft/common/tables/IQuest.d.ts +++ b/types/models/eft/common/tables/IQuest.d.ts @@ -1,13 +1,13 @@ -import { QuestRewardType } from "../../../enums/QuestRewardType"; -import { QuestStatus } from "../../../enums/QuestStatus"; -import { QuestTypeEnum } from "../../../enums/QuestTypeEnum"; -import { Item } from "./IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { QuestRewardType } from "@spt-aki/models/enums/QuestRewardType"; +import { QuestStatus } from "@spt-aki/models/enums/QuestStatus"; +import { QuestTypeEnum } from "@spt-aki/models/enums/QuestTypeEnum"; export interface IQuest { /** SPT addition - human readable quest name */ QuestName?: string; _id: string; canShowNotificationsInGame: boolean; - conditions: Conditions; + conditions: IQuestConditionTypes; description: string; failMessageText: string; name: string; @@ -24,8 +24,11 @@ export interface IQuest { secretQuest: boolean; startedMessageText: string; successMessageText: string; + acceptPlayerMessage: string; + declinePlayerMessage: string; + completePlayerMessage: string; templateId: string; - rewards: Rewards; + rewards: IQuestRewards; /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; @@ -35,28 +38,24 @@ export interface IQuest { /** Status of quest to player */ sptStatus?: QuestStatus; } -export interface Conditions { - Started: AvailableForConditions[]; - AvailableForFinish: AvailableForConditions[]; - AvailableForStart: AvailableForConditions[]; - Success: AvailableForConditions[]; - Fail: AvailableForConditions[]; +export interface IQuestConditionTypes { + Started: IQuestCondition[]; + AvailableForFinish: IQuestCondition[]; + AvailableForStart: IQuestCondition[]; + Success: IQuestCondition[]; + Fail: IQuestCondition[]; } -export interface AvailableForConditions { - _parent: string; - _props: AvailableForProps; - dynamicLocale?: boolean; -} -export interface AvailableForProps { +export interface IQuestCondition { id: string; - index: number; - parentId: string; - isEncoded: boolean; - dynamicLocale: boolean; - value?: string | number; + index?: number; compareMethod?: string; + dynamicLocale: boolean; visibilityConditions?: VisibilityCondition[]; - target?: string | string[]; + globalQuestCounterId?: string; + parentId?: string; + target: string[] | string; + value?: string | number; + type?: boolean; status?: QuestStatus[]; availableAfter?: number; dispersion?: number; @@ -66,55 +65,81 @@ export interface AvailableForProps { dogtagLevel?: number; maxDurability?: number; minDurability?: number; - counter?: AvailableForCounter; + counter?: IQuestConditionCounter; plantTime?: number; zoneId?: string; - type?: boolean; countInRaid?: boolean; - globalQuestCounterId?: any; + completeInSeconds?: number; + isEncoded?: boolean; + conditionType?: string; } -export interface AvailableForCounter { +export interface IQuestConditionCounter { id: string; - conditions: CounterCondition[]; + conditions: IQuestConditionCounterCondition[]; } -export interface CounterCondition { - _parent: string; - _props: CounterProps; -} -export interface CounterProps { +export interface IQuestConditionCounterCondition { id: string; - target: string[] | string; + dynamicLocale: boolean; + target?: string[] | string; + completeInSeconds?: number; + energy?: IValueCompare; + exitName?: string; + hydration?: IValueCompare; + time?: IValueCompare; compareMethod?: string; - value?: string; + value?: number; weapon?: string[]; + distance?: ICounterConditionDistance; equipmentInclusive?: string[][]; weaponModsInclusive?: string[][]; + weaponModsExclusive?: string[][]; + enemyEquipmentInclusive?: string[][]; + enemyEquipmentExclusive?: string[][]; + weaponCaliber?: string[]; + savageRole?: string[]; status?: string[]; bodyPart?: string[]; - daytime?: DaytimeCounter; + daytime?: IDaytimeCounter; + conditionType?: string; + enemyHealthEffects?: IEnemyHealthEffect[]; + resetOnSessionEnd?: boolean; } -export interface DaytimeCounter { +export interface IEnemyHealthEffect { + bodyParts: string[]; + effects: string[]; +} +export interface IValueCompare { + compareMethod: string; + value: number; +} +export interface ICounterConditionDistance { + value: number; + compareMethod: string; +} +export interface IDaytimeCounter { from: number; to: number; } export interface VisibilityCondition { id: string; - value: number; - dynamicLocale: boolean; + target: string; + value?: number; + dynamicLocale?: boolean; oneSessionOnly: boolean; + conditionType: string; } -export interface Rewards { - AvailableForStart: Reward[]; - AvailableForFinish: Reward[]; - Started: Reward[]; - Success: Reward[]; - Fail: Reward[]; - FailRestartable: Reward[]; - Expired: Reward[]; +export interface IQuestRewards { + AvailableForStart?: IQuestReward[]; + AvailableForFinish?: IQuestReward[]; + Started?: IQuestReward[]; + Success?: IQuestReward[]; + Fail?: IQuestReward[]; + FailRestartable?: IQuestReward[]; + Expired?: IQuestReward[]; } -export interface Reward extends Item { +export interface IQuestReward { value?: string | number; - id: string; + id?: string; type: QuestRewardType; index: number; target?: string; diff --git a/types/models/eft/common/tables/IRepeatableQuests.d.ts b/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..854c8ef 100644 --- a/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -1,21 +1,19 @@ -import { Item } from "./IItem"; -export interface IReward { - index: number; - type: string; - value: number; - target?: string; - items?: Item[]; +import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest"; +export interface IRepeatableQuest extends IQuest { + changeCost: IChangeCost[]; + changeStandingCost: number; + sptRepatableGroupName: string; } export interface IRepeatableQuestDatabase { - templates: ITemplates; + templates: IRepeatableTemplates; rewards: IRewardOptions; data: IOptions; samples: ISampleQuests[]; } -export interface ITemplates { - Elimination: IRepeatableQuest; - Completion: IRepeatableQuest; - Exploration: IRepeatableQuest; +export interface IRepeatableTemplates { + Elimination: IQuest; + Completion: IQuest; + Exploration: IQuest; } export interface IPmcDataRepeatableQuest { id?: string; @@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest { activeQuests: IRepeatableQuest[]; inactiveQuests: IRepeatableQuest[]; endTime: number; - changeRequirement: TChangeRequirementRecord; + changeRequirement: Record; } -export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; @@ -34,151 +31,6 @@ export interface IChangeCost { templateId: string; count: number; } -export interface IRepeatableQuest { - _id: any; - traderId: string; - location: any; - image: string; - type: string; - isKey: boolean; - restartable: boolean; - instantComplete: boolean; - secretQuest: boolean; - canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; - side: string; - name: string; - note: string; - description: string; - successMessageText: string; - failMessageText: string; - startedMessageText: string; - changeQuestMessageText: string; - templateId: string; - changeCost: IChangeCost[]; - changeStandingCost: number; -} -export interface IRewards { - Started: IReward[]; - Success: IReward[]; - Fail: IReward[]; -} -export interface IConditions { - AvailableForStart: any[]; - AvailableForFinish: IAvailableFor[]; - Fail: any[]; -} -export interface IAvailableFor { - _props: IAvailableForProps; - _parent: string; - dynamicLocale: boolean; -} -export interface IAvailableForProps { - id: string; - parentId: string; - dynamicLocale: boolean; - index: number; - visibilityConditions: IVisibilityCondition[]; - value: number; -} -export interface IVisibilityCondition { - id: string; - oneSessionOnly: boolean; - value: number; - index: number; - dynamicLocale: boolean; -} -export interface IAvailableForPropsCounter extends IAvailableForProps { - type: string; - oneSessionOnly: boolean; - doNotResetIfCounterCompleted: boolean; - counter: ICounter; -} -export interface ICounter { - id: string; - conditions: ICondition[]; -} -export interface ICondition { - _props: IConditionProps; - _parent: string; -} -export interface IConditionProps { - id: string; - dynamicLocale: boolean; -} -export interface IElimination extends IRepeatableQuest { - conditions: IEliminationConditions; -} -export interface IEliminationConditions extends IConditions { - AvailableForFinish: IEliminationAvailableFor[]; -} -export interface IEliminationAvailableFor extends IAvailableFor { - _props: IEliminationAvailableForProps; -} -export interface IEliminationAvailableForProps extends IAvailableForPropsCounter { - counter: IEliminationCounter; -} -export interface IEliminationCounter extends ICounter { - conditions: IEliminationCondition[]; -} -export interface IEliminationCondition extends ICondition { - _props: ILocationConditionProps | IKillConditionProps; -} -export interface IExploration extends IRepeatableQuest { - conditions: IExplorationConditions; -} -export interface IExplorationConditions extends IConditions { - AvailableForFinish: IExplorationAvailableFor[]; -} -export interface IExplorationAvailableFor extends IAvailableFor { - _props: IExplorationAvailableForProps; -} -export interface IExplorationAvailableForProps extends IAvailableForPropsCounter { - counter: IExplorationCounter; -} -export interface IExplorationCounter extends ICounter { - conditions: IExplorationCondition[]; -} -export interface IExplorationCondition extends ICondition { - _props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps; -} -export interface ICompletion extends IRepeatableQuest { - conditions: ICompletionConditions; -} -export interface ICompletionConditions extends IConditions { - AvailableForFinish: ICompletionAvailableFor[]; -} -export interface ICompletionAvailableFor extends IAvailableFor { - _props: ICompletionAvailableForProps; -} -export interface ICompletionAvailableForProps extends IAvailableForProps { - target: string[]; - minDurability: number; - maxDurability: number; - dogtagLevel: number; - onlyFoundInRaid: boolean; -} -export interface ILocationConditionProps extends IConditionProps { - target: string[]; -} -export interface IKillConditionProps extends IConditionProps { - target: string; - value: number; - savageRole?: string[]; - bodyPart?: string[]; - distance?: IDistanceCheck; -} -export interface IDistanceCheck { - compareMethod: string; - value: number; -} -export interface IExitStatusConditionProps extends IConditionProps { - status: string[]; -} -export interface IExitNameConditionProps extends IConditionProps { - exitName: string; -} export interface IRewardOptions { itemsBlacklist: string[]; } @@ -208,8 +60,8 @@ export interface ISampleQuests { instantComplete: boolean; secretQuest: boolean; canShowNotificationsInGame: boolean; - rewards: IRewards; - conditions: IConditions; + rewards: IQuestRewards; + conditions: IQuestConditionTypes; name: string; note: string; description: string; diff --git a/types/models/eft/common/tables/ITemplateItem.d.ts b/types/models/eft/common/tables/ITemplateItem.d.ts index 147847b..2ccecbe 100644 --- a/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/types/models/eft/common/tables/ITemplateItem.d.ts @@ -1,4 +1,4 @@ -import { Ixyz } from "../Ixyz"; +import { Ixyz } from "@spt-aki/models/eft/common/Ixyz"; export interface ITemplateItem { _id: string; _name: string; @@ -82,6 +82,7 @@ export interface Props { EffectiveDistance?: number; Ergonomics?: number; Velocity?: number; + WithAnimatorAiming?: boolean; RaidModdable?: boolean; ToolModdable?: boolean; UniqueAnimationModID?: number; @@ -155,6 +156,8 @@ export interface Props { BlocksArmorVest?: boolean; speedPenaltyPercent?: number; GridLayoutName?: string; + ContainerSpawnChanceModifier?: number; + SpawnExcludedFilter?: string[]; SpawnFilter?: any[]; containType?: any[]; sizeWidth?: number; @@ -170,6 +173,9 @@ export interface Props { MaxDurability?: number; armorZone?: string[]; armorClass?: string | number; + armorColliders?: string[]; + armorPlateColliders?: string[]; + bluntDamageReduceFromSoftArmor?: boolean; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -179,14 +185,17 @@ export interface Props { weapUseType?: string; ammoCaliber?: string; OperatingResource?: number; + PostRecoilHorizontalRangeHandRotation?: Ixyz; + PostRecoilVerticalRangeHandRotation?: Ixyz; + ProgressRecoilAngleOnStable?: Ixyz; RepairComplexity?: number; durabSpawnMin?: number; durabSpawnMax?: number; isFastReload?: boolean; RecoilForceUp?: number; RecoilForceBack?: number; - Convergence?: number; RecoilAngle?: number; + RecoilCamera?: number; weapFireType?: string[]; RecolDispersion?: number; SingleFireRate?: number; @@ -194,6 +203,7 @@ export interface Props { bFirerate?: number; bEffDist?: number; bHearDist?: number; + blockLeftStance?: boolean; isChamberLoad?: boolean; chamberAmmoCount?: number; isBoltCatch?: boolean; @@ -202,8 +212,9 @@ export interface Props { AdjustCollimatorsToTrajectory?: boolean; shotgunDispersion?: number; Chambers?: Slot[]; - CameraRecoil?: number; CameraSnap?: number; + CameraToWeaponAngleSpeedRange?: Ixyz; + CameraToWeaponAngleStep?: number; ReloadMode?: string; AimPlane?: number; TacticalReloadStiffnes?: Ixyz; @@ -211,6 +222,7 @@ export interface Props { RecoilCenter?: Ixyz; RotationCenter?: Ixyz; RotationCenterNoStock?: Ixyz; + ShotsGroupSettings?: IShotsGroupSettings[]; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; @@ -242,6 +254,11 @@ export interface Props { AllowOverheat?: boolean; DoubleActionAccuracyPenalty?: number; RecoilPosZMult?: number; + RecoilReturnPathDampingHandRotation?: number; + RecoilReturnPathOffsetHandRotation?: number; + RecoilReturnSpeedHandRotation?: number; + RecoilStableAngleIncreaseStep?: number; + RecoilStableIndexShot?: number; MinRepairKitDegradation?: number; MaxRepairKitDegradation?: number; BlocksEarpiece?: boolean; @@ -386,6 +403,15 @@ export interface Props { LinkedWeapon?: string; UseAmmoWithoutShell?: boolean; RandomLootSettings?: IRandomLootSettings; + RecoilCategoryMultiplierHandRotation?: number; + RecoilDampingHandRotation?: number; + LeanWeaponAgainstBody?: boolean; + RemoveShellAfterFire?: boolean; + RepairStrategyTypes?: string[]; + IsEncoded?: boolean; + LayoutName?: string; + Lower75Prefab?: Prefab; + MaxUsages?: number; } export interface IHealthEffect { type: string; @@ -430,6 +456,10 @@ export interface SlotProps { } export interface SlotFilter { Shift?: number; + locked?: boolean; + Plate?: string; + armorColliders?: string[]; + armorPlateColliders?: string[]; Filter: string[]; AnimationIndex?: number; } @@ -490,3 +520,10 @@ export interface IColor { b: number; a: number; } +export interface IShotsGroupSettings { + EndShotIndex: number; + ShotRecoilPositionStrength: Ixyz; + ShotRecoilRadianRange: Ixyz; + ShotRecoilRotationStrength: Ixyz; + StartShotIndex: number; +} diff --git a/types/models/eft/common/tables/ITrader.d.ts b/types/models/eft/common/tables/ITrader.d.ts index 10c32f1..38f2a43 100644 --- a/types/models/eft/common/tables/ITrader.d.ts +++ b/types/models/eft/common/tables/ITrader.d.ts @@ -1,10 +1,12 @@ -import { Item } from "./IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; export interface ITrader { - assort: ITraderAssort; + assort?: ITraderAssort; base: ITraderBase; dialogue?: Record; - questassort: Record>; + questassort?: Record>; suits?: ISuit[]; + services?: ITraderServiceModel[]; } export interface ITraderBase { refreshTraderRagfairOffers: boolean; diff --git a/types/models/eft/dialog/IGetAllAttachmentsResponse.d.ts b/types/models/eft/dialog/IGetAllAttachmentsResponse.d.ts index 076d414..2ddcf83 100644 --- a/types/models/eft/dialog/IGetAllAttachmentsResponse.d.ts +++ b/types/models/eft/dialog/IGetAllAttachmentsResponse.d.ts @@ -1,4 +1,4 @@ -import { Message } from "../profile/IAkiProfile"; +import { Message } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IGetAllAttachmentsResponse { messages: Message[]; profiles: any[]; diff --git a/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index c558a41..271be79 100644 --- a/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,4 +1,4 @@ -import { IUserDialogInfo } from "../profile/IAkiProfile"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IGetFriendListDataResponse { Friends: IUserDialogInfo[]; Ignore: string[]; diff --git a/types/models/eft/dialog/IGetMailDialogViewRequestData.d.ts b/types/models/eft/dialog/IGetMailDialogViewRequestData.d.ts index 43d416e..3a2e349 100644 --- a/types/models/eft/dialog/IGetMailDialogViewRequestData.d.ts +++ b/types/models/eft/dialog/IGetMailDialogViewRequestData.d.ts @@ -1,4 +1,4 @@ -import { MessageType } from "../../enums/MessageType"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; export interface IGetMailDialogViewRequestData { type: MessageType; dialogId: string; diff --git a/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts b/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts index b469dee..091c128 100644 --- a/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts +++ b/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts @@ -1,4 +1,4 @@ -import { IUserDialogInfo, Message } from "../profile/IAkiProfile"; +import { IUserDialogInfo, Message } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IGetMailDialogViewResponseData { messages: Message[]; profiles: IUserDialogInfo[]; diff --git a/types/models/eft/dialog/ISendMessageRequest.d.ts b/types/models/eft/dialog/ISendMessageRequest.d.ts index dd79deb..5a755c0 100644 --- a/types/models/eft/dialog/ISendMessageRequest.d.ts +++ b/types/models/eft/dialog/ISendMessageRequest.d.ts @@ -1,4 +1,4 @@ -import { MessageType } from "../../enums/MessageType"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; export interface ISendMessageRequest { dialogId: string; type: MessageType; diff --git a/types/models/eft/game/ICurrentGroupResponse.d.ts b/types/models/eft/game/ICurrentGroupResponse.d.ts index 1f496fa..85c005b 100644 --- a/types/models/eft/game/ICurrentGroupResponse.d.ts +++ b/types/models/eft/game/ICurrentGroupResponse.d.ts @@ -1,6 +1,6 @@ -import { MemberCategory } from "../../../models/enums/MemberCategory"; +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; export interface ICurrentGroupResponse { - squad: any[]; + squad: ICurrentGroupSquadMember[]; } export interface ICurrentGroupSquadMember { _id: string; diff --git a/types/models/eft/game/IGetRaidTimeRequest.d.ts b/types/models/eft/game/IGetRaidTimeRequest.d.ts new file mode 100644 index 0000000..b93fb0c --- /dev/null +++ b/types/models/eft/game/IGetRaidTimeRequest.d.ts @@ -0,0 +1,4 @@ +export interface IGetRaidTimeRequest { + Side: string; + Location: string; +} diff --git a/types/models/eft/game/IGetRaidTimeResponse.d.ts b/types/models/eft/game/IGetRaidTimeResponse.d.ts new file mode 100644 index 0000000..4dcf0a0 --- /dev/null +++ b/types/models/eft/game/IGetRaidTimeResponse.d.ts @@ -0,0 +1,12 @@ +export interface IGetRaidTimeResponse { + RaidTimeMinutes: number; + NewSurviveTimeSeconds: number; + OriginalSurvivalTimeSeconds: number; + ExitChanges: ExtractChange[]; +} +export interface ExtractChange { + Name: string; + MinTime?: number; + MaxTime?: number; + Chance?: number; +} diff --git a/types/models/eft/health/IOffraidEatRequestData.d.ts b/types/models/eft/health/IOffraidEatRequestData.d.ts index 8e2b6c3..0629f8b 100644 --- a/types/models/eft/health/IOffraidEatRequestData.d.ts +++ b/types/models/eft/health/IOffraidEatRequestData.d.ts @@ -1,4 +1,4 @@ -import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"; +import { IBaseInteractionRequestData } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface IOffraidEatRequestData extends IBaseInteractionRequestData { Action: "Eat"; item: string; diff --git a/types/models/eft/health/IOffraidHealRequestData.d.ts b/types/models/eft/health/IOffraidHealRequestData.d.ts index 26b02bd..47b7929 100644 --- a/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -1,4 +1,4 @@ -import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"; +import { IBaseInteractionRequestData } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface IOffraidHealRequestData extends IBaseInteractionRequestData { Action: "Heal"; item: string; diff --git a/types/models/eft/hideout/IHideoutArea.d.ts b/types/models/eft/hideout/IHideoutArea.d.ts index bb00498..212d2ab 100644 --- a/types/models/eft/hideout/IHideoutArea.d.ts +++ b/types/models/eft/hideout/IHideoutArea.d.ts @@ -1,3 +1,5 @@ +import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; export interface IHideoutArea { _id: string; type: number; @@ -66,8 +68,8 @@ export interface StageBonus { passive: boolean; production: boolean; visible: boolean; - skillType?: string; - type: string; + skillType?: BonusSkillType; + type: BonusType; filter?: string[]; icon?: string; /** CHANGES PER DUMP */ diff --git a/types/models/eft/hideout/IHideoutCancelProductionRequestData.d.ts b/types/models/eft/hideout/IHideoutCancelProductionRequestData.d.ts new file mode 100644 index 0000000..4946cc6 --- /dev/null +++ b/types/models/eft/hideout/IHideoutCancelProductionRequestData.d.ts @@ -0,0 +1,5 @@ +export interface IHideoutCancelProductionRequestData { + Action: "HideoutCancelProductionCommand"; + recipeId: string; + timestamp: number; +} diff --git a/types/models/eft/hideout/IHideoutProduction.d.ts b/types/models/eft/hideout/IHideoutProduction.d.ts index 8bed3cc..7373a4f 100644 --- a/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,6 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; + /** Tpl of item being crafted */ endProduct: string; isEncoded: boolean; locked: boolean; diff --git a/types/models/eft/hideout/IHideoutScavCase.d.ts b/types/models/eft/hideout/IHideoutScavCase.d.ts index e0b9a27..5c8b983 100644 --- a/types/models/eft/hideout/IHideoutScavCase.d.ts +++ b/types/models/eft/hideout/IHideoutScavCase.d.ts @@ -1,4 +1,4 @@ -import { MinMax } from "../../common/MinMax"; +import { MinMax } from "@spt-aki/models/common/MinMax"; export interface IHideoutScavCase { _id: string; ProductionTime: number; diff --git a/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts b/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts index 1ed542a..dfb92e2 100644 --- a/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts +++ b/types/models/eft/hideout/IHideoutSingleProductionStartRequestData.d.ts @@ -2,6 +2,7 @@ export interface IHideoutSingleProductionStartRequestData { Action: "HideoutSingleProductionStart"; recipeId: string; items: Item[]; + tools: Item[]; timestamp: number; } export interface Item { diff --git a/types/models/eft/hideout/IQteData.d.ts b/types/models/eft/hideout/IQteData.d.ts index f842b84..bb29c5f 100644 --- a/types/models/eft/hideout/IQteData.d.ts +++ b/types/models/eft/hideout/IQteData.d.ts @@ -1,38 +1,108 @@ +import { Effect } from "@spt-aki/models/eft/health/Effect"; +import { BodyPart } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { QteActivityType } from "@spt-aki/models/enums/hideout/QteActivityType"; +import { QteEffectType } from "@spt-aki/models/enums/hideout/QteEffectType"; +import { QteResultType } from "@spt-aki/models/enums/hideout/QteResultType"; +import { QteRewardType } from "@spt-aki/models/enums/hideout/QteRewardType"; +import { QteType } from "@spt-aki/models/enums/hideout/QteType"; +import { RequirementType } from "@spt-aki/models/enums/hideout/RequirementType"; export interface IQteData { - Id: string; - Type: string; - Area: string; - AreaLevel: number; - QuickTimeEvents: IQuickTimeEvent[]; - Requirements: IQteRequirement[]; - Results: Record; + id: string; + type: QteActivityType; + area: HideoutAreas; + areaLevel: number; + quickTimeEvents: IQuickTimeEvent[]; + requirements: (IAreaRequirement | IItemRequirement | ITraderUnlockRequirement | ITraderLoyaltyRequirement | ISkillRequirement | IResourceRequirement | IToolRequirement | IQuestRequirement | IHealthRequirement | IBodyPartBuffRequirement)[]; + results: Record; } export interface IQuickTimeEvent { - Type: string; - Position: number; - StartDelay: number; - EndDelay: number; - Speed: number; - SuccessRange: string; - Key: string; + type: QteType; + position: { + x: number; + y: number; + }; + startDelay: number; + endDelay: number; + speed: number; + successRange: { + x: number; + y: number; + }; + key: string; } export interface IQteRequirement { - type: string; + type: RequirementType; } export interface IQteResult { - Energy: number; - Hydration: number; - RewardsRange: IQteEffect[]; + energy: number; + hydration: number; + rewardsRange: IQteEffect[]; } export interface IQteEffect { - Type: string; - SkillId: string; + type: QteRewardType; + skillId: number; levelMultipliers: ISkillLevelMultiplier[]; - Time: number; - Weight: number; - Result: string; + time: number; + weight: number; + result: QteResultType; } export interface ISkillLevelMultiplier { level: number; multiplier: number; } +export interface IAreaRequirement extends IQteRequirement { + type: RequirementType.AREA; + areaType: HideoutAreas; + requiredLevel: number; +} +export interface ITraderUnlockRequirement extends IQteRequirement { + type: RequirementType.TRADER_UNLOCK; + traderId: Traders; +} +export interface ITraderLoyaltyRequirement extends IQteRequirement { + type: RequirementType.TRADER_LOYALTY; + traderId: Traders; + loyaltyLevel: number; +} +export interface ISkillRequirement extends IQteRequirement { + type: RequirementType.SKILL; + skillName: SkillTypes; + skillLevel: number; +} +export interface IResourceRequirement extends IQteRequirement { + type: RequirementType.RESOURCE; + templateId: string; + resource: number; +} +export interface IItemRequirement extends IQteRequirement { + type: RequirementType.ITEM; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IToolRequirement extends IQteRequirement { + type: RequirementType.TOOL; + templateId: string; + count: number; + isFunctional: boolean; + isEncoded: boolean; +} +export interface IQuestRequirement extends IQteRequirement { + type: RequirementType.QUEST_COMPLETE; + questId: string; +} +export interface IHealthRequirement extends IQteRequirement { + type: RequirementType.HEALTH; + energy: number; + hydration: number; +} +export interface IBodyPartBuffRequirement extends IQteRequirement { + type: RequirementType.BODY_PART_BUFF; + effectName: Effect; + bodyPart: BodyPart; + excluded: boolean; +} diff --git a/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts b/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts new file mode 100644 index 0000000..451a6f2 --- /dev/null +++ b/types/models/eft/inRaid/IItemDeliveryRequestData.d.ts @@ -0,0 +1,5 @@ +import { Item } from "../common/tables/IItem"; +export interface IItemDeliveryRequestData { + items: Item[]; + traderId: string; +} diff --git a/types/models/eft/inRaid/ISaveProgressRequestData.d.ts b/types/models/eft/inRaid/ISaveProgressRequestData.d.ts index 3fdc994..c658257 100644 --- a/types/models/eft/inRaid/ISaveProgressRequestData.d.ts +++ b/types/models/eft/inRaid/ISaveProgressRequestData.d.ts @@ -1,7 +1,7 @@ -import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; -import { IPostRaidPmcData } from "../common/IPmcData"; -import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; -import { IInsuredItemsData } from "./IInsuredItemsData"; +import { IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ISyncHealthRequestData } from "@spt-aki/models/eft/health/ISyncHealthRequestData"; +import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; +import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; export interface ISaveProgressRequestData { exit: PlayerRaidEndState; profile: IPostRaidPmcData; diff --git a/types/models/eft/insurance/IInsureRequestData.d.ts b/types/models/eft/insurance/IInsureRequestData.d.ts index f657bb7..f739ced 100644 --- a/types/models/eft/insurance/IInsureRequestData.d.ts +++ b/types/models/eft/insurance/IInsureRequestData.d.ts @@ -1,4 +1,4 @@ -import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"; +import { IBaseInteractionRequestData } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface IInsureRequestData extends IBaseInteractionRequestData { Action: "Insure"; tid: string; diff --git a/types/models/eft/inventory/IAddItemDirectRequest.d.ts b/types/models/eft/inventory/IAddItemDirectRequest.d.ts new file mode 100644 index 0000000..6459a79 --- /dev/null +++ b/types/models/eft/inventory/IAddItemDirectRequest.d.ts @@ -0,0 +1,8 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemDirectRequest { + /** Item and child mods to add to player inventory */ + itemWithModsToAdd: Item[]; + foundInRaid: boolean; + callback: (buyCount: number) => void; + useSortingTable: boolean; +} diff --git a/types/models/eft/inventory/IAddItemRequestData.d.ts b/types/models/eft/inventory/IAddItemRequestData.d.ts index 24f3e31..3fa86dc 100644 --- a/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -5,6 +5,6 @@ export interface IAddItemRequestData { } export interface AddItem { count: number; - isPreset?: boolean; + sptIsPreset?: boolean; item_id: string; } diff --git a/types/models/eft/inventory/IAddItemTempObject.d.ts b/types/models/eft/inventory/IAddItemTempObject.d.ts index 12535ed..c818be6 100644 --- a/types/models/eft/inventory/IAddItemTempObject.d.ts +++ b/types/models/eft/inventory/IAddItemTempObject.d.ts @@ -1,4 +1,4 @@ -import { Item, Location } from "../common/tables/IItem"; +import { Item, Location } from "@spt-aki/models/eft/common/tables/IItem"; export interface IAddItemTempObject { itemRef: Item; count: number; diff --git a/types/models/eft/inventory/IAddItemsDirectRequest.d.ts b/types/models/eft/inventory/IAddItemsDirectRequest.d.ts new file mode 100644 index 0000000..c19ba2f --- /dev/null +++ b/types/models/eft/inventory/IAddItemsDirectRequest.d.ts @@ -0,0 +1,10 @@ +import { Item } from "../common/tables/IItem"; +export interface IAddItemsDirectRequest { + /** Item and child mods to add to player inventory */ + itemsWithModsToAdd: Item[][]; + foundInRaid: boolean; + /** Runs after EACH item with children is added */ + callback: (buyCount: number) => void; + /** Should sorting table be used when no space found in stash */ + useSortingTable: boolean; +} diff --git a/types/models/eft/inventory/IInventoryAddRequestData.d.ts b/types/models/eft/inventory/IInventoryAddRequestData.d.ts index 462e0de..2b90edb 100644 --- a/types/models/eft/inventory/IInventoryAddRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryAddRequestData.d.ts @@ -1,4 +1,4 @@ -import { Container, IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { Container, IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryAddRequestData extends IInventoryBaseActionRequestData { Action: "Add"; item: string; diff --git a/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index 6d8a172..7e67a56 100644 --- a/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -1,4 +1,4 @@ -import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"; +import { IBaseInteractionRequestData } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface IInventoryBaseActionRequestData extends IBaseInteractionRequestData { } export interface To { diff --git a/types/models/eft/inventory/IInventoryBindRequestData.d.ts b/types/models/eft/inventory/IInventoryBindRequestData.d.ts index ff35066..efa1a43 100644 --- a/types/models/eft/inventory/IInventoryBindRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryBindRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryBindRequestData extends IInventoryBaseActionRequestData { Action: "Bind"; item: string; diff --git a/types/models/eft/inventory/IInventoryCreateMarkerRequestData.d.ts b/types/models/eft/inventory/IInventoryCreateMarkerRequestData.d.ts index 1e1ecef..805b385 100644 --- a/types/models/eft/inventory/IInventoryCreateMarkerRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryCreateMarkerRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryCreateMarkerRequestData extends IInventoryBaseActionRequestData { Action: "CreateMapMarker"; item: string; diff --git a/types/models/eft/inventory/IInventoryDeleteMarkerRequestData.d.ts b/types/models/eft/inventory/IInventoryDeleteMarkerRequestData.d.ts index 0657e1b..e85f094 100644 --- a/types/models/eft/inventory/IInventoryDeleteMarkerRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryDeleteMarkerRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryDeleteMarkerRequestData extends IInventoryBaseActionRequestData { Action: "DeleteMapMarker"; item: string; diff --git a/types/models/eft/inventory/IInventoryEditMarkerRequestData.d.ts b/types/models/eft/inventory/IInventoryEditMarkerRequestData.d.ts index e2857e1..d8080f5 100644 --- a/types/models/eft/inventory/IInventoryEditMarkerRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryEditMarkerRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryEditMarkerRequestData extends IInventoryBaseActionRequestData { Action: "EditMapMarker"; item: string; diff --git a/types/models/eft/inventory/IInventoryExamineRequestData.d.ts b/types/models/eft/inventory/IInventoryExamineRequestData.d.ts index 0d5f2db..07b0c03 100644 --- a/types/models/eft/inventory/IInventoryExamineRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryExamineRequestData.d.ts @@ -1,5 +1,5 @@ -import { OwnerInfo } from "../common/request/IBaseInteractionRequestData"; -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryExamineRequestData extends IInventoryBaseActionRequestData { Action: "Examine"; item: string; diff --git a/types/models/eft/inventory/IInventoryFoldRequestData.d.ts b/types/models/eft/inventory/IInventoryFoldRequestData.d.ts index a5fb2a1..7623a90 100644 --- a/types/models/eft/inventory/IInventoryFoldRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryFoldRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryFoldRequestData extends IInventoryBaseActionRequestData { Action: "Fold"; item: string; diff --git a/types/models/eft/inventory/IInventoryMergeRequestData.d.ts b/types/models/eft/inventory/IInventoryMergeRequestData.d.ts index 3fcfa35..af4e722 100644 --- a/types/models/eft/inventory/IInventoryMergeRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryMergeRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryMergeRequestData extends IInventoryBaseActionRequestData { Action: "Merge"; item: string; diff --git a/types/models/eft/inventory/IInventoryMoveRequestData.d.ts b/types/models/eft/inventory/IInventoryMoveRequestData.d.ts index b767908..9038510 100644 --- a/types/models/eft/inventory/IInventoryMoveRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryMoveRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData, To } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData, To } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryMoveRequestData extends IInventoryBaseActionRequestData { Action: "Move"; item: string; diff --git a/types/models/eft/inventory/IInventoryReadEncyclopediaRequestData.d.ts b/types/models/eft/inventory/IInventoryReadEncyclopediaRequestData.d.ts index 5487b20..6432159 100644 --- a/types/models/eft/inventory/IInventoryReadEncyclopediaRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryReadEncyclopediaRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryReadEncyclopediaRequestData extends IInventoryBaseActionRequestData { Action: "ReadEncyclopedia"; ids: string[]; diff --git a/types/models/eft/inventory/IInventoryRemoveRequestData.d.ts b/types/models/eft/inventory/IInventoryRemoveRequestData.d.ts index 07d1a52..eda96e6 100644 --- a/types/models/eft/inventory/IInventoryRemoveRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryRemoveRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryRemoveRequestData extends IInventoryBaseActionRequestData { Action: "Remove"; item: string; diff --git a/types/models/eft/inventory/IInventorySortRequestData.d.ts b/types/models/eft/inventory/IInventorySortRequestData.d.ts index a0b7928..b34bb25 100644 --- a/types/models/eft/inventory/IInventorySortRequestData.d.ts +++ b/types/models/eft/inventory/IInventorySortRequestData.d.ts @@ -1,5 +1,5 @@ -import { Upd } from "../common/tables/IItem"; -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventorySortRequestData extends IInventoryBaseActionRequestData { Action: "ApplyInventoryChanges"; changedItems: ChangedItem[]; diff --git a/types/models/eft/inventory/IInventorySplitRequestData.d.ts b/types/models/eft/inventory/IInventorySplitRequestData.d.ts index 1ba0065..4d29084 100644 --- a/types/models/eft/inventory/IInventorySplitRequestData.d.ts +++ b/types/models/eft/inventory/IInventorySplitRequestData.d.ts @@ -1,4 +1,4 @@ -import { Container, IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { Container, IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventorySplitRequestData extends IInventoryBaseActionRequestData { Action: "Split"; /** Id of item to split */ diff --git a/types/models/eft/inventory/IInventorySwapRequestData.d.ts b/types/models/eft/inventory/IInventorySwapRequestData.d.ts index 1b0464d..b32a1f7 100644 --- a/types/models/eft/inventory/IInventorySwapRequestData.d.ts +++ b/types/models/eft/inventory/IInventorySwapRequestData.d.ts @@ -1,5 +1,5 @@ -import { OwnerInfo } from "../common/request/IBaseInteractionRequestData"; -import { IInventoryBaseActionRequestData, To } from "./IInventoryBaseActionRequestData"; +import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; +import { IInventoryBaseActionRequestData, To } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventorySwapRequestData extends IInventoryBaseActionRequestData { Action: "Swap"; item: string; diff --git a/types/models/eft/inventory/IInventoryTagRequestData.d.ts b/types/models/eft/inventory/IInventoryTagRequestData.d.ts index f021661..5d88eaf 100644 --- a/types/models/eft/inventory/IInventoryTagRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryTagRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryTagRequestData extends IInventoryBaseActionRequestData { Action: "Tag"; item: string; diff --git a/types/models/eft/inventory/IInventoryToggleRequestData.d.ts b/types/models/eft/inventory/IInventoryToggleRequestData.d.ts index 0955440..138d987 100644 --- a/types/models/eft/inventory/IInventoryToggleRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryToggleRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryToggleRequestData extends IInventoryBaseActionRequestData { Action: "Toggle"; item: string; diff --git a/types/models/eft/inventory/IInventoryTransferRequestData.d.ts b/types/models/eft/inventory/IInventoryTransferRequestData.d.ts index cf4391b..e98cae6 100644 --- a/types/models/eft/inventory/IInventoryTransferRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryTransferRequestData.d.ts @@ -1,4 +1,4 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IInventoryTransferRequestData extends IInventoryBaseActionRequestData { Action: "Transfer"; item: string; diff --git a/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts b/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts new file mode 100644 index 0000000..e303acf --- /dev/null +++ b/types/models/eft/inventory/IInventoryUnbindRequestData.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; +export interface IInventoryUnbindRequestData extends IInventoryBaseActionRequestData { + Action: "Unbind"; + item: string; + index: number; +} diff --git a/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts index 3c45124..a7ec78b 100644 --- a/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts +++ b/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -1,7 +1,7 @@ -import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +import { IInventoryBaseActionRequestData } from "@spt-aki/models/eft/inventory/IInventoryBaseActionRequestData"; export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { Action: "OpenRandomLootContainer"; - /** Container item opened */ + /** Container item id being opened */ item: string; to: To[]; } diff --git a/types/models/eft/inventory/IRedeemProfileRequestData.d.ts b/types/models/eft/inventory/IRedeemProfileRequestData.d.ts new file mode 100644 index 0000000..d351a8c --- /dev/null +++ b/types/models/eft/inventory/IRedeemProfileRequestData.d.ts @@ -0,0 +1,9 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IRedeemProfileRequestData extends IInventoryBaseActionRequestData { + Action: "RedeemProfileReward"; + events: IRedeemProfileRequestEvent[]; +} +export interface IRedeemProfileRequestEvent { + MessageId: string; + EventId: string; +} diff --git a/types/models/eft/inventory/ISetFavoriteItems.d.ts b/types/models/eft/inventory/ISetFavoriteItems.d.ts new file mode 100644 index 0000000..aacbb39 --- /dev/null +++ b/types/models/eft/inventory/ISetFavoriteItems.d.ts @@ -0,0 +1,6 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface ISetFavoriteItems extends IInventoryBaseActionRequestData { + Action: "SetFavoriteItems"; + items: any[]; + timestamp: number; +} diff --git a/types/models/eft/itemEvent/IEmptyItemEventRouterResponse.d.ts b/types/models/eft/itemEvent/IEmptyItemEventRouterResponse.d.ts index 689fe75..f81bd59 100644 --- a/types/models/eft/itemEvent/IEmptyItemEventRouterResponse.d.ts +++ b/types/models/eft/itemEvent/IEmptyItemEventRouterResponse.d.ts @@ -1,4 +1,4 @@ -import { IItemEventRouterBase } from "./IItemEventRouterBase"; +import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; export interface IEmptyItemEventRouterResponse extends IItemEventRouterBase { profileChanges: ""; } diff --git a/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 8591294..a1babfd 100644 --- a/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -1,9 +1,9 @@ -import { EquipmentBuildType } from "../../../models/enums/EquipmentBuildType"; -import { Health, IQuestStatus, Productive, Skills, TraderData } from "../common/tables/IBotBase"; -import { Item, Upd } from "../common/tables/IItem"; -import { IQuest } from "../common/tables/IQuest"; -import { IPmcDataRepeatableQuest } from "../common/tables/IRepeatableQuests"; -import { IRagfairOffer } from "../ragfair/IRagfairOffer"; +import { Health, IQuestStatus, Productive, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem"; +import { IQuest } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { EquipmentBuildType } from "@spt-aki/models/enums/EquipmentBuildType"; export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; @@ -62,6 +62,14 @@ export interface Improvement { completed: boolean; improveCompleteTimestamp: number; } +/** Related to TraderInfo */ +export interface TraderData { + salesSum: number; + standing: number; + loyalty: number; + unlocked: boolean; + disabled: boolean; +} export interface Product { _id: string; _tpl?: string; diff --git a/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts b/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts index 72a9b5b..bcf26ef 100644 --- a/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts +++ b/types/models/eft/itemEvent/IItemEventRouterResponse.d.ts @@ -1,3 +1,4 @@ -import { IItemEventRouterBase } from "./IItemEventRouterBase"; +import { IItemEventRouterBase } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +/** An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync */ export interface IItemEventRouterResponse extends IItemEventRouterBase { } diff --git a/types/models/eft/launcher/IChangeRequestData.d.ts b/types/models/eft/launcher/IChangeRequestData.d.ts index f0a7838..b1b3e94 100644 --- a/types/models/eft/launcher/IChangeRequestData.d.ts +++ b/types/models/eft/launcher/IChangeRequestData.d.ts @@ -1,4 +1,4 @@ -import { ILoginRequestData } from "./ILoginRequestData"; +import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData"; export interface IChangeRequestData extends ILoginRequestData { change: string; } diff --git a/types/models/eft/launcher/IRegisterData.d.ts b/types/models/eft/launcher/IRegisterData.d.ts index 61a8bbe..b69d9ed 100644 --- a/types/models/eft/launcher/IRegisterData.d.ts +++ b/types/models/eft/launcher/IRegisterData.d.ts @@ -1,4 +1,4 @@ -import { ILoginRequestData } from "./ILoginRequestData"; +import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData"; export interface IRegisterData extends ILoginRequestData { edition: string; } diff --git a/types/models/eft/launcher/IRemoveProfileData.d.ts b/types/models/eft/launcher/IRemoveProfileData.d.ts index 4cc5618..2ad9694 100644 --- a/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ -import { ILoginRequestData } from "./ILoginRequestData"; +import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData"; export type IRemoveProfileData = ILoginRequestData; diff --git a/types/models/eft/location/IAirdropLootResult.d.ts b/types/models/eft/location/IAirdropLootResult.d.ts index 6db4b16..219ee7e 100644 --- a/types/models/eft/location/IAirdropLootResult.d.ts +++ b/types/models/eft/location/IAirdropLootResult.d.ts @@ -1,4 +1,4 @@ -import { LootItem } from "../../../models/spt/services/LootItem"; +import { LootItem } from "@spt-aki/models/spt/services/LootItem"; export interface IAirdropLootResult { dropType: string; loot: LootItem[]; diff --git a/types/models/eft/match/ICreateGroupRequestData.d.ts b/types/models/eft/match/ICreateGroupRequestData.d.ts index 7413a8a..322a095 100644 --- a/types/models/eft/match/ICreateGroupRequestData.d.ts +++ b/types/models/eft/match/ICreateGroupRequestData.d.ts @@ -1,4 +1,4 @@ -import { RaidMode } from "../../enums/RaidMode"; +import { RaidMode } from "@spt-aki/models/enums/RaidMode"; export interface ICreateGroupRequestData { location: string; raidMode: RaidMode; diff --git a/types/models/eft/match/IDeclineGroupInviteRequest.d.ts b/types/models/eft/match/IDeclineGroupInviteRequest.d.ts new file mode 100644 index 0000000..4f46590 --- /dev/null +++ b/types/models/eft/match/IDeclineGroupInviteRequest.d.ts @@ -0,0 +1,2 @@ +export interface IDeclineGroupInviteRequest { +} diff --git a/types/models/eft/match/IGetGroupStatusRequestData.d.ts b/types/models/eft/match/IGetGroupStatusRequestData.d.ts index 911c040..28b9500 100644 --- a/types/models/eft/match/IGetGroupStatusRequestData.d.ts +++ b/types/models/eft/match/IGetGroupStatusRequestData.d.ts @@ -1,4 +1,4 @@ -import { RaidMode } from "../../enums/RaidMode"; +import { RaidMode } from "@spt-aki/models/enums/RaidMode"; export interface IGetGroupStatusRequestData { location: string; savage: boolean; diff --git a/types/models/eft/match/IGetGroupStatusResponse.d.ts b/types/models/eft/match/IGetGroupStatusResponse.d.ts new file mode 100644 index 0000000..8209ef5 --- /dev/null +++ b/types/models/eft/match/IGetGroupStatusResponse.d.ts @@ -0,0 +1,19 @@ +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; +export interface IGetGroupStatusResponse { + players: IPlayer[]; + maxPveCountExceeded: boolean; +} +export interface IPlayer { + aid: string; + _id: string; + lookingGroup: boolean; + IsLeader: boolean; + IsReady: boolean; + Info: ICurrentGroupMemberInfo; +} +export interface ICurrentGroupMemberInfo { + Nickname: string; + Side: string; + Level: string; + MemberCategory: MemberCategory; +} diff --git a/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts b/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts index ed3dfab..bdc9b46 100644 --- a/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts +++ b/types/models/eft/match/IGetRaidConfigurationRequestData.d.ts @@ -9,6 +9,8 @@ export interface IGetRaidConfigurationRequestData { timeAndWeatherSettings: TimeAndWeatherSettings; botSettings: BotSettings; wavesSettings: WavesSettings; + CanShowGroupPreview: boolean; + MaxGroupCount: number; } export interface TimeAndWeatherSettings { isRandomTime: boolean; diff --git a/types/models/eft/notes/INoteActionData.d.ts b/types/models/eft/notes/INoteActionData.d.ts index 610657f..97575be 100644 --- a/types/models/eft/notes/INoteActionData.d.ts +++ b/types/models/eft/notes/INoteActionData.d.ts @@ -1,4 +1,4 @@ -import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"; +import { IBaseInteractionRequestData } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface INoteActionData extends IBaseInteractionRequestData { Action: string; index: number; diff --git a/types/models/eft/notifier/INotifier.d.ts b/types/models/eft/notifier/INotifier.d.ts index c6c6979..74343d8 100644 --- a/types/models/eft/notifier/INotifier.d.ts +++ b/types/models/eft/notifier/INotifier.d.ts @@ -1,4 +1,4 @@ -import { Message } from "../profile/IAkiProfile"; +import { Message } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface INotifierChannel { server: string; channel_id: string; diff --git a/types/models/eft/player/IPlayerIncrementSkillLevelRequestData.d.ts b/types/models/eft/player/IPlayerIncrementSkillLevelRequestData.d.ts index 2f9827c..cbda924 100644 --- a/types/models/eft/player/IPlayerIncrementSkillLevelRequestData.d.ts +++ b/types/models/eft/player/IPlayerIncrementSkillLevelRequestData.d.ts @@ -1,4 +1,4 @@ -import { Skills } from "../common/tables/IBotBase"; +import { Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; export interface IPlayerIncrementSkillLevelRequestData { _id: string; experience: number; diff --git a/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index 37f7ce1..3ce8733 100644 --- a/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,8 +1,9 @@ -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; - id: string; - name: string; - root: string; - items: Item[]; + Id: string; + /** name of preset given by player */ + Name: string; + Root: string; + Items: Item[]; } diff --git a/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts index 0d61c4b..bcbdbce 100644 --- a/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts +++ b/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -1,4 +1,3 @@ export interface IRemoveBuildRequestData { - Action: "RemoveBuild"; id: string; } diff --git a/types/models/eft/profile/IAkiProfile.d.ts b/types/models/eft/profile/IAkiProfile.d.ts index cb781c8..441308f 100644 --- a/types/models/eft/profile/IAkiProfile.d.ts +++ b/types/models/eft/profile/IAkiProfile.d.ts @@ -1,8 +1,9 @@ -import { EquipmentBuildType } from "../../../models/enums/EquipmentBuildType"; -import { MemberCategory } from "../../../models/enums/MemberCategory"; -import { MessageType } from "../../enums/MessageType"; -import { IPmcData } from "../common/IPmcData"; -import { Item } from "../common/tables/IItem"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { EquipmentBuildType } from "@spt-aki/models/enums/EquipmentBuildType"; +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; export interface IAkiProfile { info: Info; characters: Characters; @@ -16,13 +17,17 @@ export interface IAkiProfile { insurance: Insurance[]; /** Assort purchases made by player since last trader refresh */ traderPurchases?: Record>; + /** Achievements earned by player */ + achievements: Record; } export declare class TraderPurchaseData { count: number; purchaseTimestamp: number; } export interface Info { + /** main profile id */ id: string; + scavId: string; aid: number; username: string; password: string; @@ -33,38 +38,55 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } +/** used by profile.userbuilds */ export interface IUserBuilds { weaponBuilds: IWeaponBuild[]; equipmentBuilds: IEquipmentBuild[]; + magazineBuilds: IMagazineBuild[]; } -export interface IWeaponBuild { - id: string; - name: string; - root: string; - items: Item[]; - type: string; +export interface IUserBuild { + Id: string; + Name: string; } -export interface IEquipmentBuild { - id: string; - name: string; - root: string; - items: Item[]; +export interface IWeaponBuild extends IUserBuild { + Root: string; + Items: Item[]; +} +export interface IEquipmentBuild extends IUserBuild { + Root: string; + Items: Item[]; + BuildType: EquipmentBuildType; +} +export interface IMagazineBuild extends IUserBuild { + Caliber: string; + TopCount: number; + BottomCount: number; + Items: IMagazineTemplateAmmoItem[]; +} +export interface IMagazineTemplateAmmoItem { + TemplateId: string; + Count: number; +} +/** Used by defaultEquipmentPresets.json */ +export interface IDefaultEquipmentPreset extends IUserBuild { + Items: Item[]; + Root: string; + BuildType: EquipmentBuildType; type: string; - fastPanel: Record; - buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; - type: MessageType; new: number; - _id: string; + type: MessageType; Users?: IUserDialogInfo[]; pinned: boolean; messages: Message[]; + _id: string; } export interface IUserDialogInfo { _id: string; - info: IUserDialogDetails; + aid: number; + Info: IUserDialogDetails; } export interface IUserDialogDetails { Nickname: string; @@ -95,7 +117,7 @@ export interface Message { items?: MessageItems; maxStorageTime?: number; systemData?: ISystemData; - profileChangeEvents?: any[]; + profileChangeEvents?: IProfileChangeEvent[]; } export interface MessagePreview { uid: string; @@ -139,6 +161,7 @@ export interface ModDetails { version: string; author: string; dateAdded: number; + url: string; } export interface ReceivedGift { giftId: string; @@ -194,18 +217,12 @@ export interface Inraid { export interface Insurance { scheduledTime: number; traderId: string; - messageContent: MessageContent; + maxStorageTime: number; + systemData: ISystemData; + messageType: MessageType; + messageTemplateId: string; items: Item[]; } -export interface MessageContent { - ragfair?: MessageContentRagfair; - text?: string; - templateId: string; - type: MessageType; - maxStorageTime?: number; - profileChangeEvents?: any[]; - systemData?: ISystemData; -} export interface MessageContentRagfair { offerId: string; count: number; diff --git a/types/models/eft/profile/ICompletedAchievementsResponse.d.ts b/types/models/eft/profile/ICompletedAchievementsResponse.d.ts new file mode 100644 index 0000000..09275bc --- /dev/null +++ b/types/models/eft/profile/ICompletedAchievementsResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICompletedAchievementsResponse { + elements: Record; +} diff --git a/types/models/eft/profile/ICreateProfileResponse.d.ts b/types/models/eft/profile/ICreateProfileResponse.d.ts new file mode 100644 index 0000000..c297482 --- /dev/null +++ b/types/models/eft/profile/ICreateProfileResponse.d.ts @@ -0,0 +1,3 @@ +export interface ICreateProfileResponse { + uid: string; +} diff --git a/types/models/eft/profile/IGetAchievementsResponse.d.ts b/types/models/eft/profile/IGetAchievementsResponse.d.ts new file mode 100644 index 0000000..a5a43cb --- /dev/null +++ b/types/models/eft/profile/IGetAchievementsResponse.d.ts @@ -0,0 +1,4 @@ +import { IAchievement } from "../common/tables/IAchievement"; +export interface IGetAchievementsResponse { + elements: IAchievement[]; +} diff --git a/types/models/eft/profile/IGetOtherProfileRequest.d.ts b/types/models/eft/profile/IGetOtherProfileRequest.d.ts new file mode 100644 index 0000000..de3144b --- /dev/null +++ b/types/models/eft/profile/IGetOtherProfileRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetOtherProfileRequest { + accountId: string; +} diff --git a/types/models/eft/profile/IGetOtherProfileResponse.d.ts b/types/models/eft/profile/IGetOtherProfileResponse.d.ts new file mode 100644 index 0000000..6c3c9eb --- /dev/null +++ b/types/models/eft/profile/IGetOtherProfileResponse.d.ts @@ -0,0 +1,40 @@ +import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Item } from "../common/tables/IItem"; +export interface IGetOtherProfileResponse { + id: string; + aid: number; + info: IOtherProfileInfo; + customization: IOtherProfileCustomization; + skills: Skills; + equipment: IOtherProfileEquipment; + achievements: Record; + favoriteItems: string[]; + pmcStats: IOtherProfileStats; + scavStats: IOtherProfileStats; +} +export interface IOtherProfileInfo { + nickname: string; + side: string; + experience: number; + memberCategory: number; + bannedState: boolean; + bannedUntil: number; + registrationDate: number; +} +export interface IOtherProfileCustomization { + head: string; + body: string; + feet: string; + hands: string; +} +export interface IOtherProfileEquipment { + Id: string; + Items: Item[]; +} +export interface IOtherProfileStats { + eft: IOtherProfileSubStats; +} +export interface IOtherProfileSubStats { + totalInGameTime: number; + overAllCounters: OverallCounters; +} diff --git a/types/models/eft/quests/IFailQuestRequestData.d.ts b/types/models/eft/quests/IFailQuestRequestData.d.ts index 5881d91..a1a65ea 100644 --- a/types/models/eft/quests/IFailQuestRequestData.d.ts +++ b/types/models/eft/quests/IFailQuestRequestData.d.ts @@ -1,5 +1,5 @@ export interface IFailQuestRequestData { - Action: "QuestComplete"; + Action: "QuestFail"; qid: string; removeExcessItems: boolean; } diff --git a/types/models/eft/ragfair/IGetItemPriceResult.d.ts b/types/models/eft/ragfair/IGetItemPriceResult.d.ts index a38d434..e692b1b 100644 --- a/types/models/eft/ragfair/IGetItemPriceResult.d.ts +++ b/types/models/eft/ragfair/IGetItemPriceResult.d.ts @@ -1,4 +1,4 @@ -import { MinMax } from "../../../models/common/MinMax"; +import { MinMax } from "@spt-aki/models/common/MinMax"; export interface IGetItemPriceResult extends MinMax { avg: number; } diff --git a/types/models/eft/ragfair/IGetOffersResult.d.ts b/types/models/eft/ragfair/IGetOffersResult.d.ts index fbc631d..8b753ae 100644 --- a/types/models/eft/ragfair/IGetOffersResult.d.ts +++ b/types/models/eft/ragfair/IGetOffersResult.d.ts @@ -1,4 +1,4 @@ -import { IRagfairOffer } from "./IRagfairOffer"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export interface IGetOffersResult { categories?: Record; offers: IRagfairOffer[]; diff --git a/types/models/eft/ragfair/IGetRagfairOfferByIdRequest.d.ts b/types/models/eft/ragfair/IGetRagfairOfferByIdRequest.d.ts new file mode 100644 index 0000000..91e3615 --- /dev/null +++ b/types/models/eft/ragfair/IGetRagfairOfferByIdRequest.d.ts @@ -0,0 +1,3 @@ +export interface IGetRagfairOfferByIdRequest { + id: number; +} diff --git a/types/models/eft/ragfair/IRagfairOffer.d.ts b/types/models/eft/ragfair/IRagfairOffer.d.ts index 6b28718..043a986 100644 --- a/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -1,5 +1,5 @@ -import { MemberCategory } from "../../enums/MemberCategory"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; export interface IRagfairOffer { sellResult?: SellResult[]; _id: string; diff --git a/types/models/eft/ragfair/ISearchRequestData.d.ts b/types/models/eft/ragfair/ISearchRequestData.d.ts index 56d093b..52cb2d4 100644 --- a/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,4 +1,4 @@ -import { RagfairSort } from "../../enums/RagfairSort"; +import { RagfairSort } from "@spt-aki/models/enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; diff --git a/types/models/eft/repair/IRepairActionDataRequest.d.ts b/types/models/eft/repair/IRepairActionDataRequest.d.ts index 263d400..ceb3f7c 100644 --- a/types/models/eft/repair/IRepairActionDataRequest.d.ts +++ b/types/models/eft/repair/IRepairActionDataRequest.d.ts @@ -1,4 +1,4 @@ -import { IBaseRepairActionDataRequest } from "./IBaseRepairActionDataRequest"; +import { IBaseRepairActionDataRequest } from "@spt-aki/models/eft/repair/IBaseRepairActionDataRequest"; export interface IRepairActionDataRequest extends IBaseRepairActionDataRequest { Action: "Repair"; repairKitsInfo: RepairKitsInfo[]; diff --git a/types/models/eft/repair/ITraderRepairActionDataRequest.d.ts b/types/models/eft/repair/ITraderRepairActionDataRequest.d.ts index e3d469d..82b83c6 100644 --- a/types/models/eft/repair/ITraderRepairActionDataRequest.d.ts +++ b/types/models/eft/repair/ITraderRepairActionDataRequest.d.ts @@ -1,4 +1,4 @@ -import { IBaseRepairActionDataRequest } from "./IBaseRepairActionDataRequest"; +import { IBaseRepairActionDataRequest } from "@spt-aki/models/eft/repair/IBaseRepairActionDataRequest"; export interface ITraderRepairActionDataRequest extends IBaseRepairActionDataRequest { Action: "TraderRepair"; tid: string; diff --git a/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts b/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts index a9e4c17..15813c1 100644 --- a/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts +++ b/types/models/eft/trade/IProcessBuyTradeRequestData.d.ts @@ -1,6 +1,6 @@ -import { IProcessBaseTradeRequestData } from "./IProcessBaseTradeRequestData"; +import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData { - Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | ""; + Action: "buy_from_trader" | "TradingConfirm" | "RestoreHealth" | "SptInsure" | "SptRepair" | ""; type: string; tid: string; item_id: string; @@ -9,6 +9,7 @@ export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestDat scheme_items: SchemeItem[]; } export interface SchemeItem { + /** Id of stack to take money from, is money tpl when Action is `SptInsure` */ id: string; count: number; } diff --git a/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts b/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts index 889dfd1..66abc0b 100644 --- a/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts +++ b/types/models/eft/trade/IProcessRagfairTradeRequestData.d.ts @@ -1,13 +1,13 @@ export interface IProcessRagfairTradeRequestData { Action: string; - offers: Offer[]; + offers: IOfferRequest[]; } -export interface Offer { +export interface IOfferRequest { id: string; count: number; - items: Item[]; + items: IItemReqeust[]; } -export interface Item { +export interface IItemReqeust { id: string; count: number; } diff --git a/types/models/eft/trade/IProcessSellTradeRequestData.d.ts b/types/models/eft/trade/IProcessSellTradeRequestData.d.ts index dee0cd5..c0f91a0 100644 --- a/types/models/eft/trade/IProcessSellTradeRequestData.d.ts +++ b/types/models/eft/trade/IProcessSellTradeRequestData.d.ts @@ -1,4 +1,4 @@ -import { IProcessBaseTradeRequestData } from "./IProcessBaseTradeRequestData"; +import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; export interface IProcessSellTradeRequestData extends IProcessBaseTradeRequestData { Action: "sell_to_trader"; type: string; diff --git a/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts index c0be040..0101dc1 100644 --- a/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts +++ b/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -1,6 +1,7 @@ -import { OwnerInfo } from "../common/request/IBaseInteractionRequestData"; +import { OwnerInfo } from "@spt-aki/models/eft/common/request/IBaseInteractionRequestData"; export interface ISellScavItemsToFenceRequestData { Action: "SellAllFromSavage"; + totalValue: number; fromOwner: OwnerInfo; toOwner: OwnerInfo; } diff --git a/types/models/eft/weather/IWeatherData.d.ts b/types/models/eft/weather/IWeatherData.d.ts index 1f5d5b5..cae98f1 100644 --- a/types/models/eft/weather/IWeatherData.d.ts +++ b/types/models/eft/weather/IWeatherData.d.ts @@ -1,9 +1,10 @@ -import { WindDirection } from "../../../models/enums/WindDirection"; +import { WindDirection } from "@spt-aki/models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; weather?: IWeather; + winterEventEnabled: boolean; } export interface IWeather { pressure: number; diff --git a/types/models/enums/AmmoTypes.d.ts b/types/models/enums/AmmoTypes.d.ts index 254b410..6aa332b 100644 --- a/types/models/enums/AmmoTypes.d.ts +++ b/types/models/enums/AmmoTypes.d.ts @@ -21,7 +21,10 @@ export declare enum Ammo762x54 { PS_GZH = "59e77a2386f7742ee578960a", T46M_GZH = "5e023cf8186a883be655e54f", BT_GZH = "5e023d34e8a400319a28ed44", - BS_GZH = "5e023d48186a883be655e551" + BS_GZH = "5e023d48186a883be655e551", + FMJ = "64b8f7968532cf95ee0a0dbf", + SP_BT = "64b8f7b5389d7ffd620ccba2", + HP_BT = "64b8f7c241772715af0f9c3d" } export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", @@ -33,7 +36,8 @@ export declare enum Ammo46x30 { AP_SX = "5ba26835d4351e0035628ff5", ACTION_SX = "5ba26812d4351e003201fef1", FMJ_SX = "5ba2678ad4351e44f824b344", - SUBSONIC_SX = "5ba26844d4351e00334c9475" + SUBSONIC_SX = "5ba26844d4351e00334c9475", + JSP_SX = "64b6979341772715af0f9c39" } export declare enum Ammo57x28 { SS198LF = "5cc80f79e4a949033c7343b2", @@ -77,7 +81,8 @@ export declare enum Ammo9x19 { AP_63 = "5c925fa22e221601da359b7b", LUGER_CCI = "5a3c16fe86f77452b62de32a", PBP_GZH = "5efb0da7a29a85116f6ea05f", - QUAKEMAKER = "5efb0e16aeb21837e749c7ff" + QUAKEMAKER = "5efb0e16aeb21837e749c7ff", + FMJ_M882 = "64b7bbb74b75259c590fa897" } export declare enum Ammo9x21 { P_GZH = "5a26abfac4a28232980eabff", @@ -131,7 +136,8 @@ export declare enum Ammo762x35 { BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", V_MAX = "6196364158ef8c428c287d9f", - WHISPER = "6196365d58ef8c428c287da1" + WHISPER = "6196365d58ef8c428c287da1", + CBJ = "64b8725c4b75259c590fa899" } export declare enum Ammo762x39 { PS_GZH = "5656d7c34bdc2d9d198b4587", @@ -139,7 +145,10 @@ export declare enum Ammo762x39 { US_GZH = "59e4d24686f7741776641ac7", T45M1_GZH = "59e4cf5286f7741778269d8a", BP_GZH = "59e0d99486f7744a32234762", - MAI_AP = "601aa3d2b2bcb34913271e6d" + MAI_AP = "601aa3d2b2bcb34913271e6d", + PP_GZH = "64b7af434b75259c590fa893", + SP = "64b7af734b75259c590fa895", + FMJ = "64b7af5a8532cf95ee0a0dbd" } export declare enum Ammo9x39 { SP5_GS = "57a0dfb82459774d3078b56c", @@ -175,7 +184,8 @@ export declare enum Ammo12Gauge { GRIZZLY_40_SLUG = "5d6e6869a4b9361c140bcfde", SUPERFORMANCE_HP_SLUG = "5d6e68d1a4b93622fe60e845", COPPER_SABOT_PREMIER_HP_SLUG = "5d6e68b3a4b9361bca7e50b5", - LEAD_SLUG = "58820d1224597753c90aeb13" + LEAD_SLUG = "58820d1224597753c90aeb13", + PIRANHA = "64b8ee384b75259c590fa89b" } export declare enum Ammo20Gauge { BUCKSHOT_75MM = "5a38ebd9c4a282000d722a5b", diff --git a/types/models/enums/BackendErrorCodes.d.ts b/types/models/enums/BackendErrorCodes.d.ts index 2a269b5..a36e9ce 100644 --- a/types/models/enums/BackendErrorCodes.d.ts +++ b/types/models/enums/BackendErrorCodes.d.ts @@ -62,11 +62,12 @@ export declare enum BackendErrorCodes { BANNEDERRORCODE = 1513, INSUFFICIENTNUMBERINSTOCK = 1516, TOOMANYITEMSTOSELL = 1517, + INCORRECTCLIENTPRICE = 1519, EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, PARSERESPONSEERROR = 9001, - UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNMATCHMAKERERROR2 = 503000,// They have two of these...why :/ UNKNOWNGROUPERROR = 502000, GROUPREQUESTNOTFOUND = 502002, GROUPFULL = 502004, @@ -81,5 +82,6 @@ export declare enum BackendErrorCodes { PLAYERISNOTSEARCHINGFORGROUP = 502018, PLAYERALREADYLOOKINGFORGAME = 503001, PLAYERINRAID = 503002, - LIMITFORPRESETSREACHED = 504001 + LIMITFORPRESETSREACHED = 504001, + PLAYERPROFILENOTFOUND = 505001 } diff --git a/types/models/enums/BaseClasses.d.ts b/types/models/enums/BaseClasses.d.ts index 76938ad..6d2106b 100644 --- a/types/models/enums/BaseClasses.d.ts +++ b/types/models/enums/BaseClasses.d.ts @@ -2,7 +2,7 @@ export declare enum BaseClasses { WEAPON = "5422acb9af1c889c16000029", UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", - ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + ARMORED_EQUIPMENT = "57bef4c42459772e8d35a53b", REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", @@ -54,6 +54,7 @@ export declare enum BaseClasses { GRENADE_LAUNCHER = "5447bedf4bdc2d87278b4568", SPECIAL_WEAPON = "5447bee84bdc2dc3278b4569", SPEC_ITEM = "5447e0e74bdc2d3c308b4567", + SPRING_DRIVEN_CYLINDER = "627a137bf21bc425b06ab944", KNIFE = "5447e1d04bdc2dff2f8b4567", AMMO = "5485a8684bdc2da71d8b4567", AMMO_BOX = "543be5cb4bdc2deb348b4568", @@ -94,9 +95,19 @@ export declare enum BaseClasses { PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", - AUXILARY_MOD = "5a74651486f7744e73386dd1", + AUXILIARY_MOD = "5a74651486f7744e73386dd1", BIPOD = "55818afb4bdc2dde698b456d", HEADPHONES = "5645bcb74bdc2ded0b8b4578", RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", - STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b", + BUILT_IN_INSERTS = "65649eb40bf0ed77b8044453", + ARMOR_PLATE = "644120aa86ffbe10ee032b6f", + CULTIST_AMULET = "64b69b0c8f3be32ed22682f8", + RADIO_TRANSMITTER = "62e9103049c018f425059f38", + HANDGUARD = "55818a104bdc2db9688b4569", + PISTOL_GRIP = "55818a684bdc2ddd698b456d", + RECEIVER = "55818a304bdc2db5418b457d", + BARREL = "555ef6e44bdc2de9068b457e", + CHARGING_HANDLE = "55818a6f4bdc2db9688b456b", + COMB_MUZZLE_DEVICE = "550aa4dd4bdc2dc9348b4569 " } diff --git a/types/models/enums/BonusSkillType.d.ts b/types/models/enums/BonusSkillType.d.ts new file mode 100644 index 0000000..64d9c12 --- /dev/null +++ b/types/models/enums/BonusSkillType.d.ts @@ -0,0 +1,7 @@ +export declare enum BonusSkillType { + PHYSICAL = "Physical", + COMBAT = "Combat", + SPECIAL = "Special", + PRACTICAL = "Practical", + MENTAL = "Mental" +} diff --git a/types/models/enums/BonusType.d.ts b/types/models/enums/BonusType.d.ts new file mode 100644 index 0000000..466457f --- /dev/null +++ b/types/models/enums/BonusType.d.ts @@ -0,0 +1,33 @@ +export declare enum BonusType { + ENERGY_REGENERATION = "EnergyRegeneration", + HYDRATION_REGENERATION = "HydrationRegeneration", + HEALTH_REGENERATION = "HealthRegeneration", + EXPERIENCE_RATE = "ExperienceRate", + QUEST_MONEY_REWARD = "QuestMoneyReward", + SCAV_COOLDOWN_TIMER = "ScavCooldownTimer", + UNLOCK_ITEM_CRAFT = "UnlockItemCraft", + UNLOCK_ITEM_PASSIVE_CREATION = "UnlockItemPassiveCreation", + UNLOCK_RANDOM_ITEM_CREATION = "UnlockRandomItemCreation", + SKILL_LEVELING_BOOST = "SkillLevelingBoost", + DEBUFF_END_DELAY = "DebuffEndDelay", + RAGFAIR_COMMISSION = "RagfairCommission", + INSURANCE_RETURN_TIME = "InsuranceReturnTime", + UNLOCK_WEAPON_MODIFICATION = "UnlockWeaponModification", + UNLOCK_SCAV_PLAY = "UnlockScavPlay", + UNLOCK_ADD_OFFER = "UnlockAddOffer", + UNLOCK_ITEM_CHARGE = "UnlockItemCharge", + RECEIVE_ITEM_BONUS = "ReceiveItemBonus", + UNLOCK_UNIQUE_ID = "UnlockUniqueId", + INCREASE_CANISTER_SLOTS = "IncreaseCanisterSlots", + ADDITIONAL_SLOTS = "AdditionalSlots", + FUEL_CONSUMPTION = "FuelConsumption", + REPAIR_WEAPON_BONUS = "RepairWeaponBonus", + REPAIR_ARMOR_BONUS = "RepairArmorBonus", + UNLOCK_WEAPON_REPAIR = "UnlockWeaponRepair", + UNLOCK_ARMOR_REPAIR = "UnlockArmorRepair", + STASH_SIZE = "StashSize", + MAXIMUM_ENERGY_RESERVE = "MaximumEnergyReserve", + TEXT_BONUS = "TextBonus", + SKILL_GROUP_LEVELING_BOOST = "SkillGroupLevelingBoost", + STASH_ROWS = "StashRows" +} diff --git a/types/models/enums/ConfigTypes.d.ts b/types/models/enums/ConfigTypes.d.ts index 27340c4..bf97c40 100644 --- a/types/models/enums/ConfigTypes.d.ts +++ b/types/models/enums/ConfigTypes.d.ts @@ -24,5 +24,6 @@ export declare enum ConfigTypes { WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", LOST_ON_DEATH = "aki-lostondeath", - GIFTS = "aki-gifts" + GIFTS = "aki-gifts", + BTR = "aki-btr" } diff --git a/types/models/enums/ELocationName.d.ts b/types/models/enums/ELocationName.d.ts index c52ae87..bb05be5 100644 --- a/types/models/enums/ELocationName.d.ts +++ b/types/models/enums/ELocationName.d.ts @@ -4,6 +4,7 @@ export declare enum ELocationName { BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", + SANDBOX = "Sandbox", INTERCHANGE = "Interchange", LIGHTHOUSE = "Lighthouse", LABORATORY = "laboratory", diff --git a/types/models/enums/HideoutEventActions.d.ts b/types/models/enums/HideoutEventActions.d.ts index aa04131..556c799 100644 --- a/types/models/enums/HideoutEventActions.d.ts +++ b/types/models/enums/HideoutEventActions.d.ts @@ -9,5 +9,6 @@ export declare enum HideoutEventActions { HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction", HIDEOUT_RECORD_SHOOTING_RANGE_POINTS = "RecordShootingRangePoints", - HIDEOUT_IMPROVE_AREA = "HideoutImproveArea" + HIDEOUT_IMPROVE_AREA = "HideoutImproveArea", + HIDEOUT_CANCEL_PRODUCTION_COMMAND = "HideoutCancelProductionCommand" } diff --git a/types/models/enums/ItemAddedResult.d.ts b/types/models/enums/ItemAddedResult.d.ts index e64b660..8eafb90 100644 --- a/types/models/enums/ItemAddedResult.d.ts +++ b/types/models/enums/ItemAddedResult.d.ts @@ -1,4 +1,7 @@ export declare enum ItemAddedResult { + UNKNOWN = -1, SUCCESS = 1, - NO_SPACE = 2 + NO_SPACE = 2, + NO_CONTAINERS = 3, + INCOMPATIBLE_ITEM = 4 } diff --git a/types/models/enums/ItemEventActions.d.ts b/types/models/enums/ItemEventActions.d.ts index 64339f1..f8a8b5a 100644 --- a/types/models/enums/ItemEventActions.d.ts +++ b/types/models/enums/ItemEventActions.d.ts @@ -9,6 +9,7 @@ export declare enum ItemEventActions { TOGGLE = "Toggle", TAG = "Tag", BIND = "Bind", + UNBIND = "Unbind", EXAMINE = "Examine", READ_ENCYCLOPEDIA = "ReadEncyclopedia", APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", @@ -21,5 +22,8 @@ export declare enum ItemEventActions { REMOVE_WEAPON_BUILD = "RemoveWeaponBuild", REMOVE_BUILD = "RemoveBuild", SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", - REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild" + REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild", + REDEEM_PROFILE_REWARD = "RedeemProfileReward", + SET_FAVORITE_ITEMS = "SetFavoriteItems", + QUEST_FAIL = "QuestFail" } diff --git a/types/models/enums/MessageType.d.ts b/types/models/enums/MessageType.d.ts index 1b0c649..33cddc8 100644 --- a/types/models/enums/MessageType.d.ts +++ b/types/models/enums/MessageType.d.ts @@ -12,5 +12,6 @@ export declare enum MessageType { QUEST_FAIL = 11, QUEST_SUCCESS = 12, MESSAGE_WITH_ITEMS = 13, - INITIAL_SUPPORT = 14 + INITIAL_SUPPORT = 14, + BTR_ITEMS_DELIVERY = 15 } diff --git a/types/models/enums/ModSpawn.d.ts b/types/models/enums/ModSpawn.d.ts new file mode 100644 index 0000000..445b5ab --- /dev/null +++ b/types/models/enums/ModSpawn.d.ts @@ -0,0 +1,5 @@ +export declare enum ModSpawn { + DEFAULT_MOD = 0, + SPAWN = 1, + SKIP = 2 +} diff --git a/types/models/enums/SeasonalEventType.d.ts b/types/models/enums/SeasonalEventType.d.ts index d7cf037..cfea1f5 100644 --- a/types/models/enums/SeasonalEventType.d.ts +++ b/types/models/enums/SeasonalEventType.d.ts @@ -3,5 +3,6 @@ export declare enum SeasonalEventType { CHRISTMAS = "Christmas", HALLOWEEN = "Halloween", NEW_YEARS = "NewYears", - PROMO = "Promo" + PROMO = "Promo", + SNOW = "Snow" } diff --git a/types/models/enums/SkillTypes.d.ts b/types/models/enums/SkillTypes.d.ts index 4eb90af..dc059a8 100644 --- a/types/models/enums/SkillTypes.d.ts +++ b/types/models/enums/SkillTypes.d.ts @@ -1,4 +1,6 @@ export declare enum SkillTypes { + BOT_RELOAD = "BotReload", + BOT_SOUND = "BotSound", HIDEOUT_MANAGEMENT = "HideoutManagement", CRAFTING = "Crafting", METABOLISM = "Metabolism", @@ -19,6 +21,7 @@ export declare enum SkillTypes { ATTENTION = "Attention", CHARISMA = "Charisma", MEMORY = "Memory", + MELEE = "Melee", SURGERY = "Surgery", AIM_DRILLS = "AimDrills", TROUBLESHOOTING = "TroubleShooting", @@ -31,6 +34,7 @@ export declare enum SkillTypes { NIGHT_OPS = "NightOps", SILENT_OPS = "SilentOps", LOCKPICKING = "Lockpicking", + /** Also called Weapon Maintenance*/ WEAPON_TREATMENT = "WeaponTreatment", MAG_DRILLS = "MagDrills", FREE_TRADING = "Freetrading", diff --git a/types/models/enums/TraderServiceType.d.ts b/types/models/enums/TraderServiceType.d.ts new file mode 100644 index 0000000..f3586dc --- /dev/null +++ b/types/models/enums/TraderServiceType.d.ts @@ -0,0 +1,8 @@ +export declare enum TraderServiceType { + EXUSEC_LOYALTY = "ExUsecLoyalty", + ZRYACHIY_AID = "ZryachiyAid", + CULTISTS_AID = "CultistsAid", + BTR_ITEMS_DELIVERY = "BtrItemsDelivery", + PLAYER_TAXI = "PlayerTaxi", + BTR_BOT_COVER = "BtrBotCover" +} diff --git a/types/models/enums/Traders.d.ts b/types/models/enums/Traders.d.ts index ffea725..f7d340a 100644 --- a/types/models/enums/Traders.d.ts +++ b/types/models/enums/Traders.d.ts @@ -7,5 +7,6 @@ export declare enum Traders { MECHANIC = "5a7c2eca46aef81a7ca2145d", RAGMAN = "5ac3b934156ae10c4430e83c", JAEGER = "5c0647fdd443bc2504c2d371", - LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57" + LIGHTHOUSEKEEPER = "638f541a29ffd1183d187f57", + BTR = "656f0f98d80a697f855d34b1" } diff --git a/types/models/enums/WildSpawnTypeNumber.d.ts b/types/models/enums/WildSpawnTypeNumber.d.ts index e8a2b5e..19b95d5 100644 --- a/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/types/models/enums/WildSpawnTypeNumber.d.ts @@ -36,6 +36,15 @@ export declare enum WildSpawnTypeNumber { ARENAFIGHTEREVENT = 35, BOSSBOARSNIPER = 36, CRAZYASSAULTEVENT = 37, - SPTUSEC = 38, - SPTBEAR = 39 + PEACEFULLZRYACHIYEVENT = 38, + SECTACTPRIESTEVENT = 39, + RAVANGEZRYACHIYEVENT = 40, + FOLLOWERBOARCLOSE1 = 41, + FOLLOWERBOARCLOSE2 = 42, + BOSSKOLONTAY = 43, + FOLLOWERKOLONTAYASSAULT = 44, + FOLLOWERKOLONTAYSECURITY = 45, + SHOOTERBTR = 46, + SPTUSEC = 47, + SPTBEAR = 48 } diff --git a/types/models/enums/hideout/QteActivityType.d.ts b/types/models/enums/hideout/QteActivityType.d.ts new file mode 100644 index 0000000..7a08cc6 --- /dev/null +++ b/types/models/enums/hideout/QteActivityType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteActivityType { + GYM = 0 +} diff --git a/types/models/enums/hideout/QteEffectType.d.ts b/types/models/enums/hideout/QteEffectType.d.ts new file mode 100644 index 0000000..9ecd1a2 --- /dev/null +++ b/types/models/enums/hideout/QteEffectType.d.ts @@ -0,0 +1,5 @@ +export declare enum QteEffectType { + FINISH_EFFECT = "FinishEffect", + SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", + SINGLE_FAIL_EFFECT = "SingleFailEffect" +} diff --git a/types/models/enums/hideout/QteResultType.d.ts b/types/models/enums/hideout/QteResultType.d.ts new file mode 100644 index 0000000..05b48b8 --- /dev/null +++ b/types/models/enums/hideout/QteResultType.d.ts @@ -0,0 +1,4 @@ +export declare enum QteResultType { + NONE = "None", + EXIT = "Exit" +} diff --git a/types/models/enums/hideout/QteRewardType.d.ts b/types/models/enums/hideout/QteRewardType.d.ts new file mode 100644 index 0000000..251c2ad --- /dev/null +++ b/types/models/enums/hideout/QteRewardType.d.ts @@ -0,0 +1,6 @@ +export declare enum QteRewardType { + SKILL = "Skill", + HEALTH_EFFECT = "HealthEffect", + MUSCLE_PAIN = "MusclePain", + GYM_ARM_TRAUMA = "GymArmTrauma" +} diff --git a/types/models/enums/hideout/QteType.d.ts b/types/models/enums/hideout/QteType.d.ts new file mode 100644 index 0000000..4c50c0d --- /dev/null +++ b/types/models/enums/hideout/QteType.d.ts @@ -0,0 +1,3 @@ +export declare enum QteType { + SHRINKING_CIRCLE = 0 +} diff --git a/types/models/enums/hideout/RequirementType.d.ts b/types/models/enums/hideout/RequirementType.d.ts new file mode 100644 index 0000000..834eabf --- /dev/null +++ b/types/models/enums/hideout/RequirementType.d.ts @@ -0,0 +1,12 @@ +export declare enum RequirementType { + AREA = "Area", + ITEM = "Item", + TRADER_UNLOCK = "TraderUnlock", + TRADER_LOYALTY = "TraderLoyalty", + SKILL = "Skill", + RESOURCE = "Resource", + TOOL = "Tool", + QUEST_COMPLETE = "QuestComplete", + HEALTH = "Health", + BODY_PART_BUFF = "BodyPartBuff" +} diff --git a/types/models/external/HttpFramework.d.ts b/types/models/external/HttpFramework.d.ts index 64a37d6..fda8732 100644 --- a/types/models/external/HttpFramework.d.ts +++ b/types/models/external/HttpFramework.d.ts @@ -1,5 +1,5 @@ /// -import { IncomingMessage, ServerResponse } from "http"; +import { IncomingMessage, ServerResponse } from "node:http"; export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; /** * Associates handlers, HTTP methods and a base url to a listener using a proxy diff --git a/types/models/external/IPostAkiLoadMod.d.ts b/types/models/external/IPostAkiLoadMod.d.ts index f6950e8..87a2ab0 100644 --- a/types/models/external/IPostAkiLoadMod.d.ts +++ b/types/models/external/IPostAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "./tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadMod { postAkiLoad(container: DependencyContainer): void; } diff --git a/types/models/external/IPostAkiLoadModAsync.d.ts b/types/models/external/IPostAkiLoadModAsync.d.ts index 073ce6e..ea57e2b 100644 --- a/types/models/external/IPostAkiLoadModAsync.d.ts +++ b/types/models/external/IPostAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "./tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostAkiLoadModAsync { postAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/types/models/external/IPostDBLoadMod.d.ts b/types/models/external/IPostDBLoadMod.d.ts index ca7c682..8b482b6 100644 --- a/types/models/external/IPostDBLoadMod.d.ts +++ b/types/models/external/IPostDBLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "./tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadMod { postDBLoad(container: DependencyContainer): void; } diff --git a/types/models/external/IPostDBLoadModAsync.d.ts b/types/models/external/IPostDBLoadModAsync.d.ts index b23825a..63b55bb 100644 --- a/types/models/external/IPostDBLoadModAsync.d.ts +++ b/types/models/external/IPostDBLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "./tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPostDBLoadModAsync { postDBLoadAsync(container: DependencyContainer): Promise; } diff --git a/types/models/external/IPreAkiLoadMod.d.ts b/types/models/external/IPreAkiLoadMod.d.ts index ae7579e..b3bb041 100644 --- a/types/models/external/IPreAkiLoadMod.d.ts +++ b/types/models/external/IPreAkiLoadMod.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "./tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadMod { preAkiLoad(container: DependencyContainer): void; } diff --git a/types/models/external/IPreAkiLoadModAsync.d.ts b/types/models/external/IPreAkiLoadModAsync.d.ts index 1249ff1..4c0c984 100644 --- a/types/models/external/IPreAkiLoadModAsync.d.ts +++ b/types/models/external/IPreAkiLoadModAsync.d.ts @@ -1,4 +1,4 @@ -import { DependencyContainer } from "./tsyringe"; +import type { DependencyContainer } from "tsyringe"; export interface IPreAkiLoadModAsync { preAkiLoadAsync(container: DependencyContainer): Promise; } diff --git a/types/models/spt/bots/BotGenerationDetails.d.ts b/types/models/spt/bots/BotGenerationDetails.d.ts index 26571a2..7ea9d7e 100644 --- a/types/models/spt/bots/BotGenerationDetails.d.ts +++ b/types/models/spt/bots/BotGenerationDetails.d.ts @@ -6,13 +6,18 @@ export interface BotGenerationDetails { /** Side of bot */ side: string; /** Active players current level */ - playerLevel: number; - /** Delta of highest level of bot */ + playerLevel?: number; + playerName?: string; + /** Delta of highest level of bot e.g. 50 means 50 levels above player */ botRelativeLevelDeltaMax: number; + /** Delta of lowest level of bot e.g. 50 means 50 levels below player */ + botRelativeLevelDeltaMin: number; /** How many to create and store */ botCountToGenerate: number; /** Desired difficulty of the bot */ botDifficulty: string; /** Will the generated bot be a player scav */ isPlayerScav: boolean; + eventRole?: string; + allPmcsHaveSameNameAsPlayer?: boolean; } diff --git a/types/models/spt/bots/BotLootCache.d.ts b/types/models/spt/bots/BotLootCache.d.ts new file mode 100644 index 0000000..aedf7b0 --- /dev/null +++ b/types/models/spt/bots/BotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export declare class BotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" +} diff --git a/types/models/spt/bots/GenerateWeaponResult.d.ts b/types/models/spt/bots/GenerateWeaponResult.d.ts index 56fa481..f28d052 100644 --- a/types/models/spt/bots/GenerateWeaponResult.d.ts +++ b/types/models/spt/bots/GenerateWeaponResult.d.ts @@ -1,6 +1,6 @@ -import { Mods } from "../../eft/common/tables/IBotType"; -import { Item } from "../../eft/common/tables/IItem"; -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +import { Mods } from "@spt-aki/models/eft/common/tables/IBotType"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export declare class GenerateWeaponResult { weapon: Item[]; chosenAmmoTpl: string; diff --git a/types/models/spt/bots/IBotLootCache.d.ts b/types/models/spt/bots/IBotLootCache.d.ts index bf0ef61..54c9ff7 100644 --- a/types/models/spt/bots/IBotLootCache.d.ts +++ b/types/models/spt/bots/IBotLootCache.d.ts @@ -1,20 +1,21 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; export interface IBotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; + backpackLoot: Record; + pocketLoot: Record; + vestLoot: Record; + secureLoot: Record; + combinedPoolLoot: Record; + specialItems: Record; + healingItems: Record; + drugItems: Record; + stimItems: Record; + grenadeItems: Record; } export declare enum LootCacheType { SPECIAL = "Special", BACKPACK = "Backpack", POCKET = "Pocket", VEST = "Vest", + SECURE = "SecuredContainer", COMBINED = "Combined", HEALING_ITEMS = "HealingItems", DRUG_ITEMS = "DrugItems", diff --git a/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts b/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts new file mode 100644 index 0000000..6ba6630 --- /dev/null +++ b/types/models/spt/bots/IChooseRandomCompatibleModResult.d.ts @@ -0,0 +1,7 @@ +export interface IChooseRandomCompatibleModResult { + incompatible: boolean; + found?: boolean; + chosenTpl?: string; + reason: string; + slotBlocked?: boolean; +} diff --git a/types/models/spt/bots/IItemSpawnLimitSettings.d.ts b/types/models/spt/bots/IItemSpawnLimitSettings.d.ts new file mode 100644 index 0000000..ca3e6a6 --- /dev/null +++ b/types/models/spt/bots/IItemSpawnLimitSettings.d.ts @@ -0,0 +1,4 @@ +export interface IItemSpawnLimitSettings { + currentLimits: Record; + globalLimits: Record; +} diff --git a/types/models/spt/callbacks/IBotCallbacks.d.ts b/types/models/spt/callbacks/IBotCallbacks.d.ts index 2c42813..02f444e 100644 --- a/types/models/spt/callbacks/IBotCallbacks.d.ts +++ b/types/models/spt/callbacks/IBotCallbacks.d.ts @@ -1,7 +1,7 @@ -import { IGenerateBotsRequestData } from "../../eft/bot/IGenerateBotsRequestData"; -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IBotBase } from "../../eft/common/tables/IBotBase"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; +import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; export interface IBotCallbacks { getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; diff --git a/types/models/spt/callbacks/ICustomizationCallbacks.d.ts b/types/models/spt/callbacks/ICustomizationCallbacks.d.ts index d10027f..f4f8877 100644 --- a/types/models/spt/callbacks/ICustomizationCallbacks.d.ts +++ b/types/models/spt/callbacks/ICustomizationCallbacks.d.ts @@ -1,9 +1,9 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IBuyClothingRequestData } from "../../eft/customization/IBuyClothingRequestData"; -import { IWearClothingRequestData } from "../../eft/customization/IWearClothingRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ISuit } from "../../eft/common/tables/ITrader"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ISuit } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IBuyClothingRequestData } from "@spt-aki/models/eft/customization/IBuyClothingRequestData"; +import { IWearClothingRequestData } from "@spt-aki/models/eft/customization/IWearClothingRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export interface ICustomizationCallbacks { getSuits(url: string, info: any, sessionID: string): IGetBodyResponseData; getTraderSuits(url: string, info: any, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IDataCallbacks.d.ts b/types/models/spt/callbacks/IDataCallbacks.d.ts index c65eff6..0651dce 100644 --- a/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -1,11 +1,11 @@ -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IGlobals } from "../../eft/common/IGlobals"; -import { IHideoutArea } from "../../eft/hideout/IHideoutArea"; -import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; -import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; -import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ISettingsBase } from "../server/ISettingsBase"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IHideoutArea } from "@spt-aki/models/eft/hideout/IHideoutArea"; +import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; +import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; +import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { ISettingsBase } from "@spt-aki/models/spt/server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IDialogueCallbacks.d.ts b/types/models/spt/callbacks/IDialogueCallbacks.d.ts index 445178e..0cc835b 100644 --- a/types/models/spt/callbacks/IDialogueCallbacks.d.ts +++ b/types/models/spt/callbacks/IDialogueCallbacks.d.ts @@ -1,20 +1,20 @@ -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IFriendRequestData } from "../../eft/dialog/IFriendRequestData"; -import { IGetAllAttachmentsRequestData } from "../../eft/dialog/IGetAllAttachmentsRequestData"; -import { IGetAllAttachmentsResponse } from "../../eft/dialog/IGetAllAttachmentsResponse"; -import { IGetChatServerListRequestData } from "../../eft/dialog/IGetChatServerListRequestData"; -import { IGetFriendListDataResponse } from "../../eft/dialog/IGetFriendListDataResponse"; -import { IGetMailDialogInfoRequestData } from "../../eft/dialog/IGetMailDialogInfoRequestData"; -import { IGetMailDialogListRequestData } from "../../eft/dialog/IGetMailDialogListRequestData"; -import { IGetMailDialogViewRequestData } from "../../eft/dialog/IGetMailDialogViewRequestData"; -import { IGetMailDialogViewResponseData } from "../../eft/dialog/IGetMailDialogViewResponseData"; -import { IPinDialogRequestData } from "../../eft/dialog/IPinDialogRequestData"; -import { IRemoveDialogRequestData } from "../../eft/dialog/IRemoveDialogRequestData"; -import { ISendMessageRequest } from "../../eft/dialog/ISendMessageRequest"; -import { ISetDialogReadRequestData } from "../../eft/dialog/ISetDialogReadRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../../eft/httpResponse/INullResponseData"; -import { DialogueInfo } from "../../eft/profile/IAkiProfile"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IFriendRequestData } from "@spt-aki/models/eft/dialog/IFriendRequestData"; +import { IGetAllAttachmentsRequestData } from "@spt-aki/models/eft/dialog/IGetAllAttachmentsRequestData"; +import { IGetAllAttachmentsResponse } from "@spt-aki/models/eft/dialog/IGetAllAttachmentsResponse"; +import { IGetChatServerListRequestData } from "@spt-aki/models/eft/dialog/IGetChatServerListRequestData"; +import { IGetFriendListDataResponse } from "@spt-aki/models/eft/dialog/IGetFriendListDataResponse"; +import { IGetMailDialogInfoRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogInfoRequestData"; +import { IGetMailDialogListRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogListRequestData"; +import { IGetMailDialogViewRequestData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewRequestData"; +import { IGetMailDialogViewResponseData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewResponseData"; +import { IPinDialogRequestData } from "@spt-aki/models/eft/dialog/IPinDialogRequestData"; +import { IRemoveDialogRequestData } from "@spt-aki/models/eft/dialog/IRemoveDialogRequestData"; +import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest"; +import { ISetDialogReadRequestData } from "@spt-aki/models/eft/dialog/ISetDialogReadRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IDialogueCallbacks { getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IGameCallbacks.d.ts b/types/models/spt/callbacks/IGameCallbacks.d.ts index 38ebc5f..324ec31 100644 --- a/types/models/spt/callbacks/IGameCallbacks.d.ts +++ b/types/models/spt/callbacks/IGameCallbacks.d.ts @@ -1,9 +1,9 @@ -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IGameEmptyCrcRequestData } from "../../eft/game/IGameEmptyCrcRequestData"; -import { IVersionValidateRequestData } from "../../eft/game/IVersionValidateRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../../eft/httpResponse/INullResponseData"; -import { IGameConfigResponse } from "../../eft/game/IGameConfigResponse"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigResponse"; +import { IGameEmptyCrcRequestData } from "@spt-aki/models/eft/game/IGameEmptyCrcRequestData"; +import { IVersionValidateRequestData } from "@spt-aki/models/eft/game/IVersionValidateRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; export interface IGameCallbacks { versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IHealthCallbacks.d.ts b/types/models/spt/callbacks/IHealthCallbacks.d.ts index d238c7a..0ea81a2 100644 --- a/types/models/spt/callbacks/IHealthCallbacks.d.ts +++ b/types/models/spt/callbacks/IHealthCallbacks.d.ts @@ -1,9 +1,9 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IAkiProfile } from "../../eft/profile/IAkiProfile"; -import { ISyncHealthRequestData } from "../../eft/health/ISyncHealthRequestData"; -import { IOffraidEatRequestData } from "../../eft/health/IOffraidEatRequestData"; -import { IOffraidHealRequestData } from "../../eft/health/IOffraidHealRequestData"; -import { IHealthTreatmentRequestData } from "../../eft/health/IHealthTreatmentRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHealthTreatmentRequestData } from "@spt-aki/models/eft/health/IHealthTreatmentRequestData"; +import { IOffraidEatRequestData } from "@spt-aki/models/eft/health/IOffraidEatRequestData"; +import { IOffraidHealRequestData } from "@spt-aki/models/eft/health/IOffraidHealRequestData"; +import { ISyncHealthRequestData } from "@spt-aki/models/eft/health/ISyncHealthRequestData"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IHealthCallbacks { onLoad(sessionID: string): IAkiProfile; syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): any; diff --git a/types/models/spt/callbacks/IHideoutCallbacks.d.ts b/types/models/spt/callbacks/IHideoutCallbacks.d.ts index ad2af48..feda12e 100644 --- a/types/models/spt/callbacks/IHideoutCallbacks.d.ts +++ b/types/models/spt/callbacks/IHideoutCallbacks.d.ts @@ -1,14 +1,14 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IHideoutUpgradeRequestData } from "../../eft/hideout/IHideoutUpgradeRequestData"; -import { IHideoutUpgradeCompleteRequestData } from "../../eft/hideout/IHideoutUpgradeCompleteRequestData"; -import { IHideoutScavCaseStartRequestData } from "../../eft/hideout/IHideoutScavCaseStartRequestData"; -import { IHideoutPutItemInRequestData } from "../../eft/hideout/IHideoutPutItemInRequestData"; -import { IHideoutTakeItemOutRequestData } from "../../eft/hideout/IHideoutTakeItemOutRequestData"; -import { IHideoutToggleAreaRequestData } from "../../eft/hideout/IHideoutToggleAreaRequestData"; -import { IHideoutSingleProductionStartRequestData } from "../../eft/hideout/IHideoutSingleProductionStartRequestData"; -import { IHideoutContinuousProductionStartRequestData } from "../../eft/hideout/IHideoutContinuousProductionStartRequestData"; -import { IHideoutTakeProductionRequestData } from "../../eft/hideout/IHideoutTakeProductionRequestData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; +import { IHideoutPutItemInRequestData } from "@spt-aki/models/eft/hideout/IHideoutPutItemInRequestData"; +import { IHideoutScavCaseStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutScavCaseStartRequestData"; +import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; +import { IHideoutTakeItemOutRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeItemOutRequestData"; +import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; +import { IHideoutToggleAreaRequestData } from "@spt-aki/models/eft/hideout/IHideoutToggleAreaRequestData"; +import { IHideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/IHideoutUpgradeCompleteRequestData"; +import { IHideoutUpgradeRequestData } from "@spt-aki/models/eft/hideout/IHideoutUpgradeRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export interface IHideoutCallbacks { upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/IInraidCallbacks.d.ts b/types/models/spt/callbacks/IInraidCallbacks.d.ts index e959b98..4754c0c 100644 --- a/types/models/spt/callbacks/IInraidCallbacks.d.ts +++ b/types/models/spt/callbacks/IInraidCallbacks.d.ts @@ -1,8 +1,8 @@ -import { INullResponseData } from "../../eft/httpResponse/INullResponseData"; -import { IAkiProfile } from "../../eft/profile/IAkiProfile"; -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IRegisterPlayerRequestData } from "../../eft/inRaid/IRegisterPlayerRequestData"; -import { ISaveProgressRequestData } from "../../eft/inRaid/ISaveProgressRequestData"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData"; +import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IInraidCallbacks { onLoad(sessionID: string): IAkiProfile; registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; diff --git a/types/models/spt/callbacks/IInsuranceCallbacks.d.ts b/types/models/spt/callbacks/IInsuranceCallbacks.d.ts index 082112d..649039a 100644 --- a/types/models/spt/callbacks/IInsuranceCallbacks.d.ts +++ b/types/models/spt/callbacks/IInsuranceCallbacks.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IAkiProfile } from "../../eft/profile/IAkiProfile"; -import { IGetInsuranceCostRequestData } from "../../eft/insurance/IGetInsuranceCostRequestData"; -import { IInsureRequestData } from "../../eft/insurance/IInsureRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostRequestData"; +import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IInsuranceCallbacks { onLoad(sessionID: string): IAkiProfile; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): any; diff --git a/types/models/spt/callbacks/IInventoryCallbacks.d.ts b/types/models/spt/callbacks/IInventoryCallbacks.d.ts index e53f7d0..7abe819 100644 --- a/types/models/spt/callbacks/IInventoryCallbacks.d.ts +++ b/types/models/spt/callbacks/IInventoryCallbacks.d.ts @@ -1,21 +1,21 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IInventoryFoldRequestData } from "../../eft/inventory/IInventoryFoldRequestData"; -import { IInventorySplitRequestData } from "../../eft/inventory/IInventorySplitRequestData"; -import { IInventoryMoveRequestData } from "../../eft/inventory/IInventoryMoveRequestData"; -import { IInventoryMergeRequestData } from "../../eft/inventory/IInventoryMergeRequestData"; -import { IInventoryRemoveRequestData } from "../../eft/inventory/IInventoryRemoveRequestData"; -import { IInventoryTransferRequestData } from "../../eft/inventory/IInventoryTransferRequestData"; -import { IInventorySwapRequestData } from "../../eft/inventory/IInventorySwapRequestData"; -import { IInventoryToggleRequestData } from "../../eft/inventory/IInventoryToggleRequestData"; -import { IInventoryTagRequestData } from "../../eft/inventory/IInventoryTagRequestData"; -import { IInventoryBindRequestData } from "../../eft/inventory/IInventoryBindRequestData"; -import { IInventoryExamineRequestData } from "../../eft/inventory/IInventoryExamineRequestData"; -import { IInventoryReadEncyclopediaRequestData } from "../../eft/inventory/IInventoryReadEncyclopediaRequestData"; -import { IInventorySortRequestData } from "../../eft/inventory/IInventorySortRequestData"; -import { IInventoryCreateMarkerRequestData } from "../../eft/inventory/IInventoryCreateMarkerRequestData"; -import { IInventoryDeleteMarkerRequestData } from "../../eft/inventory/IInventoryDeleteMarkerRequestData"; -import { IInventoryEditMarkerRequestData } from "../../eft/inventory/IInventoryEditMarkerRequestData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData"; +import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData"; +import { IInventoryDeleteMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryDeleteMarkerRequestData"; +import { IInventoryEditMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryEditMarkerRequestData"; +import { IInventoryExamineRequestData } from "@spt-aki/models/eft/inventory/IInventoryExamineRequestData"; +import { IInventoryFoldRequestData } from "@spt-aki/models/eft/inventory/IInventoryFoldRequestData"; +import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData"; +import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData"; +import { IInventoryReadEncyclopediaRequestData } from "@spt-aki/models/eft/inventory/IInventoryReadEncyclopediaRequestData"; +import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData"; +import { IInventorySortRequestData } from "@spt-aki/models/eft/inventory/IInventorySortRequestData"; +import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData"; +import { IInventorySwapRequestData } from "@spt-aki/models/eft/inventory/IInventorySwapRequestData"; +import { IInventoryTagRequestData } from "@spt-aki/models/eft/inventory/IInventoryTagRequestData"; +import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInventoryToggleRequestData"; +import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export interface IInventoryCallbacks { moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/IItemEventCallbacks.d.ts b/types/models/spt/callbacks/IItemEventCallbacks.d.ts index 59db771..6778e54 100644 --- a/types/models/spt/callbacks/IItemEventCallbacks.d.ts +++ b/types/models/spt/callbacks/IItemEventCallbacks.d.ts @@ -1,6 +1,6 @@ -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterRequest } from "../../eft/itemEvent/IItemEventRouterRequest"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterRequest } from "@spt-aki/models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export interface IItemEventCallbacks { handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; } diff --git a/types/models/spt/callbacks/ILauncherCallbacks.d.ts b/types/models/spt/callbacks/ILauncherCallbacks.d.ts index 52dfec6..d37e58c 100644 --- a/types/models/spt/callbacks/ILauncherCallbacks.d.ts +++ b/types/models/spt/callbacks/ILauncherCallbacks.d.ts @@ -1,8 +1,8 @@ -import { IRegisterData } from "../../eft/launcher/IRegisterData"; -import { IRemoveProfileData } from "../../eft/launcher/IRemoveProfileData"; -import { ILoginRequestData } from "../../eft/launcher/ILoginRequestData"; -import { IChangeRequestData } from "../../eft/launcher/IChangeRequestData"; -import { IGetMiniProfileRequestData } from "../../eft/launcher/IGetMiniProfileRequestData.js"; +import { IChangeRequestData } from "@spt-aki/models/eft/launcher/IChangeRequestData"; +import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; +import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData"; +import { IRegisterData } from "@spt-aki/models/eft/launcher/IRegisterData"; +import { IRemoveProfileData } from "@spt-aki/models/eft/launcher/IRemoveProfileData"; export interface ILauncherCallbacks { connect(): string; login(url: string, info: ILoginRequestData, sessionID: string): string; diff --git a/types/models/spt/callbacks/ILocationCallbacks.d.ts b/types/models/spt/callbacks/ILocationCallbacks.d.ts index 71656a4..a031a29 100644 --- a/types/models/spt/callbacks/ILocationCallbacks.d.ts +++ b/types/models/spt/callbacks/ILocationCallbacks.d.ts @@ -1,7 +1,7 @@ -import { IGetLocationRequestData } from "../../eft/location/IGetLocationRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILocationsGenerateAllResponse } from "../../eft/common/ILocationsSourceDestinationBase"; -import { ILocationBase } from "../../eft/common/ILocationBase"; +import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { ILocationsGenerateAllResponse } from "@spt-aki/models/eft/common/ILocationsSourceDestinationBase"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IGetLocationRequestData } from "@spt-aki/models/eft/location/IGetLocationRequestData"; export interface ILocationCallbacks { getLocationData(url: string, info: any, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/INoteCallbacks.d.ts b/types/models/spt/callbacks/INoteCallbacks.d.ts index 8453a4f..aec8099 100644 --- a/types/models/spt/callbacks/INoteCallbacks.d.ts +++ b/types/models/spt/callbacks/INoteCallbacks.d.ts @@ -1,6 +1,6 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { INoteActionData } from "../../eft/notes/INoteActionData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData"; export interface INoteCallbacks { addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse; editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/INotifierCallbacks.d.ts b/types/models/spt/callbacks/INotifierCallbacks.d.ts index a211310..60b3695 100644 --- a/types/models/spt/callbacks/INotifierCallbacks.d.ts +++ b/types/models/spt/callbacks/INotifierCallbacks.d.ts @@ -1,7 +1,7 @@ -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { INotifierChannel } from "../../eft/notifier/INotifier"; -import { ISelectProfileRequestData } from "../../eft/notifier/ISelectProfileRequestData"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INotifierChannel } from "@spt-aki/models/eft/notifier/INotifier"; +import { ISelectProfileRequestData } from "@spt-aki/models/eft/notifier/ISelectProfileRequestData"; export interface INotifierCallbacks { /** * If we don't have anything to send, it's ok to not send anything back diff --git a/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts b/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts index 4865683..886cc9c 100644 --- a/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts +++ b/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts @@ -1,8 +1,8 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; -import { IPresetBuildActionRequestData } from "../../eft/presetBuild/IPresetBuildActionRequestData"; -import { IWeaponBuild } from "../../eft/profile/IAkiProfile"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData"; +import { IWeaponBuild } from "@spt-aki/models/eft/profile/IAkiProfile"; export interface IPresetBuildCallbacks { getHandbookUserlist(url: string, info: any, sessionID: string): IGetBodyResponseData; saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/IProfileCallbacks.d.ts b/types/models/spt/callbacks/IProfileCallbacks.d.ts index 9d4d2df..f05532a 100644 --- a/types/models/spt/callbacks/IProfileCallbacks.d.ts +++ b/types/models/spt/callbacks/IProfileCallbacks.d.ts @@ -1,12 +1,12 @@ -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../../eft/httpResponse/INullResponseData"; -import { IProfileChangeNicknameRequestData } from "../../eft/profile/IProfileChangeNicknameRequestData"; -import { IProfileChangeVoiceRequestData } from "../../eft/profile/IProfileChangeVoiceRequestData"; -import { IProfileCreateRequestData } from "../../eft/profile/IProfileCreateRequestData"; -import { IValidateNicknameRequestData } from "../../eft/profile/IValidateNicknameRequestData"; -import { ISearchFriendRequestData } from "../../eft/profile/ISearchFriendRequestData"; -import { ISearchFriendResponse } from "../../eft/profile/ISearchFriendResponse"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; +import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; +import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; +import { ISearchFriendRequestData } from "@spt-aki/models/eft/profile/ISearchFriendRequestData"; +import { ISearchFriendResponse } from "@spt-aki/models/eft/profile/ISearchFriendResponse"; +import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData"; export interface IProfileCallbacks { onLoad(sessionID: string): any; createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IQuestCallbacks.d.ts b/types/models/spt/callbacks/IQuestCallbacks.d.ts index 1c4d0c3..546191f 100644 --- a/types/models/spt/callbacks/IQuestCallbacks.d.ts +++ b/types/models/spt/callbacks/IQuestCallbacks.d.ts @@ -1,14 +1,14 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IAcceptQuestRequestData } from "../../eft/quests/IAcceptQuestRequestData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { IListQuestsRequestData } from "../../eft/quests/IListQuestsRequestData"; -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { ICompleteQuestRequestData } from "../../eft/quests/ICompleteQuestRequestData"; -import { IHandoverQuestRequestData } from "../../eft/quests/IHandoverQuestRequestData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; -import { IQuest } from "../../eft/common/tables/IQuest"; -import { IPmcDataRepeatableQuest } from "../../eft/common/tables/IRepeatableQuests"; -import { IRepeatableQuestChangeRequest } from "../../eft/quests/IRepeatableQuestChangeRequest"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IQuest } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData"; +import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData"; +import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData"; +import { IListQuestsRequestData } from "@spt-aki/models/eft/quests/IListQuestsRequestData"; +import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest"; export interface IQuestCallbacks { changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/IRagfairCallbacks.d.ts b/types/models/spt/callbacks/IRagfairCallbacks.d.ts index 9282bd4..1157349 100644 --- a/types/models/spt/callbacks/IRagfairCallbacks.d.ts +++ b/types/models/spt/callbacks/IRagfairCallbacks.d.ts @@ -1,13 +1,13 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ISearchRequestData } from "../../eft/ragfair/ISearchRequestData"; -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { IGetMarketPriceRequestData } from "../../eft/ragfair/IGetMarketPriceRequestData"; -import { IAddOfferRequestData } from "../../eft/ragfair/IAddOfferRequestData"; -import { IRemoveOfferRequestData } from "../../eft/ragfair/IRemoveOfferRequestData"; -import { IExtendOfferRequestData } from "../../eft/ragfair/IExtendOfferRequestData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; -import { IGetItemPriceResult } from "../../eft/ragfair/IGetItemPriceResult"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IAddOfferRequestData } from "@spt-aki/models/eft/ragfair/IAddOfferRequestData"; +import { IExtendOfferRequestData } from "@spt-aki/models/eft/ragfair/IExtendOfferRequestData"; +import { IGetItemPriceResult } from "@spt-aki/models/eft/ragfair/IGetItemPriceResult"; +import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMarketPriceRequestData"; +import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; export interface IRagfairCallbacks { load(): void; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IRepairCallbacks.d.ts b/types/models/spt/callbacks/IRepairCallbacks.d.ts index e8183c9..b83fde8 100644 --- a/types/models/spt/callbacks/IRepairCallbacks.d.ts +++ b/types/models/spt/callbacks/IRepairCallbacks.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; -import { IRepairActionDataRequest } from "../../eft/repair/IRepairActionDataRequest"; -import { ITraderRepairActionDataRequest } from "../../eft/repair/ITraderRepairActionDataRequest"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IRepairActionDataRequest } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; +import { ITraderRepairActionDataRequest } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; export interface IRepairCallbacks { traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/ITradeCallbacks.d.ts b/types/models/spt/callbacks/ITradeCallbacks.d.ts index 2f41d54..b6daa5d 100644 --- a/types/models/spt/callbacks/ITradeCallbacks.d.ts +++ b/types/models/spt/callbacks/ITradeCallbacks.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IProcessRagfairTradeRequestData } from "../../eft/trade/IProcessRagfairTradeRequestData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; -import { IProcessBaseTradeRequestData } from "../../eft/trade/IProcessBaseTradeRequestData"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData"; +import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData"; export interface ITradeCallbacks { processTrade(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; processRagfairTrade(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/callbacks/ITraderCallbacks.d.ts b/types/models/spt/callbacks/ITraderCallbacks.d.ts index b784408..23cd532 100644 --- a/types/models/spt/callbacks/ITraderCallbacks.d.ts +++ b/types/models/spt/callbacks/ITraderCallbacks.d.ts @@ -1,6 +1,6 @@ -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; -import { ITraderAssort, ITraderBase } from "../../eft/common/tables/ITrader"; -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; export interface ITraderCallbacks { load(): void; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/types/models/spt/callbacks/IWeatherCallbacks.d.ts b/types/models/spt/callbacks/IWeatherCallbacks.d.ts index 9ac72ae..1ba5b47 100644 --- a/types/models/spt/callbacks/IWeatherCallbacks.d.ts +++ b/types/models/spt/callbacks/IWeatherCallbacks.d.ts @@ -1,5 +1,5 @@ -import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; +import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; export interface IWeatherCallbacks { getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/types/models/spt/callbacks/IWishlistCallbacks.d.ts b/types/models/spt/callbacks/IWishlistCallbacks.d.ts index e5d519c..3ab5c68 100644 --- a/types/models/spt/callbacks/IWishlistCallbacks.d.ts +++ b/types/models/spt/callbacks/IWishlistCallbacks.d.ts @@ -1,6 +1,6 @@ -import { IPmcData } from "../../eft/common/IPmcData"; -import { IWishlistActionData } from "../../eft/wishlist/IWishlistActionData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IWishlistActionData } from "@spt-aki/models/eft/wishlist/IWishlistActionData"; export interface IWishlistCallbacks { addToWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse; removeFromWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse; diff --git a/types/models/spt/config/IAirdropConfig.d.ts b/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8efb870 100644 --- a/types/models/spt/config/IAirdropConfig.d.ts +++ b/types/models/spt/config/IAirdropConfig.d.ts @@ -1,6 +1,6 @@ -import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; -import { MinMax } from "../../common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { AirdropTypeEnum } from "@spt-aki/models/enums/AirdropType"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; @@ -33,11 +33,14 @@ export interface AirdropChancePercent { interchange: number; reserve: number; tarkovStreets: number; + sandbox: number; } /** Loot inside crate */ export interface AirdropLoot { /** Min/max of weapons inside crate */ - presetCount?: MinMax; + weaponPresetCount?: MinMax; + /** Min/max of armors (head/chest/rig) inside crate */ + armorPresetCount?: MinMax; /** Min/max of items inside crate */ itemCount: MinMax; /** Min/max of sealed weapon boxes inside crate */ @@ -52,4 +55,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/types/models/spt/config/IBTRConfig.d.ts b/types/models/spt/config/IBTRConfig.d.ts new file mode 100644 index 0000000..4c592f4 --- /dev/null +++ b/types/models/spt/config/IBTRConfig.d.ts @@ -0,0 +1,13 @@ +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IBTRConfig extends IBaseConfig { + kind: "aki-btr"; + /** How fast the BTR moves */ + moveSpeed: number; + /** How long the cover fire service lasts for */ + coverFireTime: number; + /** How long the BTR waits at every point in its path */ + pointWaitTime: MinMax; + /** How long after purchasing the taxi service before the BTR leaves */ + taxiWaitTime: number; +} diff --git a/types/models/spt/config/IBaseConfig.d.ts b/types/models/spt/config/IBaseConfig.d.ts index 8b6ba88..8780d43 100644 --- a/types/models/spt/config/IBaseConfig.d.ts +++ b/types/models/spt/config/IBaseConfig.d.ts @@ -1,3 +1,7 @@ export interface IBaseConfig { kind: string; } +export interface IRunIntervalValues { + inRaid: number; + outOfRaid: number; +} diff --git a/types/models/spt/config/IBotConfig.d.ts b/types/models/spt/config/IBotConfig.d.ts index 65aaa97..d326b38 100644 --- a/types/models/spt/config/IBotConfig.d.ts +++ b/types/models/spt/config/IBotConfig.d.ts @@ -1,19 +1,19 @@ -import { GenerationData } from "../../../models/eft/common/tables/IBotType"; -import { MinMax } from "../../common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; -import { IBotDurability } from "./IBotDurability"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IBotDurability } from "@spt-aki/models/spt/config/IBotDurability"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** Bot roles that should not have PMC types (sptBear/sptUsec) added as enemies to */ + botsToNotAddPMCsAsEnemiesTo: string[]; /** What bot types should be classified as bosses */ bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; /** Controls the percentage values of randomization item resources */ lootItemResourceRandomization: Record; - /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ - lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; /** Control how many items are allowed to spawn on a bot @@ -25,12 +25,20 @@ export interface IBotConfig extends IBaseConfig { showTypeInNickname: boolean; /** What ai brain should a normal scav use per map */ assaultBrainType: Record>; + /** What ai brain should a player scav use per map */ + playerScavBrainType: Record>; /** Max number of bots that can be spawned in a raid at any one time */ maxBotCap: Record; /** Chance scav has fake pscav name e.g. Scav name (player name) */ chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; + /** Settings to control the items that get added into wallets on bots */ + walletLoot: IWalletLootSettings; + /** Currency weights, Keyed by botrole / currency */ + currencyStackSize: Record>>; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -71,9 +79,14 @@ export interface PresetBatch { sptUsec: number; sptBear: number; } -export interface LootNvalue { - scav: number; - pmc: number; +export interface IWalletLootSettings { + /** Chance wallets have loot in them */ + chancePercent: number; + itemCount: MinMax; + stackSizeWeight: Record; + currencyWeight: Record; + /** What wallets will have money in them */ + walletTplPool: string[]; } export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ @@ -92,6 +105,11 @@ export interface EquipmentFilters { nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; + /** Should plates be filtered by level */ + filterPlatesByLevel?: boolean; + /** What additional slot ids should be seen as required when choosing a mod to add to a weapon */ + weaponSlotIdsToMakeRequired?: string[]; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */ @@ -102,6 +120,9 @@ export interface EquipmentFilters { weightingAdjustmentsByBotLevel: WeightingAdjustmentDetails[]; /** Same as weightingAdjustments but based on player level instead of bot level */ weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; + /** Should the stock mod be forced to spawn on bot */ + forceStock?: boolean; + armorPlateWeighting?: IArmorPlateWeights[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -113,14 +134,16 @@ export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; generation?: Record; - /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ + /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Mod chances */ - mods?: Record; + /** Weapon mod chances */ + weaponMods?: Record; + /** Equipment mod chances */ + equipmentMods?: Record; } export interface EquipmentFilterDetails { /** Between what levels do these equipment filter setting apply to */ @@ -134,16 +157,22 @@ export interface WeightingAdjustmentDetails { /** Between what levels do these weight settings apply to */ levelRange: MinMax; /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ - ammo?: AdjustmentDetails; + ammo?: IAdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ - equipment?: AdjustmentDetails; + equipment?: IAdjustmentDetails; /** Key: clothing slot e.g. feet, value: item tpl + weight */ - clothing?: AdjustmentDetails; + clothing?: IAdjustmentDetails; } -export interface AdjustmentDetails { +export interface IAdjustmentDetails { add: Record>; edit: Record>; } +export interface IArmorPlateWeights { + levelRange: MinMax; + frontPlateWeights: Record; + backPlateWeights: Record; + sidePlateWeights: Record; +} export interface IRandomisedResourceDetails { food: IRandomisedResourceValues; meds: IRandomisedResourceValues; diff --git a/types/models/spt/config/IBotDurability.d.ts b/types/models/spt/config/IBotDurability.d.ts index a4ff53c..728db97 100644 --- a/types/models/spt/config/IBotDurability.d.ts +++ b/types/models/spt/config/IBotDurability.d.ts @@ -7,6 +7,9 @@ export interface IBotDurability { cursedassault: BotDurability; marksman: BotDurability; pmcbot: BotDurability; + arenafighterevent: BotDurability; + arenafighter: BotDurability; + crazyassaultevent: BotDurability; exusec: BotDurability; gifter: BotDurability; sectantpriest: BotDurability; diff --git a/types/models/spt/config/ICoreConfig.d.ts b/types/models/spt/config/ICoreConfig.d.ts index 1207359..74604b0 100644 --- a/types/models/spt/config/ICoreConfig.d.ts +++ b/types/models/spt/config/ICoreConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ICoreConfig extends IBaseConfig { kind: "aki-core"; akiVersion: string; @@ -7,6 +7,8 @@ export interface ICoreConfig extends IBaseConfig { serverName: string; profileSaveIntervalSeconds: number; sptFriendNickname: string; + bsgLogging: IBsgLogging; + release: IRelease; fixes: IGameFixes; features: IServerFeatures; /** Commit hash build server was created from */ @@ -14,12 +16,55 @@ export interface ICoreConfig extends IBaseConfig { /** Timestamp of server build */ buildTime?: string; } +export interface IBsgLogging { + /** + * verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals. + * complain to them about it! In all cases, better exceptions will be logged. + * WARNING: trace-info logging will quickly create log files in the megabytes. + * 0 - trace + * 1 - debug + * 2 - info + * 3 - warn + * 4 - error + * 5 - fatal + * 6 - off + */ + verbosity: number; + sendToServer: boolean; +} +export interface IRelease { + betaDisclaimerText?: string; + betaDisclaimerAcceptText: string; + serverModsLoadedText: string; + serverModsLoadedDebugText: string; + clientModsLoadedText: string; + clientModsLoadedDebugText: string; + illegalPluginsLoadedText: string; + illegalPluginsExceptionText: string; + releaseSummaryText?: string; + isBeta?: boolean; + isModdable?: boolean; + isModded: boolean; + betaDisclaimerTimeoutDelay: number; +} export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ fixShotgunDispersion: boolean; /** Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load*/ removeModItemsFromProfile: boolean; + /** Fix issues that cause the game to not start due to inventory item issues */ + fixProfileBreakingInventoryItemIssues: boolean; } export interface IServerFeatures { autoInstallModDependencies: boolean; + compressProfile: boolean; + chatbotFeatures: IChatbotFeatures; +} +export interface IChatbotFeatures { + sptFriendEnabled: boolean; + commandoEnabled: boolean; + commandoFeatures: ICommandoFeatures; +} +export interface ICommandoFeatures { + giveCommandEnabled: boolean; } diff --git a/types/models/spt/config/IGiftsConfig.d.ts b/types/models/spt/config/IGiftsConfig.d.ts index 37a132d..b73761b 100644 --- a/types/models/spt/config/IGiftsConfig.d.ts +++ b/types/models/spt/config/IGiftsConfig.d.ts @@ -1,9 +1,10 @@ -import { Item } from "../../../models/eft/common/tables/IItem"; -import { IUserDialogInfo } from "../../../models/eft/profile/IAkiProfile"; -import { GiftSenderType } from "../../../models/enums/GiftSenderType"; -import { SeasonalEventType } from "../../../models/enums/SeasonalEventType"; -import { Traders } from "../../../models/enums/Traders"; -import { IBaseConfig } from "./IBaseConfig"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { GiftSenderType } from "@spt-aki/models/enums/GiftSenderType"; +import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { IProfileChangeEvent } from "../dialog/ISendMessageDetails"; export interface IGiftsConfig extends IBaseConfig { kind: "aki-gifts"; gifts: Record; @@ -25,4 +26,6 @@ export interface Gift { timestampToSend?: number; associatedEvent: SeasonalEventType; collectionTimeHours: number; + /** Optional, can be used to change profile settings like level/skills */ + profileChangeEvents?: IProfileChangeEvent[]; } diff --git a/types/models/spt/config/IHealthConfig.d.ts b/types/models/spt/config/IHealthConfig.d.ts index fdbf656..49b405f 100644 --- a/types/models/spt/config/IHealthConfig.d.ts +++ b/types/models/spt/config/IHealthConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHealthConfig extends IBaseConfig { kind: "aki-health"; healthMultipliers: HealthMultipliers; diff --git a/types/models/spt/config/IHideoutConfig.d.ts b/types/models/spt/config/IHideoutConfig.d.ts index bedd941..249c79a 100644 --- a/types/models/spt/config/IHideoutConfig.d.ts +++ b/types/models/spt/config/IHideoutConfig.d.ts @@ -1,7 +1,10 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; + /** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; hoursForSkillCrafting: number; expCraftAmount: number; } diff --git a/types/models/spt/config/IHttpConfig.d.ts b/types/models/spt/config/IHttpConfig.d.ts index aff7aec..9007245 100644 --- a/types/models/spt/config/IHttpConfig.d.ts +++ b/types/models/spt/config/IHttpConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHttpConfig extends IBaseConfig { webSocketPingDelayMs: number; kind: "aki-http"; diff --git a/types/models/spt/config/IInRaidConfig.d.ts b/types/models/spt/config/IInRaidConfig.d.ts index 3d3b1a2..cc6feca 100644 --- a/types/models/spt/config/IInRaidConfig.d.ts +++ b/types/models/spt/config/IInRaidConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IInRaidConfig extends IBaseConfig { kind: "aki-inraid"; MIAOnRaidEnd: boolean; @@ -8,12 +8,20 @@ export interface IInRaidConfig extends IBaseConfig { save: Save; /** Names of car extracts */ carExtracts: string[]; - /** Fene rep gain from a single car extract */ + /** Names of coop extracts */ + coopExtracts: string[]; + /** Fence rep gain from a single car extract */ carExtractBaseStandingGain: number; + /** Fence rep gain from a single coop extract */ + coopExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */ + pmcKillProbabilityForScavGain: number; /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ keepFiRSecureContainerOnDeath: boolean; + /** Percentage chance a player scav hot is hostile to the player when scavving */ + playerScavHostileChancePercent: number; } export interface RaidMenuSettings { aiAmount: string; @@ -22,6 +30,8 @@ export interface RaidMenuSettings { scavWars: boolean; taggedAndCursed: boolean; enablePve: boolean; + randomWeather: boolean; + randomTime: boolean; } export interface Save { /** Should loot gained from raid be saved */ diff --git a/types/models/spt/config/IInsuranceConfig.d.ts b/types/models/spt/config/IInsuranceConfig.d.ts index b51dc8b..794abb7 100644 --- a/types/models/spt/config/IInsuranceConfig.d.ts +++ b/types/models/spt/config/IInsuranceConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IInsuranceConfig extends IBaseConfig { kind: "aki-insurance"; /** Insurance price multiplier */ @@ -7,6 +7,8 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; + /** Some slots should always be removed, e.g. 'cartridges' */ + slotIdsToAlwaysRemove: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/types/models/spt/config/IInventoryConfig.d.ts b/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..bc64719 100644 --- a/types/models/spt/config/IInventoryConfig.d.ts +++ b/types/models/spt/config/IInventoryConfig.d.ts @@ -1,5 +1,5 @@ -import { MinMax } from "../../../models/common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; /** Should new items purchased by flagged as found in raid */ @@ -8,6 +8,8 @@ export interface IInventoryConfig extends IBaseConfig { sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; + /** Multipliers for skill gain when inside menus, NOT in-game */ + skillGainMultiplers: Record; } export interface RewardDetails { rewardCount: number; @@ -23,4 +25,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/types/models/spt/config/IItemConfig.d.ts b/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..40daa68 100644 --- a/types/models/spt/config/IItemConfig.d.ts +++ b/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,11 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** items that should not be given as rewards */ + rewardItemBlacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; + handbookPriceOverride: Record; } diff --git a/types/models/spt/config/ILocaleConfig.d.ts b/types/models/spt/config/ILocaleConfig.d.ts index 0a8955c..bf57df6 100644 --- a/types/models/spt/config/ILocaleConfig.d.ts +++ b/types/models/spt/config/ILocaleConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ @@ -7,4 +7,7 @@ export interface ILocaleConfig extends IBaseConfig { serverLocale: string; /** Languages server can be translated into */ serverSupportedLocales: string[]; + fallbacks: { + [locale: string]: string; + }; } diff --git a/types/models/spt/config/ILocationConfig.d.ts b/types/models/spt/config/ILocationConfig.d.ts index d1af8b3..407bef4 100644 --- a/types/models/spt/config/ILocationConfig.d.ts +++ b/types/models/spt/config/ILocationConfig.d.ts @@ -1,6 +1,6 @@ -import { MinMax } from "../../../models/common/MinMax"; -import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { BossLocationSpawn, Wave } from "@spt-aki/models/eft/common/ILocationBase"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; /** Waves with a min/max of the same value don't spawn any bots, bsg only spawn the difference between min and max */ @@ -34,17 +34,19 @@ export interface ILocationConfig extends IBaseConfig { /** How full must a random static magazine be %*/ minFillStaticMagazinePercent: number; allowDuplicateItemsInStaticContainers: boolean; + /** Chance loose/static magazines have ammo in them */ + magazineLootHasAmmoChancePercent: number; /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; + /** Key: map, value: settings to control how long scav raids are*/ + scavRaidTimeSettings: IScavRaidTimeSettings; + /** Settings to adjust mods for lootable equipment in raid */ + equipmentLootSettings: IEquipmentLootSettings; + /** Sets the max Patrol Value of the Boxzone on the map Ground Zero*/ + sandboxMaxPatrolvalue: number; } -export interface IContainerRandomistionSettings { - enabled: boolean; - /** What maps can use the container randomisation feature */ - maps: Record; - /** Some container types don't work when randomised */ - containerTypesToNotRandomise: string[]; - containerGroupMinSizeMultiplier: number; - containerGroupMaxSizeMultiplier: number; +export interface IEquipmentLootSettings { + modSpawnChancePercent: Record; } export interface IFixEmptyBotWavesSettings { enabled: boolean; @@ -85,4 +87,35 @@ export interface LootMultiplier { tarkovstreets: number; terminal: number; town: number; + sandbox: number; +} +export interface IContainerRandomistionSettings { + enabled: boolean; + /** What maps can use the container randomisation feature */ + maps: Record; + /** Some container types don't work when randomised */ + containerTypesToNotRandomise: string[]; + containerGroupMinSizeMultiplier: number; + containerGroupMaxSizeMultiplier: number; +} +export interface IScavRaidTimeSettings { + settings: IScavRaidTimeConfigSettings; + maps: Record; +} +export interface IScavRaidTimeConfigSettings { + trainArrivalDelayObservedSeconds: number; +} +export interface IScavRaidTimeLocationSettings { + /** Should loot be reduced by same percent length of raid is reduced by */ + reduceLootByPercent: boolean; + /** Smallest % of container loot that should be spawned */ + minStaticLootPercent: number; + /** Smallest % of loose loot that should be spawned */ + minDynamicLootPercent: number; + /** Chance raid time is reduced */ + reducedChancePercent: number; + /** How much should raid time be reduced - weighted */ + reductionPercentWeights: Record; + /** Should bot waves be removed / spawn times be adjusted */ + adjustWaves: boolean; } diff --git a/types/models/spt/config/ILootConfig.d.ts b/types/models/spt/config/ILootConfig.d.ts index f7fb472..003d6c6 100644 --- a/types/models/spt/config/ILootConfig.d.ts +++ b/types/models/spt/config/ILootConfig.d.ts @@ -1,5 +1,5 @@ -import { Spawnpoint } from "../../../models/eft/common/ILooseLoot"; -import { IBaseConfig } from "./IBaseConfig"; +import { Spawnpoint } from "@spt-aki/models/eft/common/ILooseLoot"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ILootConfig extends IBaseConfig { kind: "aki-loot"; /** Spawn positions to add into a map, key=mapid */ diff --git a/types/models/spt/config/ILostOnDeathConfig.d.ts b/types/models/spt/config/ILostOnDeathConfig.d.ts index 3fb98fb..d440e91 100644 --- a/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ILostOnDeathConfig extends IBaseConfig { kind: "aki-lostondeath"; /** What equipment in each slot should be lost on death */ @@ -16,6 +16,7 @@ export interface Equipment { ArmorVest: boolean; Eyewear: boolean; TacticalVest: boolean; + PocketItems: boolean; Backpack: boolean; Holster: boolean; FirstPrimaryWeapon: boolean; diff --git a/types/models/spt/config/IMatchConfig.d.ts b/types/models/spt/config/IMatchConfig.d.ts index 92c4d77..dc7a8cb 100644 --- a/types/models/spt/config/IMatchConfig.d.ts +++ b/types/models/spt/config/IMatchConfig.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IMatchConfig extends IBaseConfig { kind: "aki-match"; enabled: boolean; diff --git a/types/models/spt/config/IPlayerScavConfig.d.ts b/types/models/spt/config/IPlayerScavConfig.d.ts index a10f28f..e5abca2 100644 --- a/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/types/models/spt/config/IPlayerScavConfig.d.ts @@ -1,5 +1,5 @@ -import { GenerationData } from "../../../models/eft/common/tables/IBotType"; -import { IBaseConfig } from "./IBaseConfig"; +import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IPlayerScavConfig extends IBaseConfig { kind: "aki-playerscav"; karmaLevel: Record; @@ -9,7 +9,7 @@ export interface KarmaLevel { modifiers: Modifiers; itemLimits: ItemLimits; equipmentBlacklist: Record; - labsAccessCardChancePercent: number; + lootItemsToAddChancePercent: Record; } export interface Modifiers { equipment: Record; diff --git a/types/models/spt/config/IPmChatResponse.d.ts b/types/models/spt/config/IPmChatResponse.d.ts index c48b274..50afdbc 100644 --- a/types/models/spt/config/IPmChatResponse.d.ts +++ b/types/models/spt/config/IPmChatResponse.d.ts @@ -1,4 +1,4 @@ -import { IBaseConfig } from "./IBaseConfig"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IPmcChatResponse extends IBaseConfig { kind: "aki-pmcchatresponse"; victim: IResponseSettings; diff --git a/types/models/spt/config/IPmcConfig.d.ts b/types/models/spt/config/IPmcConfig.d.ts index 0f74620..65da29b 100644 --- a/types/models/spt/config/IPmcConfig.d.ts +++ b/types/models/spt/config/IPmcConfig.d.ts @@ -1,6 +1,6 @@ -import { MemberCategory } from "../../../models/enums/MemberCategory"; -import { MinMax } from "../../common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IPmcConfig extends IBaseConfig { kind: "aki-pmc"; /** What game version should the PMC have */ @@ -13,7 +13,6 @@ export interface IPmcConfig extends IBaseConfig { pocketLoot: SlotLootSettings; /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; - dynamicLoot: DynamicLoot; /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; /** Difficulty override e.g. "AsOnline/Hard" */ @@ -42,9 +41,10 @@ export interface IPmcConfig extends IBaseConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** How many levels below player level can a PMC be */ + botRelativeLevelDeltaMin: number; /** Force a number of healing items into PMCs secure container to ensure they can heal */ forceHealingItemsIntoSecure: boolean; - addPrefixToSameNamePMCAsPlayerChance: number; allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { @@ -54,8 +54,4 @@ export interface PmcTypes { export interface SlotLootSettings { whitelist: string[]; blacklist: string[]; - moneyStackLimits: Record; -} -export interface DynamicLoot { - moneyStackLimits: Record; } diff --git a/types/models/spt/config/IQuestConfig.d.ts b/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..c190d01 100644 --- a/types/models/spt/config/IQuestConfig.d.ts +++ b/types/models/spt/config/IQuestConfig.d.ts @@ -1,7 +1,7 @@ -import { MinMax } from "../../../models/common/MinMax"; -import { SeasonalEventType } from "../../../models/enums/SeasonalEventType"; -import { ELocationName } from "../../enums/ELocationName"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; +import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; @@ -31,6 +31,7 @@ export interface IEventQuestData { yearly: boolean; } export interface IRepeatableQuestConfig { + id: string; name: string; side: string; types: string[]; @@ -54,33 +55,49 @@ export interface IRewardScaling { items: number[]; reputation: number[]; rewardSpread: number; + skillRewardChance: number[]; + skillPointReward: number[]; } export interface ITraderWhitelist { traderId: string; questTypes: string[]; + rewardBaseWhitelist: string[]; + rewardCanBeWeapon: boolean; + weaponRewardChancePercent: number; } export interface IRepeatableQuestTypesConfig { Exploration: IExploration; Completion: ICompletion; + Pickup: IPickup; Elimination: IEliminationConfig[]; } -export interface IExploration { +export interface IExploration extends IBaseQuestConfig { maxExtracts: number; + maxExtractsWithSpecificExit: number; specificExits: ISpecificExits; } export interface ISpecificExits { probability: number; passageRequirementWhitelist: string[]; } -export interface ICompletion { +export interface ICompletion extends IBaseQuestConfig { minRequestedAmount: number; maxRequestedAmount: number; + uniqueItemCount: number; minRequestedBulletAmount: number; maxRequestedBulletAmount: number; useWhitelist: boolean; useBlacklist: boolean; } -export interface IEliminationConfig { +export interface IPickup extends IBaseQuestConfig { + ItemTypeToFetchWithMaxCount: IPickupTypeWithMaxCount[]; +} +export interface IPickupTypeWithMaxCount { + itemType: string; + maxPickupCount: number; + minPickupCount: number; +} +export interface IEliminationConfig extends IBaseQuestConfig { levelRange: MinMax; targets: ITarget[]; bodyPartProb: number; @@ -92,16 +109,31 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + minPmcKills: number; + maxPmcKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; +} +export interface IBaseQuestConfig { + possibleSkillRewards: string[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; } export interface IBossInfo { isBoss: boolean; + isPmc: boolean; } export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/types/models/spt/config/IRagfairConfig.d.ts b/types/models/spt/config/IRagfairConfig.d.ts index 7aea24f..33dee7b 100644 --- a/types/models/spt/config/IRagfairConfig.d.ts +++ b/types/models/spt/config/IRagfairConfig.d.ts @@ -1,9 +1,11 @@ -import { MinMax } from "../../common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Default values used to hydrate `runIntervalSeconds` with */ + runIntervalValues: IRunIntervalValues; /** Player listing settings */ sell: Sell; /** Trader ids + should their assorts be listed on flea*/ @@ -16,25 +18,19 @@ export interface Sell { /** Settings to control chances of offer being sold */ chance: Chance; /** Settings to control how long it takes for a player offer to sell */ - time: Time; - /** Player offer reputation gain/loss settings */ - reputation: Reputation; - /** How many hours are simulated to figure out if player offer was sold */ - simulatedSellHours: number; + time: MinMax; /**Seconds from clicking remove to remove offer from market */ expireSeconds: number; } export interface Chance { + /** Base chance percent to sell an item */ base: number; - overpriced: number; - underpriced: number; -} -export interface Time extends MinMax { - base: number; -} -export interface Reputation { - gain: number; - loss: number; + /** Value to multiply the sell chance by */ + sellMultiplier: number; + /** Max possible sell chance % for a player listed offer */ + maxSellChancePercent: number; + /** Min possible sell chance % for a player listed offer */ + minSellChancePercent: number; } export interface Dynamic { purchasesAreFoundInRaid: boolean; @@ -62,6 +58,10 @@ export interface Dynamic { nonStackableCount: MinMax; /** Range of rating offers for items being listed */ rating: MinMax; + /** Armor specific flea settings */ + armor: IArmorSettings; + /** A multipler to apply to individual tpls price just prior to item quality adjustment */ + itemPriceMultiplier: Record; /** Percentages to sell offers in each currency */ currencies: Record; /** Item tpls that should be forced to sell as a single item */ @@ -79,8 +79,6 @@ export interface IPriceRanges { pack: MinMax; } export interface IBarterDetails { - /** Should barter offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a barter */ chancePercent: number; /** Min number of required items for a barter requirement */ @@ -95,8 +93,6 @@ export interface IBarterDetails { itemTypeBlacklist: string[]; } export interface IPackDetails { - /** Should pack offers be generated */ - enable: boolean; /** Percentage change an offer is listed as a pack */ chancePercent: number; /** Min number of required items for a pack */ @@ -116,9 +112,11 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition extends MinMax { +export interface Condition { /** Percentage change durability is altered */ conditionChance: number; + current: MinMax; + max: MinMax; } export interface Blacklist { /** Damaged ammo packs */ @@ -129,11 +127,32 @@ export interface Blacklist { enableBsgList: boolean; /** Should quest items be blacklisted from flea */ enableQuestList: boolean; - /** Should trader items that are blacklisted by bsg */ + /** Should trader items that are blacklisted by bsg be listed on flea */ traderItems: boolean; + /** Maximum level an armor plate can be found in a flea-listed armor item */ + armorPlate: IArmorPlateBlacklistSettings; + /** Should specific categories be blacklisted from the flea, true = use blacklist */ + enableCustomItemCategoryList: boolean; + /** Custom category blacklist for parent Ids */ + customItemCategoryList: string[]; +} +export interface IArmorPlateBlacklistSettings { + /** Max level of plates an armor can have without being removed */ + maxProtectionLevel: number; + /** Item slots to NOT remove from items on flea */ + ignoreSlots: string[]; } export interface IUnreasonableModPrices { + /** Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values */ enabled: boolean; + /** Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted */ handbookPriceOverMultiplier: number; + /** The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price */ newPriceHandbookMultiplier: number; } +export interface IArmorSettings { + /** % chance / 100 that armor plates will be removed from an offer before listing */ + removeRemovablePlateChance: number; + /** What slots are to be removed when removeRemovablePlateChance is true */ + plateSlotIdToRemovePool: string[]; +} diff --git a/types/models/spt/config/IRepairConfig.d.ts b/types/models/spt/config/IRepairConfig.d.ts index b6db332..9e23cc4 100644 --- a/types/models/spt/config/IRepairConfig.d.ts +++ b/types/models/spt/config/IRepairConfig.d.ts @@ -1,13 +1,35 @@ -import { MinMax } from "../../../models/common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IRepairConfig extends IBaseConfig { kind: "aki-repair"; priceMultiplier: number; applyRandomizeDurabilityLoss: boolean; weaponSkillRepairGain: number; armorKitSkillPointGainPerRepairPointMultiplier: number; + /** INT gain multiplier per repaired item type */ + repairKitIntellectGainMultiplier: IIntellectGainValues; + maxIntellectGainPerRepair: IMaxIntellectGainValues; + weaponTreatment: IWeaponTreatmentRepairValues; repairKit: RepairKit; } +export interface IIntellectGainValues { + weapon: number; + armor: number; +} +export interface IMaxIntellectGainValues { + kit: number; + trader: number; +} +export interface IWeaponTreatmentRepairValues { + /** The chance to gain more weapon maintenance skill */ + critSuccessChance: number; + critSuccessAmount: number; + /** The chance to gain less weapon maintenance skill */ + critFailureChance: number; + critFailureAmount: number; + /** The multiplier used for calculating weapon maintenance XP */ + pointGainMultiplier: number; +} export interface RepairKit { armor: BonusSettings; weapon: BonusSettings; diff --git a/types/models/spt/config/IScavCaseConfig.d.ts b/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..92f2722 100644 --- a/types/models/spt/config/IScavCaseConfig.d.ts +++ b/types/models/spt/config/IScavCaseConfig.d.ts @@ -1,5 +1,5 @@ -import { MinMax } from "../../common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IScavCaseConfig extends IBaseConfig { kind: "aki-scavcase"; rewardItemValueRangeRub: Record; @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/types/models/spt/config/ISeasonalEventConfig.d.ts b/types/models/spt/config/ISeasonalEventConfig.d.ts index 7a5295c..6334570 100644 --- a/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,11 +1,14 @@ -import { SeasonalEventType } from "../../../models/enums/SeasonalEventType"; -import { IBaseConfig } from "./IBaseConfig"; +import { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase"; +import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; enableSeasonalEventDetection: boolean; /** event / botType / equipSlot / itemid */ eventGear: Record>>>; events: ISeasonalEvent[]; + eventBotMapping: Record; + eventBossSpawns: Record>; gifterSettings: GifterSetting[]; } export interface ISeasonalEvent { diff --git a/types/models/spt/config/ITraderConfig.d.ts b/types/models/spt/config/ITraderConfig.d.ts index 85adf73..73bd5a8 100644 --- a/types/models/spt/config/ITraderConfig.d.ts +++ b/types/models/spt/config/ITraderConfig.d.ts @@ -1,32 +1,38 @@ -import { MinMax } from "../../../models/common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; +import { LootRequest } from "@spt-aki/models/spt/services/LootRequest"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; purchasesAreFoundInRaid: boolean; + /** Should trader reset times be set based on server start time (false = bsg time - on the hour) */ + tradersResetFromServerStart: boolean; updateTimeDefault: number; traderPriceMultipler: number; - /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ - persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { traderId: string; - seconds: number; + /** Seconds between trader resets */ + seconds: MinMax; } export interface FenceConfig { discountOptions: DiscountOptions; partialRefreshTimeSeconds: number; partialRefreshChangePercent: number; assortSize: number; - maxPresetsPercent: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; itemPriceMult: number; presetPriceMult: number; - armorMaxDurabilityPercentMinMax: MinMax; - presetMaxDurabilityPercentMinMax: MinMax; + armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax; + weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax; + chancePlateExistsInArmorPercent: number; /** Key: item tpl */ itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; + /** Prevent duplicate offers of items of specific categories by parentId*/ + preventDuplicateOffersOfCategory: string[]; regenerateAssortsOnRefresh: boolean; /** Max rouble price before item is not listed on flea */ itemCategoryRoublePriceLimit: Record; @@ -35,9 +41,22 @@ export interface FenceConfig { /** Block seasonal items from appearing when season is inactive */ blacklistSeasonalItems: boolean; blacklist: string[]; + coopExtractGift: CoopExtractReward; + btrDeliveryExpireHours: number; +} +export interface IItemDurabilityCurrentMax { + current: MinMax; + max: MinMax; +} +export interface CoopExtractReward extends LootRequest { + sendGift: boolean; + messageLocaleIds: string[]; + giftExpiryHours: number; } export interface DiscountOptions { assortSize: number; itemPriceMult: number; presetPriceMult: number; + weaponPresetMinMax: MinMax; + equipmentPresetMinMax: MinMax; } diff --git a/types/models/spt/config/IWeatherConfig.d.ts b/types/models/spt/config/IWeatherConfig.d.ts index 6ecf35b..3e8f282 100644 --- a/types/models/spt/config/IWeatherConfig.d.ts +++ b/types/models/spt/config/IWeatherConfig.d.ts @@ -1,10 +1,11 @@ -import { WindDirection } from "../../../models/enums/WindDirection"; -import { MinMax } from "../../common/MinMax"; -import { IBaseConfig } from "./IBaseConfig"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { WindDirection } from "@spt-aki/models/enums/WindDirection"; +import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { kind: "aki-weather"; acceleration: number; weather: Weather; + forceWinterEvent: boolean; } export interface Weather { clouds: WeatherSettings; diff --git a/types/models/spt/controllers/IBotController.d.ts b/types/models/spt/controllers/IBotController.d.ts index 010e208..3e8e035 100644 --- a/types/models/spt/controllers/IBotController.d.ts +++ b/types/models/spt/controllers/IBotController.d.ts @@ -1,7 +1,7 @@ -import { IGenerateBotsRequestData } from "../../eft/bot/IGenerateBotsRequestData"; -import { IBotBase } from "../../eft/common/tables/IBotBase"; -import { IBotCore } from "../../eft/common/tables/IBotCore"; -import { Difficulty } from "../../eft/common/tables/IBotType"; +import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; +import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType"; export interface IBotController { getBotLimit(type: string): number; getBotDifficulty(type: string, difficulty: string): IBotCore | Difficulty; diff --git a/types/models/spt/dialog/ISendMessageDetails.d.ts b/types/models/spt/dialog/ISendMessageDetails.d.ts index 2f09733..2068ede 100644 --- a/types/models/spt/dialog/ISendMessageDetails.d.ts +++ b/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -1,7 +1,7 @@ -import { Item } from "../../../models/eft/common/tables/IItem"; -import { ISystemData, IUserDialogInfo, MessageContentRagfair } from "../../../models/eft/profile/IAkiProfile"; -import { MessageType } from "../../../models/enums/MessageType"; -import { Traders } from "../../../models/enums/Traders"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ISystemData, IUserDialogInfo, MessageContentRagfair } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Traders } from "@spt-aki/models/enums/Traders"; export interface ISendMessageDetails { /** Player id */ recipientId: string; @@ -25,6 +25,12 @@ export interface ISendMessageDetails { systemData?: ISystemData; /** Optional - Used by ragfair messages */ ragfairDetails?: MessageContentRagfair; - /** Optional - Usage not known, unsure of purpose, even dumps dont have it */ - profileChangeEvents?: any[]; + /** OPTIONAL - allows modification of profile settings via mail */ + profileChangeEvents?: IProfileChangeEvent[]; +} +export interface IProfileChangeEvent { + _id: string; + Type: "TraderSalesSum" | "TraderStanding" | "ProfileLevel" | "SkillPoints" | "ExamineAllItems" | "UnlockTrader"; + value: number; + entity?: string; } diff --git a/types/models/spt/fence/IFenceAssortGenerationValues.d.ts b/types/models/spt/fence/IFenceAssortGenerationValues.d.ts new file mode 100644 index 0000000..dea4726 --- /dev/null +++ b/types/models/spt/fence/IFenceAssortGenerationValues.d.ts @@ -0,0 +1,9 @@ +export interface IFenceAssortGenerationValues { + normal: IGenerationAssortValues; + discount: IGenerationAssortValues; +} +export interface IGenerationAssortValues { + item: number; + weaponPreset: number; + equipmentPreset: number; +} diff --git a/types/models/spt/generators/IBotGenerator.d.ts b/types/models/spt/generators/IBotGenerator.d.ts index 9043945..2cb337d 100644 --- a/types/models/spt/generators/IBotGenerator.d.ts +++ b/types/models/spt/generators/IBotGenerator.d.ts @@ -1,10 +1,5 @@ -import { Inventory as PmcInventory } from "../../eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation } from "../../eft/common/tables/IBotType"; +import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { Chances, Generation, Inventory } from "@spt-aki/models/eft/common/tables/IBotType"; export interface IBotGenerator { generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; } -export interface IExhaustableArray { - getRandomValue(): T; - getFirstValue(): T; - hasValues(): boolean; -} diff --git a/types/models/spt/generators/ILocationGenerator.d.ts b/types/models/spt/generators/ILocationGenerator.d.ts index 530ceca..347d5fa 100644 --- a/types/models/spt/generators/ILocationGenerator.d.ts +++ b/types/models/spt/generators/ILocationGenerator.d.ts @@ -1,5 +1,5 @@ -import { IStaticContainerProps, IStaticLootDetails, IStaticAmmoDetails, IStaticForcedProps } from "../../eft/common/tables/ILootBase"; -import { ILooseLoot, SpawnpointTemplate } from "../../eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointTemplate } from "@spt-aki/models/eft/common/ILooseLoot"; +import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "@spt-aki/models/eft/common/tables/ILootBase"; export interface ILocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; diff --git a/types/models/spt/generators/IRagfairAssortGenerator.d.ts b/types/models/spt/generators/IRagfairAssortGenerator.d.ts index 6670540..bcd26c2 100644 --- a/types/models/spt/generators/IRagfairAssortGenerator.d.ts +++ b/types/models/spt/generators/IRagfairAssortGenerator.d.ts @@ -1,4 +1,4 @@ -import { Item } from "../../eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IRagfairAssortGenerator { getAssortItems(): Item[]; } diff --git a/types/models/spt/generators/IRagfairOfferGenerator.d.ts b/types/models/spt/generators/IRagfairOfferGenerator.d.ts index 30b4be5..bb5fdf9 100644 --- a/types/models/spt/generators/IRagfairOfferGenerator.d.ts +++ b/types/models/spt/generators/IRagfairOfferGenerator.d.ts @@ -1,6 +1,6 @@ -import { IBarterScheme } from "../../eft/common/tables/ITrader"; -import { IRagfairOffer } from "../../eft/ragfair/IRagfairOffer"; -import { Item } from "../../eft/common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export interface IRagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece: boolean): IRagfairOffer; } diff --git a/types/models/spt/location/IRaidChanges.d.ts b/types/models/spt/location/IRaidChanges.d.ts new file mode 100644 index 0000000..b7a989b --- /dev/null +++ b/types/models/spt/location/IRaidChanges.d.ts @@ -0,0 +1,8 @@ +export interface IRaidChanges { + /** What percentage of dynamic loot should the map contain */ + dynamicLootPercent: number; + /** What percentage of static loot should the map contain */ + staticLootPercent: number; + /** How many seconds into the raid is the player simulated to spawn in at */ + simulatedRaidStartSeconds: number; +} diff --git a/types/models/spt/logging/IClientLogRequest.d.ts b/types/models/spt/logging/IClientLogRequest.d.ts new file mode 100644 index 0000000..b7e1b36 --- /dev/null +++ b/types/models/spt/logging/IClientLogRequest.d.ts @@ -0,0 +1,8 @@ +import { LogLevel } from "@spt-aki/models/spt/logging/LogLevel"; +export interface IClientLogRequest { + Source: string; + Level: LogLevel | string; + Message: string; + Color?: string; + BackgroundColor?: string; +} diff --git a/types/models/spt/logging/LogLevel.d.ts b/types/models/spt/logging/LogLevel.d.ts new file mode 100644 index 0000000..567733b --- /dev/null +++ b/types/models/spt/logging/LogLevel.d.ts @@ -0,0 +1,8 @@ +export declare enum LogLevel { + ERROR = 0, + WARN = 1, + SUCCESS = 2, + INFO = 3, + CUSTOM = 4, + DEBUG = 5 +} diff --git a/types/models/spt/logging/LogTextColor.d.ts b/types/models/spt/logging/LogTextColor.d.ts index 6c7abf3..aefca2a 100644 --- a/types/models/spt/logging/LogTextColor.d.ts +++ b/types/models/spt/logging/LogTextColor.d.ts @@ -7,5 +7,5 @@ export declare enum LogTextColor { MAGENTA = "magenta", CYAN = "cyan", WHITE = "white", - GRAY = "" + GRAY = "gray" } diff --git a/types/models/spt/mod/IPackageJsonData.d.ts b/types/models/spt/mod/IPackageJsonData.d.ts index 06f7454..0f6f26c 100644 --- a/types/models/spt/mod/IPackageJsonData.d.ts +++ b/types/models/spt/mod/IPackageJsonData.d.ts @@ -1,11 +1,17 @@ export interface IPackageJsonData { incompatibilities?: string[]; + loadBefore?: string[]; + loadAfter?: string[]; dependencies?: Record; modDependencies?: Record; name: string; + url: string; author: string; version: string; akiVersion: string; + /** We deliberately purge this data */ + scripts: Record; + devDependencies: Record; licence: string; main: string; isBundleMod: boolean; diff --git a/types/models/spt/mod/NewItemDetails.d.ts b/types/models/spt/mod/NewItemDetails.d.ts index 9e37cc9..304462d 100644 --- a/types/models/spt/mod/NewItemDetails.d.ts +++ b/types/models/spt/mod/NewItemDetails.d.ts @@ -1,4 +1,4 @@ -import { ITemplateItem, Props } from "../../eft/common/tables/ITemplateItem"; +import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem"; export declare abstract class NewItemDetailsBase { /** Price of the item on flea market */ fleaPriceRoubles: number; diff --git a/types/models/spt/repeatable/IQuestTypePool.d.ts b/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..bce68e8 --- /dev/null +++ b/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,32 @@ +import { ELocationName } from "@spt-aki/models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; + Pickup: IExplorationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/types/models/spt/server/ExhaustableArray.d.ts b/types/models/spt/server/ExhaustableArray.d.ts new file mode 100644 index 0000000..9f73b97 --- /dev/null +++ b/types/models/spt/server/ExhaustableArray.d.ts @@ -0,0 +1,17 @@ +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class ExhaustableArray implements IExhaustableArray { + private itemPool; + private randomUtil; + private jsonUtil; + private pool; + constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil); + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} +export interface IExhaustableArray { + getRandomValue(): T; + getFirstValue(): T; + hasValues(): boolean; +} diff --git a/types/models/spt/server/IDatabaseTables.d.ts b/types/models/spt/server/IDatabaseTables.d.ts index 66f9afb..8f0ff07 100644 --- a/types/models/spt/server/IDatabaseTables.d.ts +++ b/types/models/spt/server/IDatabaseTables.d.ts @@ -1,26 +1,27 @@ -import { IQteData } from "../../../models/eft/hideout/IQteData"; -import { IEquipmentBuild } from "../../../models/eft/profile/IAkiProfile"; -import { IGlobals } from "../../eft/common/IGlobals"; -import { IBotBase } from "../../eft/common/tables/IBotBase"; -import { IBotCore } from "../../eft/common/tables/IBotCore"; -import { IBotType } from "../../eft/common/tables/IBotType"; -import { ICustomizationItem } from "../../eft/common/tables/ICustomizationItem"; -import { IHandbookBase } from "../../eft/common/tables/IHandbookBase"; -import { ILootBase } from "../../eft/common/tables/ILootBase"; -import { IMatch } from "../../eft/common/tables/IMatch"; -import { IProfileTemplates } from "../../eft/common/tables/IProfileTemplate"; -import { IQuest } from "../../eft/common/tables/IQuest"; -import { IRepeatableQuestDatabase } from "../../eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -import { ITrader } from "../../eft/common/tables/ITrader"; -import { IHideoutArea } from "../../eft/hideout/IHideoutArea"; -import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; -import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; -import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; -import { ILocaleBase } from "./ILocaleBase"; -import { ILocations } from "./ILocations"; -import { IServerBase } from "./IServerBase"; -import { ISettingsBase } from "./ISettingsBase"; +import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; +import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore"; +import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; +import { ICustomizationItem } from "@spt-aki/models/eft/common/tables/ICustomizationItem"; +import { IHandbookBase } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { ILootBase } from "@spt-aki/models/eft/common/tables/ILootBase"; +import { IMatch } from "@spt-aki/models/eft/common/tables/IMatch"; +import { IProfileTemplates } from "@spt-aki/models/eft/common/tables/IProfileTemplate"; +import { IQuest } from "@spt-aki/models/eft/common/tables/IQuest"; +import { IRepeatableQuestDatabase } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ITrader } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IHideoutArea } from "@spt-aki/models/eft/hideout/IHideoutArea"; +import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction"; +import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase"; +import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase"; +import { IQteData } from "@spt-aki/models/eft/hideout/IQteData"; +import { IDefaultEquipmentPreset } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILocaleBase } from "@spt-aki/models/spt/server/ILocaleBase"; +import { ILocations } from "@spt-aki/models/spt/server/ILocations"; +import { IServerBase } from "@spt-aki/models/spt/server/IServerBase"; +import { ISettingsBase } from "@spt-aki/models/spt/server/ISettingsBase"; export interface IDatabaseTables { bots?: { types: Record; @@ -50,7 +51,9 @@ export interface IDatabaseTables { /** Flea prices of items - gathered from online flea market dump */ prices: Record; /** Default equipment loadouts that show on main inventory screen */ - defaultEquipmentPresets: IEquipmentBuild[]; + defaultEquipmentPresets: IDefaultEquipmentPreset[]; + /** Achievements */ + achievements: IAchievement[]; }; traders?: Record; globals?: IGlobals; diff --git a/types/models/spt/server/ILocations.d.ts b/types/models/spt/server/ILocations.d.ts index 18f0262..a52242f 100644 --- a/types/models/spt/server/ILocations.d.ts +++ b/types/models/spt/server/ILocations.d.ts @@ -1,26 +1,23 @@ -import { ILocationBase } from "../../eft/common/ILocationBase"; -import { ILooseLoot } from "../../eft/common/ILooseLoot"; -import { ILocationsBase } from "../../eft/common/tables/ILocationsBase"; +import { ILocation } from "@spt-aki/models/eft/common/ILocation"; +import { ILocationsBase } from "@spt-aki/models/eft/common/tables/ILocationsBase"; export interface ILocations { - bigmap?: ILocationData; - develop?: ILocationData; - factory4_day?: ILocationData; - factory4_night?: ILocationData; - hideout?: ILocationData; - interchange?: ILocationData; - laboratory?: ILocationData; - lighthouse?: ILocationData; - privatearea?: ILocationData; - rezervbase?: ILocationData; - shoreline?: ILocationData; - suburbs?: ILocationData; - tarkovstreets?: ILocationData; - terminal?: ILocationData; - town?: ILocationData; - woods?: ILocationData; + bigmap?: ILocation; + develop?: ILocation; + factory4_day?: ILocation; + factory4_night?: ILocation; + hideout?: ILocation; + interchange?: ILocation; + laboratory?: ILocation; + lighthouse?: ILocation; + privatearea?: ILocation; + rezervbase?: ILocation; + shoreline?: ILocation; + suburbs?: ILocation; + tarkovstreets?: ILocation; + terminal?: ILocation; + town?: ILocation; + woods?: ILocation; + sandbox?: ILocation; + /** Holds a mapping of the linkages between locations on the UI */ base?: ILocationsBase; } -export interface ILocationData { - base: ILocationBase; - looseLoot?: ILooseLoot; -} diff --git a/types/models/spt/services/CustomPreset.d.ts b/types/models/spt/services/CustomPreset.d.ts index 785e0a4..989c58f 100644 --- a/types/models/spt/services/CustomPreset.d.ts +++ b/types/models/spt/services/CustomPreset.d.ts @@ -1,4 +1,4 @@ -import { IPreset } from "../../eft/common/IGlobals"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; export interface CustomPreset { key: string; preset: IPreset; diff --git a/types/models/spt/services/CustomTraderAssortData.d.ts b/types/models/spt/services/CustomTraderAssortData.d.ts index 265a26a..289d66a 100644 --- a/types/models/spt/services/CustomTraderAssortData.d.ts +++ b/types/models/spt/services/CustomTraderAssortData.d.ts @@ -1,5 +1,5 @@ -import { ITraderAssort } from "../../eft/common/tables/ITrader"; -import { Traders } from "../../enums/Traders"; +import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { Traders } from "@spt-aki/models/enums/Traders"; export interface CustomTraderAssortData { traderId: Traders; assorts: ITraderAssort; diff --git a/types/models/spt/services/IInsuranceEquipmentPkg.d.ts b/types/models/spt/services/IInsuranceEquipmentPkg.d.ts new file mode 100644 index 0000000..379f3c9 --- /dev/null +++ b/types/models/spt/services/IInsuranceEquipmentPkg.d.ts @@ -0,0 +1,8 @@ +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +export interface IInsuranceEquipmentPkg { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; +} diff --git a/types/models/spt/services/ITraderServiceModel.d.ts b/types/models/spt/services/ITraderServiceModel.d.ts new file mode 100644 index 0000000..3fe43c4 --- /dev/null +++ b/types/models/spt/services/ITraderServiceModel.d.ts @@ -0,0 +1,18 @@ +import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType"; +export interface ITraderServiceModel { + serviceType: TraderServiceType; + itemsToPay?: { + [key: string]: number; + }; + itemsToReceive?: string[]; + subServices?: { + [key: string]: number; + }; + requirements?: ITraderServiceRequirementsModel; +} +export interface ITraderServiceRequirementsModel { + completedQuests?: string[]; + standings?: { + [key: string]: number; + }; +} diff --git a/types/models/spt/services/LootRequest.d.ts b/types/models/spt/services/LootRequest.d.ts index 044935d..d4fa902 100644 --- a/types/models/spt/services/LootRequest.d.ts +++ b/types/models/spt/services/LootRequest.d.ts @@ -1,6 +1,7 @@ -import { MinMax } from "../../common/MinMax"; +import { MinMax } from "@spt-aki/models/common/MinMax"; export interface LootRequest { - presetCount: MinMax; + weaponPresetCount: MinMax; + armorPresetCount: MinMax; itemCount: MinMax; weaponCrateCount: MinMax; itemBlacklist: string[]; @@ -9,4 +10,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/types/models/spt/utils/IAsyncQueue.d.ts b/types/models/spt/utils/IAsyncQueue.d.ts index 2be801a..464139a 100644 --- a/types/models/spt/utils/IAsyncQueue.d.ts +++ b/types/models/spt/utils/IAsyncQueue.d.ts @@ -1,4 +1,4 @@ -import { ICommand } from "./ICommand"; +import { ICommand } from "@spt-aki/models/spt/utils/ICommand"; export interface IAsyncQueue { waitFor(command: ICommand): Promise; } diff --git a/types/models/spt/utils/ILogger.d.ts b/types/models/spt/utils/ILogger.d.ts index 2af3fac..340f26b 100644 --- a/types/models/spt/utils/ILogger.d.ts +++ b/types/models/spt/utils/ILogger.d.ts @@ -1,6 +1,6 @@ -import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; -import { LogBackgroundColor } from "../logging/LogBackgroundColor"; -import { LogTextColor } from "../logging/LogTextColor"; +import { Daum } from "@spt-aki/models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "@spt-aki/models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; log(data: string | Record | Error, color: string, backgroundColor?: string): void; diff --git a/types/routers/EventOutputHolder.d.ts b/types/routers/EventOutputHolder.d.ts index 1966741..8ee10ef 100644 --- a/types/routers/EventOutputHolder.d.ts +++ b/types/routers/EventOutputHolder.d.ts @@ -1,9 +1,10 @@ -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { IHideoutImprovement, Productive, TraderData, TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHideoutImprovement, Productive, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { TraderData } from "@spt-aki/models/eft/itemEvent/IItemEventRouterBase"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class EventOutputHolder { protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; @@ -29,7 +30,7 @@ export declare class EventOutputHolder { /** * Convert the internal trader data object into an object we can send to the client * @param traderData server data for traders - * @returns + * @returns dict of trader id + TraderData */ protected constructTraderRelations(traderData: Record): Record; /** @@ -44,4 +45,9 @@ export declare class EventOutputHolder { * @returns dictionary of hideout productions */ protected getProductionsFromProfileAndFlagComplete(productions: Record): Record; + /** + * Required as continuous productions don't reset and stay at 100% completion but client thinks it hasn't started + * @param productions Productions in a profile + */ + protected cleanUpCompleteCraftsInProfile(productions: Record): void; } diff --git a/types/routers/HttpRouter.d.ts b/types/routers/HttpRouter.d.ts index f75a47d..875182d 100644 --- a/types/routers/HttpRouter.d.ts +++ b/types/routers/HttpRouter.d.ts @@ -1,6 +1,6 @@ /// -import { IncomingMessage } from "http"; -import { DynamicRouter, Router, StaticRouter } from "../di/Router"; +import { IncomingMessage } from "node:http"; +import { DynamicRouter, Router, StaticRouter } from "@spt-aki/di/Router"; export declare class HttpRouter { protected staticRouters: StaticRouter[]; protected dynamicRoutes: DynamicRouter[]; diff --git a/types/routers/ImageRouter.d.ts b/types/routers/ImageRouter.d.ts index 675441c..9d13b7a 100644 --- a/types/routers/ImageRouter.d.ts +++ b/types/routers/ImageRouter.d.ts @@ -1,8 +1,8 @@ /// -import { IncomingMessage, ServerResponse } from "http"; -import { ImageRouteService } from "../services/mod/image/ImageRouteService"; -import { HttpFileUtil } from "../utils/HttpFileUtil"; -import { VFS } from "../utils/VFS"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { ImageRouteService } from "@spt-aki/services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; diff --git a/types/routers/ItemEventRouter.d.ts b/types/routers/ItemEventRouter.d.ts index 9c7f70e..ef0a251 100644 --- a/types/routers/ItemEventRouter.d.ts +++ b/types/routers/ItemEventRouter.d.ts @@ -1,19 +1,20 @@ -import { ItemEventRouterDefinition } from "../di/Router"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { EventOutputHolder } from "./EventOutputHolder"; +import { ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "@spt-aki/models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ItemEventRouter { protected logger: ILogger; + protected jsonUtil: JsonUtil; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, jsonUtil: JsonUtil, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); /** - * * @param info Event request * @param sessionID Session id * @returns Item response diff --git a/types/routers/dynamic/BotDynamicRouter.d.ts b/types/routers/dynamic/BotDynamicRouter.d.ts index 6d0ab4b..5c54065 100644 --- a/types/routers/dynamic/BotDynamicRouter.d.ts +++ b/types/routers/dynamic/BotDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { BotCallbacks } from "../../callbacks/BotCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { BotCallbacks } from "@spt-aki/callbacks/BotCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class BotDynamicRouter extends DynamicRouter { protected botCallbacks: BotCallbacks; constructor(botCallbacks: BotCallbacks); diff --git a/types/routers/dynamic/BundleDynamicRouter.d.ts b/types/routers/dynamic/BundleDynamicRouter.d.ts index a765410..c73860a 100644 --- a/types/routers/dynamic/BundleDynamicRouter.d.ts +++ b/types/routers/dynamic/BundleDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { BundleCallbacks } from "../../callbacks/BundleCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { BundleCallbacks } from "@spt-aki/callbacks/BundleCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class BundleDynamicRouter extends DynamicRouter { protected bundleCallbacks: BundleCallbacks; constructor(bundleCallbacks: BundleCallbacks); diff --git a/types/routers/dynamic/CustomizationDynamicRouter.d.ts b/types/routers/dynamic/CustomizationDynamicRouter.d.ts index 2db7cc5..79e60e6 100644 --- a/types/routers/dynamic/CustomizationDynamicRouter.d.ts +++ b/types/routers/dynamic/CustomizationDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { CustomizationCallbacks } from "../../callbacks/CustomizationCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { CustomizationCallbacks } from "@spt-aki/callbacks/CustomizationCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class CustomizationDynamicRouter extends DynamicRouter { protected customizationCallbacks: CustomizationCallbacks; constructor(customizationCallbacks: CustomizationCallbacks); diff --git a/types/routers/dynamic/DataDynamicRouter.d.ts b/types/routers/dynamic/DataDynamicRouter.d.ts index 836ed8d..098748f 100644 --- a/types/routers/dynamic/DataDynamicRouter.d.ts +++ b/types/routers/dynamic/DataDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { DataCallbacks } from "../../callbacks/DataCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { DataCallbacks } from "@spt-aki/callbacks/DataCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class DataDynamicRouter extends DynamicRouter { protected dataCallbacks: DataCallbacks; constructor(dataCallbacks: DataCallbacks); diff --git a/types/routers/dynamic/HttpDynamicRouter.d.ts b/types/routers/dynamic/HttpDynamicRouter.d.ts index a152b4d..5fda392 100644 --- a/types/routers/dynamic/HttpDynamicRouter.d.ts +++ b/types/routers/dynamic/HttpDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { DynamicRouter } from "../../di/Router"; -import { ImageRouter } from "../ImageRouter"; +import { DynamicRouter } from "@spt-aki/di/Router"; +import { ImageRouter } from "@spt-aki/routers/ImageRouter"; export declare class HttpDynamicRouter extends DynamicRouter { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); diff --git a/types/routers/dynamic/InraidDynamicRouter.d.ts b/types/routers/dynamic/InraidDynamicRouter.d.ts index 7c0561f..b68282e 100644 --- a/types/routers/dynamic/InraidDynamicRouter.d.ts +++ b/types/routers/dynamic/InraidDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { InraidCallbacks } from "../../callbacks/InraidCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { InraidCallbacks } from "@spt-aki/callbacks/InraidCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class InraidDynamicRouter extends DynamicRouter { protected inraidCallbacks: InraidCallbacks; constructor(inraidCallbacks: InraidCallbacks); diff --git a/types/routers/dynamic/LocationDynamicRouter.d.ts b/types/routers/dynamic/LocationDynamicRouter.d.ts index b8e5cdf..aef354f 100644 --- a/types/routers/dynamic/LocationDynamicRouter.d.ts +++ b/types/routers/dynamic/LocationDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { LocationCallbacks } from "../../callbacks/LocationCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { LocationCallbacks } from "@spt-aki/callbacks/LocationCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class LocationDynamicRouter extends DynamicRouter { protected locationCallbacks: LocationCallbacks; constructor(locationCallbacks: LocationCallbacks); diff --git a/types/routers/dynamic/NotifierDynamicRouter.d.ts b/types/routers/dynamic/NotifierDynamicRouter.d.ts index 83c60c5..f1c0ea7 100644 --- a/types/routers/dynamic/NotifierDynamicRouter.d.ts +++ b/types/routers/dynamic/NotifierDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { NotifierCallbacks } from "../../callbacks/NotifierCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { NotifierCallbacks } from "@spt-aki/callbacks/NotifierCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class NotifierDynamicRouter extends DynamicRouter { protected notifierCallbacks: NotifierCallbacks; constructor(notifierCallbacks: NotifierCallbacks); diff --git a/types/routers/dynamic/TraderDynamicRouter.d.ts b/types/routers/dynamic/TraderDynamicRouter.d.ts index 5b7cc1b..2cde752 100644 --- a/types/routers/dynamic/TraderDynamicRouter.d.ts +++ b/types/routers/dynamic/TraderDynamicRouter.d.ts @@ -1,5 +1,5 @@ -import { TraderCallbacks } from "../../callbacks/TraderCallbacks"; -import { DynamicRouter } from "../../di/Router"; +import { TraderCallbacks } from "@spt-aki/callbacks/TraderCallbacks"; +import { DynamicRouter } from "@spt-aki/di/Router"; export declare class TraderDynamicRouter extends DynamicRouter { protected traderCallbacks: TraderCallbacks; constructor(traderCallbacks: TraderCallbacks); diff --git a/types/routers/item_events/CustomizationItemEventRouter.d.ts b/types/routers/item_events/CustomizationItemEventRouter.d.ts index 32519b1..473c8ed 100644 --- a/types/routers/item_events/CustomizationItemEventRouter.d.ts +++ b/types/routers/item_events/CustomizationItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { CustomizationCallbacks } from "../../callbacks/CustomizationCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { CustomizationCallbacks } from "@spt-aki/callbacks/CustomizationCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class CustomizationItemEventRouter extends ItemEventRouterDefinition { protected customizationCallbacks: CustomizationCallbacks; constructor(customizationCallbacks: CustomizationCallbacks); diff --git a/types/routers/item_events/HealthItemEventRouter.d.ts b/types/routers/item_events/HealthItemEventRouter.d.ts index 2b2b91d..5243153 100644 --- a/types/routers/item_events/HealthItemEventRouter.d.ts +++ b/types/routers/item_events/HealthItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { HealthCallbacks } from "../../callbacks/HealthCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { HealthCallbacks } from "@spt-aki/callbacks/HealthCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class HealthItemEventRouter extends ItemEventRouterDefinition { protected healthCallbacks: HealthCallbacks; constructor(healthCallbacks: HealthCallbacks); diff --git a/types/routers/item_events/HideoutItemEventRouter.d.ts b/types/routers/item_events/HideoutItemEventRouter.d.ts index 44bd1cd..14aeddc 100644 --- a/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,10 +1,10 @@ -import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { HideoutCallbacks } from "@spt-aki/callbacks/HideoutCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/types/routers/item_events/InsuranceItemEventRouter.d.ts b/types/routers/item_events/InsuranceItemEventRouter.d.ts index 3b6ae8c..f2c9ab6 100644 --- a/types/routers/item_events/InsuranceItemEventRouter.d.ts +++ b/types/routers/item_events/InsuranceItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { InsuranceCallbacks } from "../../callbacks/InsuranceCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { InsuranceCallbacks } from "@spt-aki/callbacks/InsuranceCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class InsuranceItemEventRouter extends ItemEventRouterDefinition { protected insuranceCallbacks: InsuranceCallbacks; constructor(insuranceCallbacks: InsuranceCallbacks); diff --git a/types/routers/item_events/InventoryItemEventRouter.d.ts b/types/routers/item_events/InventoryItemEventRouter.d.ts index d6a6ae5..22fddbf 100644 --- a/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,12 +1,12 @@ -import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; -import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { HideoutCallbacks } from "@spt-aki/callbacks/HideoutCallbacks"; +import { InventoryCallbacks } from "@spt-aki/callbacks/InventoryCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; protected hideoutCallbacks: HideoutCallbacks; constructor(inventoryCallbacks: InventoryCallbacks, hideoutCallbacks: HideoutCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; } diff --git a/types/routers/item_events/NoteItemEventRouter.d.ts b/types/routers/item_events/NoteItemEventRouter.d.ts index 71ed5d4..35907cc 100644 --- a/types/routers/item_events/NoteItemEventRouter.d.ts +++ b/types/routers/item_events/NoteItemEventRouter.d.ts @@ -1,10 +1,11 @@ -import { NoteCallbacks } from "../../callbacks/NoteCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { NoteCallbacks } from "@spt-aki/callbacks/NoteCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData"; export declare class NoteItemEventRouter extends ItemEventRouterDefinition { protected noteCallbacks: NoteCallbacks; constructor(noteCallbacks: NoteCallbacks); getHandledRoutes(): HandledRoute[]; - handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse; + handleItemEvent(url: string, pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/routers/item_events/QuestItemEventRouter.d.ts b/types/routers/item_events/QuestItemEventRouter.d.ts index a092aa6..32715e5 100644 --- a/types/routers/item_events/QuestItemEventRouter.d.ts +++ b/types/routers/item_events/QuestItemEventRouter.d.ts @@ -1,8 +1,8 @@ -import { QuestCallbacks } from "../../callbacks/QuestCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; -import { ILogger } from "../../models/spt/utils/ILogger"; +import { QuestCallbacks } from "@spt-aki/callbacks/QuestCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; export declare class QuestItemEventRouter extends ItemEventRouterDefinition { protected logger: ILogger; protected questCallbacks: QuestCallbacks; diff --git a/types/routers/item_events/RagfairItemEventRouter.d.ts b/types/routers/item_events/RagfairItemEventRouter.d.ts index 986d9e7..b8cf48c 100644 --- a/types/routers/item_events/RagfairItemEventRouter.d.ts +++ b/types/routers/item_events/RagfairItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { RagfairCallbacks } from "../../callbacks/RagfairCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { RagfairCallbacks } from "@spt-aki/callbacks/RagfairCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class RagfairItemEventRouter extends ItemEventRouterDefinition { protected ragfairCallbacks: RagfairCallbacks; constructor(ragfairCallbacks: RagfairCallbacks); diff --git a/types/routers/item_events/RepairItemEventRouter.d.ts b/types/routers/item_events/RepairItemEventRouter.d.ts index 1c2768c..282c47a 100644 --- a/types/routers/item_events/RepairItemEventRouter.d.ts +++ b/types/routers/item_events/RepairItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { RepairCallbacks } from "../../callbacks/RepairCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairCallbacks } from "@spt-aki/callbacks/RepairCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class RepairItemEventRouter extends ItemEventRouterDefinition { protected repairCallbacks: RepairCallbacks; constructor(repairCallbacks: RepairCallbacks); diff --git a/types/routers/item_events/TradeItemEventRouter.d.ts b/types/routers/item_events/TradeItemEventRouter.d.ts index 5d84559..1494963 100644 --- a/types/routers/item_events/TradeItemEventRouter.d.ts +++ b/types/routers/item_events/TradeItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { TradeCallbacks } from "../../callbacks/TradeCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { TradeCallbacks } from "@spt-aki/callbacks/TradeCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class TradeItemEventRouter extends ItemEventRouterDefinition { protected tradeCallbacks: TradeCallbacks; constructor(tradeCallbacks: TradeCallbacks); diff --git a/types/routers/item_events/WishlistItemEventRouter.d.ts b/types/routers/item_events/WishlistItemEventRouter.d.ts index 9e3c2a0..1d6f601 100644 --- a/types/routers/item_events/WishlistItemEventRouter.d.ts +++ b/types/routers/item_events/WishlistItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { WishlistCallbacks } from "../../callbacks/WishlistCallbacks"; -import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; +import { WishlistCallbacks } from "@spt-aki/callbacks/WishlistCallbacks"; +import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; export declare class WishlistItemEventRouter extends ItemEventRouterDefinition { protected wishlistCallbacks: WishlistCallbacks; constructor(wishlistCallbacks: WishlistCallbacks); diff --git a/types/routers/save_load/HealthSaveLoadRouter.d.ts b/types/routers/save_load/HealthSaveLoadRouter.d.ts index 26cb07a..1ecfa44 100644 --- a/types/routers/save_load/HealthSaveLoadRouter.d.ts +++ b/types/routers/save_load/HealthSaveLoadRouter.d.ts @@ -1,7 +1,6 @@ -import { HandledRoute, SaveLoadRouter } from "../../di/Router"; -import { IAkiProfile } from "../../models/eft/profile/IAkiProfile"; +import { HandledRoute, SaveLoadRouter } from "@spt-aki/di/Router"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export declare class HealthSaveLoadRouter extends SaveLoadRouter { - constructor(); getHandledRoutes(): HandledRoute[]; handleLoad(profile: IAkiProfile): IAkiProfile; } diff --git a/types/routers/save_load/InraidSaveLoadRouter.d.ts b/types/routers/save_load/InraidSaveLoadRouter.d.ts index 40f388e..7cc9a08 100644 --- a/types/routers/save_load/InraidSaveLoadRouter.d.ts +++ b/types/routers/save_load/InraidSaveLoadRouter.d.ts @@ -1,7 +1,6 @@ -import { HandledRoute, SaveLoadRouter } from "../../di/Router"; -import { IAkiProfile } from "../../models/eft/profile/IAkiProfile"; +import { HandledRoute, SaveLoadRouter } from "@spt-aki/di/Router"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export declare class InraidSaveLoadRouter extends SaveLoadRouter { - constructor(); getHandledRoutes(): HandledRoute[]; handleLoad(profile: IAkiProfile): IAkiProfile; } diff --git a/types/routers/save_load/InsuranceSaveLoadRouter.d.ts b/types/routers/save_load/InsuranceSaveLoadRouter.d.ts index 22d645e..af5222a 100644 --- a/types/routers/save_load/InsuranceSaveLoadRouter.d.ts +++ b/types/routers/save_load/InsuranceSaveLoadRouter.d.ts @@ -1,7 +1,6 @@ -import { HandledRoute, SaveLoadRouter } from "../../di/Router"; -import { IAkiProfile } from "../../models/eft/profile/IAkiProfile"; +import { HandledRoute, SaveLoadRouter } from "@spt-aki/di/Router"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export declare class InsuranceSaveLoadRouter extends SaveLoadRouter { - constructor(); getHandledRoutes(): HandledRoute[]; handleLoad(profile: IAkiProfile): IAkiProfile; } diff --git a/types/routers/save_load/ProfileSaveLoadRouter.d.ts b/types/routers/save_load/ProfileSaveLoadRouter.d.ts index f60af15..8047834 100644 --- a/types/routers/save_load/ProfileSaveLoadRouter.d.ts +++ b/types/routers/save_load/ProfileSaveLoadRouter.d.ts @@ -1,7 +1,6 @@ -import { HandledRoute, SaveLoadRouter } from "../../di/Router"; -import { IAkiProfile } from "../../models/eft/profile/IAkiProfile"; +import { HandledRoute, SaveLoadRouter } from "@spt-aki/di/Router"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; export declare class ProfileSaveLoadRouter extends SaveLoadRouter { - constructor(); getHandledRoutes(): HandledRoute[]; handleLoad(profile: IAkiProfile): IAkiProfile; } diff --git a/types/routers/serializers/BundleSerializer.d.ts b/types/routers/serializers/BundleSerializer.d.ts index ca4d8b6..52db030 100644 --- a/types/routers/serializers/BundleSerializer.d.ts +++ b/types/routers/serializers/BundleSerializer.d.ts @@ -1,9 +1,9 @@ /// -import { IncomingMessage, ServerResponse } from "http"; -import { Serializer } from "../../di/Serializer"; -import { BundleLoader } from "../../loaders/BundleLoader"; -import { ILogger } from "../../models/spt/utils/ILogger"; -import { HttpFileUtil } from "../../utils/HttpFileUtil"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { Serializer } from "@spt-aki/di/Serializer"; +import { BundleLoader } from "@spt-aki/loaders/BundleLoader"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; diff --git a/types/routers/serializers/ImageSerializer.d.ts b/types/routers/serializers/ImageSerializer.d.ts index 5de48ff..3b1ff6d 100644 --- a/types/routers/serializers/ImageSerializer.d.ts +++ b/types/routers/serializers/ImageSerializer.d.ts @@ -1,7 +1,7 @@ /// -import { IncomingMessage, ServerResponse } from "http"; -import { Serializer } from "../../di/Serializer"; -import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { Serializer } from "@spt-aki/di/Serializer"; +import { ImageRouter } from "@spt-aki/routers/ImageRouter"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); diff --git a/types/routers/serializers/NotifySerializer.d.ts b/types/routers/serializers/NotifySerializer.d.ts index 1d179b2..f8730b6 100644 --- a/types/routers/serializers/NotifySerializer.d.ts +++ b/types/routers/serializers/NotifySerializer.d.ts @@ -1,9 +1,9 @@ /// -import { IncomingMessage, ServerResponse } from "http"; -import { NotifierController } from "../../controllers/NotifierController"; -import { Serializer } from "../../di/Serializer"; -import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { JsonUtil } from "../../utils/JsonUtil"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { NotifierController } from "@spt-aki/controllers/NotifierController"; +import { Serializer } from "@spt-aki/di/Serializer"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected jsonUtil: JsonUtil; diff --git a/types/routers/static/AchievementStaticRouter.d.ts b/types/routers/static/AchievementStaticRouter.d.ts new file mode 100644 index 0000000..80c5e71 --- /dev/null +++ b/types/routers/static/AchievementStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class AchievementStaticRouter extends StaticRouter { + protected achievementCallbacks: AchievementCallbacks; + constructor(achievementCallbacks: AchievementCallbacks); +} diff --git a/types/routers/static/BotStaticRouter.d.ts b/types/routers/static/BotStaticRouter.d.ts index aeea220..e7e9ff5 100644 --- a/types/routers/static/BotStaticRouter.d.ts +++ b/types/routers/static/BotStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { BotCallbacks } from "../../callbacks/BotCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { BotCallbacks } from "@spt-aki/callbacks/BotCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class BotStaticRouter extends StaticRouter { protected botCallbacks: BotCallbacks; constructor(botCallbacks: BotCallbacks); diff --git a/types/routers/static/BuildStaticRouter.d.ts b/types/routers/static/BuildStaticRouter.d.ts new file mode 100644 index 0000000..e351d19 --- /dev/null +++ b/types/routers/static/BuildStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class BuildsStaticRouter extends StaticRouter { + protected buildsCallbacks: BuildsCallbacks; + constructor(buildsCallbacks: BuildsCallbacks); +} diff --git a/types/routers/static/BundleStaticRouter.d.ts b/types/routers/static/BundleStaticRouter.d.ts index fb682fc..62056ba 100644 --- a/types/routers/static/BundleStaticRouter.d.ts +++ b/types/routers/static/BundleStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { BundleCallbacks } from "../../callbacks/BundleCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { BundleCallbacks } from "@spt-aki/callbacks/BundleCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class BundleStaticRouter extends StaticRouter { protected bundleCallbacks: BundleCallbacks; constructor(bundleCallbacks: BundleCallbacks); diff --git a/types/routers/static/ClientLogStaticRouter.d.ts b/types/routers/static/ClientLogStaticRouter.d.ts new file mode 100644 index 0000000..6ae3f50 --- /dev/null +++ b/types/routers/static/ClientLogStaticRouter.d.ts @@ -0,0 +1,6 @@ +import { ClientLogCallbacks } from "@spt-aki/callbacks/ClientLogCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; +export declare class ClientLogStaticRouter extends StaticRouter { + protected clientLogCallbacks: ClientLogCallbacks; + constructor(clientLogCallbacks: ClientLogCallbacks); +} diff --git a/types/routers/static/CustomizationStaticRouter.d.ts b/types/routers/static/CustomizationStaticRouter.d.ts index 21bc4bb..cebf043 100644 --- a/types/routers/static/CustomizationStaticRouter.d.ts +++ b/types/routers/static/CustomizationStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { CustomizationCallbacks } from "../../callbacks/CustomizationCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { CustomizationCallbacks } from "@spt-aki/callbacks/CustomizationCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class CustomizationStaticRouter extends StaticRouter { protected customizationCallbacks: CustomizationCallbacks; constructor(customizationCallbacks: CustomizationCallbacks); diff --git a/types/routers/static/DataStaticRouter.d.ts b/types/routers/static/DataStaticRouter.d.ts index 84ba7fd..7e84ae1 100644 --- a/types/routers/static/DataStaticRouter.d.ts +++ b/types/routers/static/DataStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { DataCallbacks } from "../../callbacks/DataCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { DataCallbacks } from "@spt-aki/callbacks/DataCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class DataStaticRouter extends StaticRouter { protected dataCallbacks: DataCallbacks; constructor(dataCallbacks: DataCallbacks); diff --git a/types/routers/static/DialogStaticRouter.d.ts b/types/routers/static/DialogStaticRouter.d.ts index 546cdf1..7f3ef7a 100644 --- a/types/routers/static/DialogStaticRouter.d.ts +++ b/types/routers/static/DialogStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { DialogueCallbacks } from "../../callbacks/DialogueCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { DialogueCallbacks } from "@spt-aki/callbacks/DialogueCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class DialogStaticRouter extends StaticRouter { protected dialogueCallbacks: DialogueCallbacks; constructor(dialogueCallbacks: DialogueCallbacks); diff --git a/types/routers/static/GameStaticRouter.d.ts b/types/routers/static/GameStaticRouter.d.ts index a9a7496..878f494 100644 --- a/types/routers/static/GameStaticRouter.d.ts +++ b/types/routers/static/GameStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { GameCallbacks } from "../../callbacks/GameCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { GameCallbacks } from "@spt-aki/callbacks/GameCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class GameStaticRouter extends StaticRouter { protected gameCallbacks: GameCallbacks; constructor(gameCallbacks: GameCallbacks); diff --git a/types/routers/static/HealthStaticRouter.d.ts b/types/routers/static/HealthStaticRouter.d.ts index 863fd5e..79dedea 100644 --- a/types/routers/static/HealthStaticRouter.d.ts +++ b/types/routers/static/HealthStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { HealthCallbacks } from "../../callbacks/HealthCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { HealthCallbacks } from "@spt-aki/callbacks/HealthCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class HealthStaticRouter extends StaticRouter { protected healthCallbacks: HealthCallbacks; constructor(healthCallbacks: HealthCallbacks); diff --git a/types/routers/static/InraidStaticRouter.d.ts b/types/routers/static/InraidStaticRouter.d.ts index b29ad23..eb9c3b1 100644 --- a/types/routers/static/InraidStaticRouter.d.ts +++ b/types/routers/static/InraidStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { InraidCallbacks } from "../../callbacks/InraidCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { InraidCallbacks } from "@spt-aki/callbacks/InraidCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class InraidStaticRouter extends StaticRouter { protected inraidCallbacks: InraidCallbacks; constructor(inraidCallbacks: InraidCallbacks); diff --git a/types/routers/static/InsuranceStaticRouter.d.ts b/types/routers/static/InsuranceStaticRouter.d.ts index 5676499..58c1583 100644 --- a/types/routers/static/InsuranceStaticRouter.d.ts +++ b/types/routers/static/InsuranceStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { InsuranceCallbacks } from "../../callbacks/InsuranceCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { InsuranceCallbacks } from "@spt-aki/callbacks/InsuranceCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class InsuranceStaticRouter extends StaticRouter { protected insuranceCallbacks: InsuranceCallbacks; constructor(insuranceCallbacks: InsuranceCallbacks); diff --git a/types/routers/static/ItemEventStaticRouter.d.ts b/types/routers/static/ItemEventStaticRouter.d.ts index c30a7fc..772493a 100644 --- a/types/routers/static/ItemEventStaticRouter.d.ts +++ b/types/routers/static/ItemEventStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { ItemEventCallbacks } from "../../callbacks/ItemEventCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { ItemEventCallbacks } from "@spt-aki/callbacks/ItemEventCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class ItemEventStaticRouter extends StaticRouter { protected itemEventCallbacks: ItemEventCallbacks; constructor(itemEventCallbacks: ItemEventCallbacks); diff --git a/types/routers/static/LauncherStaticRouter.d.ts b/types/routers/static/LauncherStaticRouter.d.ts index 0040cbd..46a5bd6 100644 --- a/types/routers/static/LauncherStaticRouter.d.ts +++ b/types/routers/static/LauncherStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { LauncherCallbacks } from "../../callbacks/LauncherCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { LauncherCallbacks } from "@spt-aki/callbacks/LauncherCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class LauncherStaticRouter extends StaticRouter { protected launcherCallbacks: LauncherCallbacks; constructor(launcherCallbacks: LauncherCallbacks); diff --git a/types/routers/static/LocationStaticRouter.d.ts b/types/routers/static/LocationStaticRouter.d.ts index b6de956..f577ba9 100644 --- a/types/routers/static/LocationStaticRouter.d.ts +++ b/types/routers/static/LocationStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { LocationCallbacks } from "../../callbacks/LocationCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { LocationCallbacks } from "@spt-aki/callbacks/LocationCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class LocationStaticRouter extends StaticRouter { protected locationCallbacks: LocationCallbacks; constructor(locationCallbacks: LocationCallbacks); diff --git a/types/routers/static/MatchStaticRouter.d.ts b/types/routers/static/MatchStaticRouter.d.ts index 9920a92..e26c8bd 100644 --- a/types/routers/static/MatchStaticRouter.d.ts +++ b/types/routers/static/MatchStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { MatchCallbacks } from "../../callbacks/MatchCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { MatchCallbacks } from "@spt-aki/callbacks/MatchCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class MatchStaticRouter extends StaticRouter { protected matchCallbacks: MatchCallbacks; constructor(matchCallbacks: MatchCallbacks); diff --git a/types/routers/static/NotifierStaticRouter.d.ts b/types/routers/static/NotifierStaticRouter.d.ts index 8f1f5cc..9427d00 100644 --- a/types/routers/static/NotifierStaticRouter.d.ts +++ b/types/routers/static/NotifierStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { NotifierCallbacks } from "../../callbacks/NotifierCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { NotifierCallbacks } from "@spt-aki/callbacks/NotifierCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class NotifierStaticRouter extends StaticRouter { protected notifierCallbacks: NotifierCallbacks; constructor(notifierCallbacks: NotifierCallbacks); diff --git a/types/routers/static/ProfileStaticRouter.d.ts b/types/routers/static/ProfileStaticRouter.d.ts index 83403f2..31470f3 100644 --- a/types/routers/static/ProfileStaticRouter.d.ts +++ b/types/routers/static/ProfileStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { ProfileCallbacks } from "../../callbacks/ProfileCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { ProfileCallbacks } from "@spt-aki/callbacks/ProfileCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class ProfileStaticRouter extends StaticRouter { protected profileCallbacks: ProfileCallbacks; constructor(profileCallbacks: ProfileCallbacks); diff --git a/types/routers/static/QuestStaticRouter.d.ts b/types/routers/static/QuestStaticRouter.d.ts index 8f7ca0a..a505e5c 100644 --- a/types/routers/static/QuestStaticRouter.d.ts +++ b/types/routers/static/QuestStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { QuestCallbacks } from "../../callbacks/QuestCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { QuestCallbacks } from "@spt-aki/callbacks/QuestCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class QuestStaticRouter extends StaticRouter { protected questCallbacks: QuestCallbacks; constructor(questCallbacks: QuestCallbacks); diff --git a/types/routers/static/RagfairStaticRouter.d.ts b/types/routers/static/RagfairStaticRouter.d.ts index 6c41467..e56a9c1 100644 --- a/types/routers/static/RagfairStaticRouter.d.ts +++ b/types/routers/static/RagfairStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { RagfairCallbacks } from "../../callbacks/RagfairCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { RagfairCallbacks } from "@spt-aki/callbacks/RagfairCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class RagfairStaticRouter extends StaticRouter { protected ragfairCallbacks: RagfairCallbacks; constructor(ragfairCallbacks: RagfairCallbacks); diff --git a/types/routers/static/TraderStaticRouter.d.ts b/types/routers/static/TraderStaticRouter.d.ts index 41728a1..1b9cbd1 100644 --- a/types/routers/static/TraderStaticRouter.d.ts +++ b/types/routers/static/TraderStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { TraderCallbacks } from "../../callbacks/TraderCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { TraderCallbacks } from "@spt-aki/callbacks/TraderCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class TraderStaticRouter extends StaticRouter { protected traderCallbacks: TraderCallbacks; constructor(traderCallbacks: TraderCallbacks); diff --git a/types/routers/static/WeatherStaticRouter.d.ts b/types/routers/static/WeatherStaticRouter.d.ts index 72ed851..499f911 100644 --- a/types/routers/static/WeatherStaticRouter.d.ts +++ b/types/routers/static/WeatherStaticRouter.d.ts @@ -1,5 +1,5 @@ -import { WeatherCallbacks } from "../../callbacks/WeatherCallbacks"; -import { StaticRouter } from "../../di/Router"; +import { WeatherCallbacks } from "@spt-aki/callbacks/WeatherCallbacks"; +import { StaticRouter } from "@spt-aki/di/Router"; export declare class WeatherStaticRouter extends StaticRouter { protected weatherCallbacks: WeatherCallbacks; constructor(weatherCallbacks: WeatherCallbacks); diff --git a/types/servers/ConfigServer.d.ts b/types/servers/ConfigServer.d.ts index f01be24..c932dfe 100644 --- a/types/servers/ConfigServer.d.ts +++ b/types/servers/ConfigServer.d.ts @@ -1,7 +1,7 @@ -import { JsonUtil } from "../utils/JsonUtil"; -import { VFS } from "../utils/VFS"; -import { ConfigTypes } from "../models/enums/ConfigTypes"; -import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class ConfigServer { protected logger: ILogger; protected vfs: VFS; diff --git a/types/servers/DatabaseServer.d.ts b/types/servers/DatabaseServer.d.ts index b3d29e9..fc69a61 100644 --- a/types/servers/DatabaseServer.d.ts +++ b/types/servers/DatabaseServer.d.ts @@ -1,4 +1,4 @@ -import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; +import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; diff --git a/types/servers/HttpServer.d.ts b/types/servers/HttpServer.d.ts index 97e0705..8574cdd 100644 --- a/types/servers/HttpServer.d.ts +++ b/types/servers/HttpServer.d.ts @@ -1,14 +1,14 @@ /// -import http, { IncomingMessage, ServerResponse } from "http"; -import { ApplicationContext } from "../context/ApplicationContext"; -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { ConfigServer } from "./ConfigServer"; -import { DatabaseServer } from "./DatabaseServer"; -import { IHttpListener } from "./http/IHttpListener"; -import { WebSocketServer } from "./WebSocketServer"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { WebSocketServer } from "@spt-aki/servers/WebSocketServer"; +import { IHttpListener } from "@spt-aki/servers/http/IHttpListener"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -25,5 +25,5 @@ export declare class HttpServer { */ load(): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; - protected getCookies(req: http.IncomingMessage): Record; + protected getCookies(req: IncomingMessage): Record; } diff --git a/types/servers/RagfairServer.d.ts b/types/servers/RagfairServer.d.ts index f49654a..f6f9730 100644 --- a/types/servers/RagfairServer.d.ts +++ b/types/servers/RagfairServer.d.ts @@ -1,14 +1,15 @@ -import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; -import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; -import { RagfairOfferService } from "../services/RagfairOfferService"; -import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; -import { ConfigServer } from "./ConfigServer"; +import { RagfairOfferGenerator } from "@spt-aki/generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RagfairCategoriesService } from "@spt-aki/services/RagfairCategoriesService"; +import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService"; +import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService"; export declare class RagfairServer { protected logger: ILogger; protected ragfairOfferGenerator: RagfairOfferGenerator; @@ -27,9 +28,8 @@ export declare class RagfairServer { * Get traders who need to be periodically refreshed * @returns string array of traders */ - protected getUpdateableTraders(): string[]; - getAllCategories(): Record; - getBespokeCategories(offers: IRagfairOffer[]): Record; + getUpdateableTraders(): string[]; + getAllActiveCategories(fleaUnlocked: boolean, searchRequestData: ISearchRequestData, offers: IRagfairOffer[]): Record; /** * Disable/Hide an offer from flea * @param offerId diff --git a/types/servers/SaveServer.d.ts b/types/servers/SaveServer.d.ts index 402befc..d61259b 100644 --- a/types/servers/SaveServer.d.ts +++ b/types/servers/SaveServer.d.ts @@ -1,10 +1,11 @@ -import { SaveLoadRouter } from "../di/Router"; -import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { VFS } from "../utils/VFS"; +import { SaveLoadRouter } from "@spt-aki/di/Router"; +import { IAkiProfile, Info } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +import { ConfigServer } from "./ConfigServer"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; @@ -12,11 +13,12 @@ export declare class SaveServer { protected hashUtil: HashUtil; protected localisationService: LocalisationService; protected logger: ILogger; + protected configServer: ConfigServer; protected profileFilepath: string; protected profiles: {}; protected onBeforeSaveCallbacks: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger, configServer: ConfigServer); /** * Add callback to occur prior to saving profile changes * @param id Id for save callback @@ -73,8 +75,9 @@ export declare class SaveServer { * Save changes from in-memory profile to user/profiles json * Execute onBeforeSaveCallbacks callbacks prior to being saved to json * @param sessionID profile id (user/profiles/id.json) + * @returns time taken to save in MS */ - saveProfile(sessionID: string): void; + saveProfile(sessionID: string): number; /** * Remove a physical profile json from user/profiles * @param sessionID Profile id to remove diff --git a/types/servers/WebSocketServer.d.ts b/types/servers/WebSocketServer.d.ts index fffbea2..3fe89af 100644 --- a/types/servers/WebSocketServer.d.ts +++ b/types/servers/WebSocketServer.d.ts @@ -1,14 +1,15 @@ /// -import http, { IncomingMessage } from "http"; +import http, { IncomingMessage } from "node:http"; import WebSocket from "ws"; -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { ConfigServer } from "./ConfigServer"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -16,7 +17,8 @@ export declare class WebSocketServer { protected localisationService: LocalisationService; protected jsonUtil: JsonUtil; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, jsonUtil: JsonUtil, httpServerHelper: HttpServerHelper); + protected profileHelper: ProfileHelper; + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, jsonUtil: JsonUtil, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/types/servers/http/AkiHttpListener.d.ts b/types/servers/http/AkiHttpListener.d.ts index c72e18f..9499884 100644 --- a/types/servers/http/AkiHttpListener.d.ts +++ b/types/servers/http/AkiHttpListener.d.ts @@ -1,14 +1,13 @@ /// /// -import { IncomingMessage, ServerResponse } from "http"; -import { Serializer } from "../../di/Serializer"; -import { ILogger } from "../../models/spt/utils/ILogger"; -import { HttpRouter } from "../../routers/HttpRouter"; -import { LocalisationService } from "../../services/LocalisationService"; -import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; -import { JsonUtil } from "../../utils/JsonUtil"; -import { HttpBufferHandler } from "./HttpBufferHandler"; -import { IHttpListener } from "./IHttpListener"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { Serializer } from "@spt-aki/di/Serializer"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HttpRouter } from "@spt-aki/routers/HttpRouter"; +import { IHttpListener } from "@spt-aki/servers/http/IHttpListener"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; @@ -17,11 +16,18 @@ export declare class AkiHttpListener implements IHttpListener { protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; - protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, requestsLogger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, requestsLogger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + /** + * Send http response to the client + * @param sessionID Player id + * @param req Incoming request + * @param resp Outgoing response + * @param body Buffer + * @param output Server generated response data + */ sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; protected getBodyInfo(body: Buffer, requestUrl?: any): any; diff --git a/types/servers/http/IHttpListener.d.ts b/types/servers/http/IHttpListener.d.ts index 758bb5a..29d5fce 100644 --- a/types/servers/http/IHttpListener.d.ts +++ b/types/servers/http/IHttpListener.d.ts @@ -1,5 +1,5 @@ /// -import { IncomingMessage, ServerResponse } from "http"; +import { IncomingMessage, ServerResponse } from "node:http"; export interface IHttpListener { canHandle(sessionId: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; diff --git a/types/services/BotEquipmentFilterService.d.ts b/types/services/BotEquipmentFilterService.d.ts index d50c52d..c66607f 100644 --- a/types/services/BotEquipmentFilterService.d.ts +++ b/types/services/BotEquipmentFilterService.d.ts @@ -1,10 +1,10 @@ -import { BotHelper } from "../helpers/BotHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; -import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; -import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { EquipmentChances, Generation, GenerationData, IBotType, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; +import { EquipmentFilterDetails, EquipmentFilters, IAdjustmentDetails, IBotConfig, WeightingAdjustmentDetails } from "@spt-aki/models/spt/config/IBotConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected botHelper: BotHelper; @@ -95,5 +95,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; + protected adjustWeighting(weightingAdjustments: IAdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/types/services/BotEquipmentModPoolService.d.ts b/types/services/BotEquipmentModPoolService.d.ts index b81ff01..8cca127 100644 --- a/types/services/BotEquipmentModPoolService.d.ts +++ b/types/services/BotEquipmentModPoolService.d.ts @@ -1,12 +1,12 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { Mods } from "../models/eft/common/tables/IBotType"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { VFS } from "../utils/VFS"; -import { LocalisationService } from "./LocalisationService"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Mods } from "@spt-aki/models/eft/common/tables/IBotType"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { VFS } from "@spt-aki/utils/VFS"; /** Store a mapping between weapons, their slots and the items that fit those slots */ export declare class BotEquipmentModPoolService { protected logger: ILogger; diff --git a/types/services/BotGenerationCacheService.d.ts b/types/services/BotGenerationCacheService.d.ts index 65b3ae0..e2c0a35 100644 --- a/types/services/BotGenerationCacheService.d.ts +++ b/types/services/BotGenerationCacheService.d.ts @@ -1,9 +1,9 @@ -import { BotHelper } from "../helpers/BotHelper"; -import { IBotBase } from "../models/eft/common/tables/IBotBase"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { LocalisationService } from "./LocalisationService"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -11,6 +11,7 @@ export declare class BotGenerationCacheService { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; + protected activeBotsInRaid: IBotBase[]; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage @@ -24,6 +25,18 @@ export declare class BotGenerationCacheService { * @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 */ diff --git a/types/services/BotLootCacheService.d.ts b/types/services/BotLootCacheService.d.ts index 5c1560c..b013e5e 100644 --- a/types/services/BotLootCacheService.d.ts +++ b/types/services/BotLootCacheService.d.ts @@ -1,13 +1,13 @@ -import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { LocalisationService } from "./LocalisationService"; -import { RagfairPriceService } from "./RagfairPriceService"; +import { PMCLootGenerator } from "@spt-aki/generators/PMCLootGenerator"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; +import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBotLootCache, LootCacheType } from "@spt-aki/models/spt/bots/IBotLootCache"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -30,7 +30,7 @@ export declare class BotLootCacheService { * @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): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): Record; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) @@ -38,17 +38,13 @@ export declare class BotLootCacheService { * @param botJsonTemplate db template for bot having its loot generated */ protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; - /** - * Sort a pool of item objects by its flea price - * @param poolToSort pool of items to sort - */ - protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; /** * Add unique items into combined pool - * @param combinedItemPool Pool of items to add to + * @param poolToAddTo Pool of items to add to * @param itemsToAdd items to add to combined pool if unique */ - protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addUniqueItemsToPool(poolToAddTo: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; + protected addItemsToPool(poolToAddTo: Record, poolOfItemsToAdd: Record): void; /** * Ammo/grenades have this property * @param props diff --git a/types/services/BotWeaponModLimitService.d.ts b/types/services/BotWeaponModLimitService.d.ts index f8ebc2f..cf530a9 100644 --- a/types/services/BotWeaponModLimitService.d.ts +++ b/types/services/BotWeaponModLimitService.d.ts @@ -1,9 +1,9 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; export declare class BotModLimits { scope: ItemCount; scopeMax: number; diff --git a/types/services/CustomLocationWaveService.d.ts b/types/services/CustomLocationWaveService.d.ts index 7d14f07..f32c082 100644 --- a/types/services/CustomLocationWaveService.d.ts +++ b/types/services/CustomLocationWaveService.d.ts @@ -1,10 +1,10 @@ -import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; -import { ILocationConfig } from "../models/spt/config/ILocationConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; +import { BossLocationSpawn, Wave } from "@spt-aki/models/eft/common/ILocationBase"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class CustomLocationWaveService { protected logger: ILogger; protected randomUtil: RandomUtil; diff --git a/types/services/FenceService.d.ts b/types/services/FenceService.d.ts index dfd8820..bb1d035 100644 --- a/types/services/FenceService.d.ts +++ b/types/services/FenceService.d.ts @@ -1,28 +1,26 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { IFenceLevel, IPreset } from "../models/eft/common/IGlobals"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { ItemFilterService } from "./ItemFilterService"; -import { LocalisationService } from "./LocalisationService"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { IFenceLevel } from "@spt-aki/models/eft/common/IGlobals"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IBarterScheme, ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IItemDurabilityCurrentMax, ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IFenceAssortGenerationValues, IGenerationAssortValues } from "@spt-aki/models/spt/fence/IFenceAssortGenerationValues"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time */ export declare class FenceService { protected logger: ILogger; - protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; @@ -30,16 +28,18 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; - protected itemFilterService: ItemFilterService; protected localisationService: LocalisationService; protected configServer: ConfigServer; + 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 separte tab when you max out fence rep */ + /** Assorts shown on a separate tab when you max out fence rep */ protected fenceDiscountAssort: ITraderAssort; - protected traderConfig: ITraderConfig; - protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); + /** Hydrated on initial assort generation as part of generateFenceAssorts() */ + protected desiredAssortCounts: IFenceAssortGenerationValues; + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Replace main fence assort with new assort * @param assort New assorts to replace old with @@ -47,9 +47,9 @@ export declare class FenceService { setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort - * @param assort New assorts to replace old with + * @param discountAssort New assorts to replace old with */ - setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(discountAssort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -59,11 +59,11 @@ export declare class FenceService { getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; /** * Adjust all items contained inside an assort by a multiplier - * @param assort Assort that contains items with prices to adjust + * @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 adjustAssortItemPrices(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; + protected adjustAssortItemPricesByConfigMultiplier(assort: ITraderAssort, itemMultipler: number, presetMultiplier: number): void; /** * Merge two trader assort files together * @param firstAssort assort 1# @@ -103,12 +103,19 @@ export declare class FenceService { * @param existingItemCountToReplace count of items to generate * @returns number of items to generate */ - protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + protected getCountOfItemsToGenerate(): IFenceAssortGenerationValues; /** - * Choose an item (not mod) at random and remove from assorts - * @param assort Items to remove from + * Delete desired number of items from assort (including children) + * @param itemCountToReplace + * @param discountItemCountToReplace */ - protected removeRandomItemFromAssorts(assort: ITraderAssort): void; + protected deleteRandomAssorts(itemCountToReplace: number, assort: ITraderAssort): void; + /** + * Choose an item at random and remove it + mods from assorts + * @param assort Items to remove from + * @param rootItems Assort 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 @@ -122,42 +129,92 @@ export declare class FenceService { getOfferCount(): number; /** * Create trader assorts for fence and store in fenceService cache + * Uses fence base cache generatedon server start as a base */ generateFenceAssorts(): void; + /** + * 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 createBaseTraderAssortItem(): ITraderAssort; + 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(assortCount: number, assorts: ITraderAssort, loyaltyLevel: number): void; - protected addItemAssorts(assortCount: number, fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, itemTypeCounts: Record, loyaltyLevel: number): void; /** - * Get stack size ofr a singular item (no mods) + * 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 fenceItemAssorts Items to search through + * @returns Matching assort item + */ + protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item; + /** + * 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; + /** + * 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, itemRoot: Item, itemTemplate: ITemplateItem): void; + protected getMatchingItemLimit(itemTypeLimits: Record, itemTpl: string): { + current: number; + max: number; + }; + /** + * 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: ITraderAssort, 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; + /** + * Get stack size of a singular item (no mods) * @param itemDbDetails item being added to fence * @returns Stack size */ protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; - /** - * Add preset weapons to fence presets - * @param assortCount how many assorts to add to assorts - * @param defaultWeaponPresets a dictionary of default weapon presets - * @param assorts object to add presets to - * @param loyaltyLevel loyalty level to requre item at - */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; /** * Remove parts of a weapon prior to being listed on flea - * @param weaponAndMods Weapon to remove parts from + * @param itemAndMods Weapon to remove parts from */ - protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + protected removeRandomModsOfItem(itemAndMods: Item[]): void; /** * Roll % chance check to see if item should be removed * @param weaponMod Weapon mod being checked @@ -171,6 +228,13 @@ export declare class FenceService { * @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 @@ -187,6 +251,7 @@ export declare class FenceService { getNextFenceUpdateTimestamp(): number; /** * Get fence refresh time in seconds + * @returns Refresh time in seconds */ protected getFenceRefreshTime(): number; /** @@ -196,8 +261,10 @@ export declare class FenceService { */ getFenceInfo(pmcData: IPmcData): IFenceLevel; /** - * Remove an assort from fence by id - * @param assortIdToRemove assort id to remove from fence assorts + * Remove or lower stack size of an assort from fence by id + * @param assortId assort id to adjust + * @param buyCount Count of items bought */ - removeFenceOffer(assortIdToRemove: string): void; + amendOrRemoveFenceOffer(assortId: string, buyCount: number): void; + protected deleteOffer(assortId: string, assorts: Item[]): void; } diff --git a/types/services/GiftService.d.ts b/types/services/GiftService.d.ts index 163635e..2dbf09a 100644 --- a/types/services/GiftService.d.ts +++ b/types/services/GiftService.d.ts @@ -1,12 +1,12 @@ -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { GiftSentResult } from "../models/enums/GiftSentResult"; -import { MessageType } from "../models/enums/MessageType"; -import { Gift, IGiftsConfig } from "../models/spt/config/IGiftsConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { HashUtil } from "../utils/HashUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { MailSendService } from "./MailSendService"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { GiftSentResult } from "@spt-aki/models/enums/GiftSentResult"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Gift, IGiftsConfig } from "@spt-aki/models/spt/config/IGiftsConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class GiftService { protected logger: ILogger; protected mailSendService: MailSendService; diff --git a/types/services/HashCacheService.d.ts b/types/services/HashCacheService.d.ts index 9968478..0097c96 100644 --- a/types/services/HashCacheService.d.ts +++ b/types/services/HashCacheService.d.ts @@ -1,7 +1,7 @@ -import { ILogger } from "../models/spt/utils/ILogger"; -import { HashUtil } from "../utils/HashUtil"; -import { JsonUtil } from "../utils/JsonUtil"; -import { VFS } from "../utils/VFS"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class HashCacheService { protected vfs: VFS; protected hashUtil: HashUtil; diff --git a/types/services/InsuranceService.d.ts b/types/services/InsuranceService.d.ts index 69bf0e4..7148969 100644 --- a/types/services/InsuranceService.d.ts +++ b/types/services/InsuranceService.d.ts @@ -1,30 +1,34 @@ -import { ITraderBase } from "../models/eft/common/tables/ITrader"; -import { DialogueHelper } from "../helpers/DialogueHelper"; -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData"; -import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { LocaleService } from "./LocaleService"; -import { LocalisationService } from "./LocalisationService"; -import { MailSendService } from "./MailSendService"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { SecureContainerHelper } from "@spt-aki/helpers/SecureContainerHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IInsuredItemsData } from "@spt-aki/models/eft/inRaid/IInsuredItemsData"; +import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData"; +import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig"; +import { ILostOnDeathConfig } from "@spt-aki/models/spt/config/ILostOnDeathConfig"; +import { IInsuranceEquipmentPkg } from "@spt-aki/models/spt/services/IInsuranceEquipmentPkg"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MailSendService } from "@spt-aki/services/MailSendService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; @@ -37,7 +41,8 @@ export declare class InsuranceService { protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + protected lostOnDeathConfig: ILostOnDeathConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); /** * Does player have insurance array * @param sessionId Player id @@ -65,12 +70,6 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; - /** - * Send a message to player informing them gear was lost - * @param sessionId Session id - * @param locationName name of map insurance was lost on - */ - sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -86,21 +85,41 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it - * @param pmcData player profile to store gear in - * @param offraidData post-raid request object - * @param preRaidGear gear player wore prior to raid + * 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 the player die in raid + * @param playerDied Did player die in raid + * @returns Array of insured items lost in raid */ - storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + 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 insuredItem Insured items properties - * @param preRaidItem Insured item as it was pre-raid - * @param insuredItemFromClient Item data when player left raid (durability values) - * @returns Item object + * @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; /** @@ -109,12 +128,6 @@ export declare class InsuranceService { * @param itemToReturn item we will send to player as insurance return */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; - /** - * Create a hash table for an array of items, keyed by items _id - * @param items Items to hash - * @returns Hashtable - */ - protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile * @param sessionID Session id @@ -122,12 +135,7 @@ export declare class InsuranceService { * @param itemToReturnToPlayer item to store * @param traderId Id of trader item was insured with */ - protected addGearToSend(gear: { - sessionID: string; - pmcData: IPmcData; - itemToReturnToPlayer: Item; - traderId: string; - }): void; + protected addGearToSend(gear: IInsuranceEquipmentPkg): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) @@ -145,7 +153,7 @@ export declare class InsuranceService { * Store insured item * @param sessionId Player id (session id) * @param traderId Trader item insured with - * @param itemToAdd Insured item + * @param itemToAdd Insured item (with children) */ addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; /** @@ -156,4 +164,10 @@ export declare class InsuranceService { * @returns price in roubles */ getPremium(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. + * + * @returns The ID. + */ + getRootItemParentID(sessionID: string): string; } diff --git a/types/services/ItemBaseClassService.d.ts b/types/services/ItemBaseClassService.d.ts index 43fe451..83994ad 100644 --- a/types/services/ItemBaseClassService.d.ts +++ b/types/services/ItemBaseClassService.d.ts @@ -1,7 +1,7 @@ -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "./LocalisationService"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; /** * Cache the baseids for each item in the tiems db inside a dictionary */ diff --git a/types/services/ItemFilterService.d.ts b/types/services/ItemFilterService.d.ts index b830d74..dea17d7 100644 --- a/types/services/ItemFilterService.d.ts +++ b/types/services/ItemFilterService.d.ts @@ -1,13 +1,12 @@ -import { IItemConfig } from "../models/spt/config/IItemConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; /** 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 databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -16,9 +15,31 @@ export declare class ItemFilterService { * @returns true if blacklisted */ isItemBlacklisted(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[]; + /** + * 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[]; } diff --git a/types/services/LocaleService.d.ts b/types/services/LocaleService.d.ts index 09c658b..023e61d 100644 --- a/types/services/LocaleService.d.ts +++ b/types/services/LocaleService.d.ts @@ -1,7 +1,7 @@ -import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; +import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; /** * Handles getting locales from config or users machine */ @@ -33,9 +33,21 @@ export declare class LocaleService { * @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 getPlatformLocale(): string; + protected getPlatformForClientLocale(): string; } diff --git a/types/services/LocalisationService.d.ts b/types/services/LocalisationService.d.ts index ec6eecf..c12e465 100644 --- a/types/services/LocalisationService.d.ts +++ b/types/services/LocalisationService.d.ts @@ -1,9 +1,8 @@ import { I18n } from "i18n"; -import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { LocaleService } from "./LocaleService"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocaleService } from "@spt-aki/services/LocaleService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Handles translating server text into different langauges */ @@ -12,7 +11,6 @@ export declare class LocalisationService { protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; - protected localeConfig: ILocaleConfig; protected i18n: I18n; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** diff --git a/types/services/MailSendService.d.ts b/types/services/MailSendService.d.ts index 1d49638..08752bf 100644 --- a/types/services/MailSendService.d.ts +++ b/types/services/MailSendService.d.ts @@ -1,19 +1,19 @@ -import { DialogueHelper } from "../helpers/DialogueHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; -import { NotifierHelper } from "../helpers/NotifierHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { Item } from "../models/eft/common/tables/IItem"; -import { Dialogue, IUserDialogInfo, Message, MessageItems } from "../models/eft/profile/IAkiProfile"; -import { MessageType } from "../models/enums/MessageType"; -import { Traders } from "../models/enums/Traders"; -import { ISendMessageDetails } from "../models/spt/dialog/ISendMessageDetails"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { HashUtil } from "../utils/HashUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { LocalisationService } from "./LocalisationService"; +import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; +import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { Dialogue, IUserDialogInfo, Message, MessageItems } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { MessageType } from "@spt-aki/models/enums/MessageType"; +import { Traders } from "@spt-aki/models/enums/Traders"; +import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MailSendService { protected logger: ILogger; protected hashUtil: HashUtil; @@ -63,7 +63,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], profileChangeEvents?: any[], maxStorageTimeSeconds?: any): void; /** * Send a USER message to a player with or without items * @param sessionId The session ID to send the message to diff --git a/types/services/MatchBotDetailsCacheService.d.ts b/types/services/MatchBotDetailsCacheService.d.ts index c1bd322..6521719 100644 --- a/types/services/MatchBotDetailsCacheService.d.ts +++ b/types/services/MatchBotDetailsCacheService.d.ts @@ -1,6 +1,6 @@ -import { IBotBase } from "../models/eft/common/tables/IBotBase"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "./LocalisationService"; +import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { LocalisationService } from "@spt-aki/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; diff --git a/types/services/MatchLocationService.d.ts b/types/services/MatchLocationService.d.ts index c027bec..43a66be 100644 --- a/types/services/MatchLocationService.d.ts +++ b/types/services/MatchLocationService.d.ts @@ -1,9 +1,9 @@ -import { ICreateGroupRequestData } from "../models/eft/match/ICreateGroupRequestData"; -import { TimeUtil } from "../utils/TimeUtil"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class MatchLocationService { protected timeUtil: TimeUtil; + protected saveServer: SaveServer; protected locations: {}; - constructor(timeUtil: TimeUtil); - createGroup(sessionID: string, info: ICreateGroupRequestData): any; + constructor(timeUtil: TimeUtil, saveServer: SaveServer); deleteGroup(info: any): void; } diff --git a/types/services/ModCompilerService.d.ts b/types/services/ModCompilerService.d.ts index 52d4e26..51508ac 100644 --- a/types/services/ModCompilerService.d.ts +++ b/types/services/ModCompilerService.d.ts @@ -1,13 +1,13 @@ -import { CompilerOptions } from "typescript"; -import type { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; -import { HashCacheService } from "./HashCacheService"; +import ts from "typescript"; +import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; - protected hashCacheService: HashCacheService; + protected modHashCacheService: ModHashCacheService; protected vfs: VFS; protected serverDependencies: string[]; - constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS); /** * Convert a mods TS into JS * @param modName Name of mod @@ -21,7 +21,7 @@ export declare class ModCompilerService { * @param fileNames Paths to TS files * @param options Compiler options */ - protected compile(fileNames: string[], options: CompilerOptions): Promise; + protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; /** * Do the files at the provided paths exist * @param fileNames diff --git a/types/services/NotificationService.d.ts b/types/services/NotificationService.d.ts index 65a84dd..3f25b10 100644 --- a/types/services/NotificationService.d.ts +++ b/types/services/NotificationService.d.ts @@ -1,4 +1,4 @@ -import { INotification } from "../models/eft/notifier/INotifier"; +import { INotification } from "@spt-aki/models/eft/notifier/INotifier"; export declare class NotificationService { protected messageQueue: Record; getMessageQueue(): Record; diff --git a/types/services/OpenZoneService.d.ts b/types/services/OpenZoneService.d.ts index 8e70b94..581975b 100644 --- a/types/services/OpenZoneService.d.ts +++ b/types/services/OpenZoneService.d.ts @@ -1,10 +1,10 @@ -import { ILocationConfig } from "../models/spt/config/ILocationConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { RandomUtil } from "../utils/RandomUtil"; -import { LocalisationService } from "./LocalisationService"; +import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** Service for adding new zones to a maps OpenZones property */ export declare class OpenZoneService { protected logger: ILogger; diff --git a/types/services/PaymentService.d.ts b/types/services/PaymentService.d.ts index a604956..84d9244 100644 --- a/types/services/PaymentService.d.ts +++ b/types/services/PaymentService.d.ts @@ -1,19 +1,21 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentHelper } from "../helpers/PaymentHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; -import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { LocalisationService } from "./LocalisationService"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData"; +import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; export declare class PaymentService { protected logger: ILogger; + protected hashUtil: HashUtil; protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -22,15 +24,15 @@ export declare class PaymentService { protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); + constructor(logger: ILogger, hashUtil: HashUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request - * @param {IPmcData} pmcData Player profile - * @param {IProcessBuyTradeRequestData} request - * @param {string} sessionID - * @returns IItemEventRouterResponse + * @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): IItemEventRouterResponse; + 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 @@ -41,29 +43,22 @@ export declare class PaymentService { /** * Receive money back after selling * @param {IPmcData} pmcData - * @param {number} amount - * @param {IProcessSellTradeRequestData} body + * @param {number} amountToSend + * @param {IProcessSellTradeRequestData} request * @param {IItemEventRouterResponse} output * @param {string} sessionID * @returns IItemEventRouterResponse */ - getMoney(pmcData: IPmcData, amount: number, body: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): IItemEventRouterResponse; + giveProfileMoney(pmcData: IPmcData, amountToSend: number, request: IProcessSellTradeRequestData, output: IItemEventRouterResponse, sessionID: string): void; /** - * Recursively checks if the given item is - * inside the stash, that is it has the stash as - * ancestor with slotId=hideout - */ - protected isItemInStash(pmcData: IPmcData, item: Item): boolean; - /** - * Remove currency from player stash/inventory + * 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 - * @returns IItemEventRouterResponse */ - addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): void; /** * Get all money stacks in inventory and prioritse items in stash * @param pmcData diff --git a/types/services/PlayerService.d.ts b/types/services/PlayerService.d.ts index 458ce82..f24e0dc 100644 --- a/types/services/PlayerService.d.ts +++ b/types/services/PlayerService.d.ts @@ -1,23 +1,14 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { TimeUtil } from "../utils/TimeUtil"; -import { LocalisationService } from "./LocalisationService"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class PlayerService { protected logger: ILogger; protected timeUtil: TimeUtil; protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, databaseServer: DatabaseServer); - /** - * Dupe of QuestHelper.rewardsSkillPoints() - * Add xp to a player skill - * @param pmcData Player profile - * @param skillName Name of skill to increment - * @param amount Amount of skill points to add to skill - * @param useSkillProgressRateMultipler Skills are multiplied by a value in globals, default is off to maintain compatibility with legacy code - */ - incrementSkillLevel(pmcData: IPmcData, skillName: string, amount: number, useSkillProgressRateMultipler?: boolean): void; /** * Get level of player * @param pmcData Player profile diff --git a/types/services/PmcChatResponseService.d.ts b/types/services/PmcChatResponseService.d.ts index 7d946e6..1d38e2c 100644 --- a/types/services/PmcChatResponseService.d.ts +++ b/types/services/PmcChatResponseService.d.ts @@ -1,16 +1,18 @@ -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; -import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; -import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { LocalisationService } from "./LocalisationService"; -import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; +import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Aggressor, Victim } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { IPmcChatResponse } from "@spt-aki/models/spt/config/IPmChatResponse"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class PmcChatResponseService { protected logger: ILogger; + protected hashUtil: HashUtil; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; protected matchBotDetailsCacheService: MatchBotDetailsCacheService; @@ -18,7 +20,7 @@ export declare class PmcChatResponseService { protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, 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 diff --git a/types/services/ProfileFixerService.d.ts b/types/services/ProfileFixerService.d.ts index bc1e42e..804b3bf 100644 --- a/types/services/ProfileFixerService.d.ts +++ b/types/services/ProfileFixerService.d.ts @@ -1,23 +1,24 @@ -import { HideoutHelper } from "../helpers/HideoutHelper"; -import { InventoryHelper } from "../helpers/InventoryHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; -import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; -import { StageBonus } from "../models/eft/hideout/IHideoutArea"; -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { HideoutAreas } from "../models/enums/HideoutAreas"; -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { JsonUtil } from "../utils/JsonUtil"; -import { TimeUtil } from "../utils/TimeUtil"; -import { Watermark } from "../utils/Watermark"; -import { LocalisationService } from "./LocalisationService"; +import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper"; +import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Bonus, HideoutSlot } from "@spt-aki/models/eft/common/tables/IBotBase"; +import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +import { Watermark } from "@spt-aki/utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; @@ -29,21 +30,27 @@ export declare class ProfileFixerService { protected localisationService: LocalisationService; protected timeUtil: TimeUtil; protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; - protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -57,7 +64,11 @@ export declare class ProfileFixerService { removeDanglingConditionCounters(pmcProfile: IPmcData): void; addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void; protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void; - protected removeDanglingBackendCounters(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; @@ -65,9 +76,9 @@ export declare class ProfileFixerService { * 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 pmcProfile profile to update + * @param profile profile to update */ - protected updateProfileQuestDataValues(pmcProfile: IPmcData): void; + protected updateProfileQuestDataValues(profile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; /** * Some profiles have hideout maxed and therefore no improvements @@ -91,18 +102,12 @@ export declare class ProfileFixerService { */ protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void; protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[]; - /** - * In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots - * @param pmcProfile - */ - protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; /** * 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 @@ -114,6 +119,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to check inventory of */ checkForOrphanedModdedItems(sessionId: string, fullProfile: IAkiProfile): void; + /** + * 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 @@ -129,6 +139,17 @@ export declare class ProfileFixerService { * @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: IAkiProfile): void; + /** + * Bsg nested `stats` into a sub object called 'eft' + * @param fullProfile Profile to check for and migrate stats data + */ + migrateStatsToNewStructure(fullProfile: IAkiProfile): 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 @@ -136,7 +157,12 @@ export declare class ProfileFixerService { addMissingIdsToBonuses(pmcProfile: IPmcData): void; /** * At some point the property name was changed,migrate data across to new name - * @param pmcProfile + * @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; } diff --git a/types/services/ProfileSnapshotService.d.ts b/types/services/ProfileSnapshotService.d.ts index 445ffd0..3f60d41 100644 --- a/types/services/ProfileSnapshotService.d.ts +++ b/types/services/ProfileSnapshotService.d.ts @@ -1,5 +1,5 @@ -import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; -import { JsonUtil } from "../utils/JsonUtil"; +import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class ProfileSnapshotService { protected jsonUtil: JsonUtil; protected storedProfileSnapshots: Record; diff --git a/types/services/RagfairCategoriesService.d.ts b/types/services/RagfairCategoriesService.d.ts index 490b0bb..ef40275 100644 --- a/types/services/RagfairCategoriesService.d.ts +++ b/types/services/RagfairCategoriesService.d.ts @@ -1,40 +1,17 @@ -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; -import { ILogger } from "../models/spt/utils/ILogger"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; export declare class RagfairCategoriesService { protected logger: ILogger; - protected categories: Record; - constructor(logger: ILogger); + protected paymentHelper: PaymentHelper; + constructor(logger: ILogger, paymentHelper: PaymentHelper); /** - * Get all flea categories and their count of offers - * @returns item categories and count + * 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 */ - getAllCategories(): Record; - /** - * With the supplied items, get custom categories - * @returns a custom list of categories - */ - getBespokeCategories(offers: IRagfairOffer[]): Record; - /** - * Take an array of ragfair offers and create a dictionary of items with thier corrisponding offer count - * @param offers ragfair offers - * @returns categories and count - */ - protected processOffersIntoCategories(offers: IRagfairOffer[]): Record; - /** - * Increment or decrement a category array - * @param offer Offer to process - * @param categories Categories to update - * @param increment (Optional) Should item be incremented or decremented - */ - protected addOrIncrementCategory(offer: IRagfairOffer, categories: Record, increment?: boolean): void; - /** - * Increase category count by 1 - * @param offer - */ - incrementCategory(offer: IRagfairOffer): void; - /** - * Reduce category count by 1 - * @param offer - */ - decrementCategory(offer: IRagfairOffer): void; + getCategoriesFromOffers(offers: IRagfairOffer[], searchRequestData: ISearchRequestData, fleaUnlocked: boolean): Record; } diff --git a/types/services/RagfairLinkedItemService.d.ts b/types/services/RagfairLinkedItemService.d.ts index 0fe4d15..3d607ac 100644 --- a/types/services/RagfairLinkedItemService.d.ts +++ b/types/services/RagfairLinkedItemService.d.ts @@ -1,6 +1,6 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; diff --git a/types/services/RagfairOfferService.d.ts b/types/services/RagfairOfferService.d.ts index fc08d39..80bf353 100644 --- a/types/services/RagfairOfferService.d.ts +++ b/types/services/RagfairOfferService.d.ts @@ -1,36 +1,34 @@ -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; -import { TimeUtil } from "../utils/TimeUtil"; -import { LocalisationService } from "./LocalisationService"; -import { RagfairCategoriesService } from "./RagfairCategoriesService"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { SaveServer } from "@spt-aki/servers/SaveServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; +import { RagfairOfferHolder } from "@spt-aki/utils/RagfairOfferHolder"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class RagfairOfferService { protected logger: ILogger; protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; protected ragfairServerHelper: RagfairServerHelper; - protected ragfairCategoriesService: RagfairCategoriesService; protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; + /** Offer id + offer object */ protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; protected ragfairOfferHandler: RagfairOfferHolder; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array @@ -40,12 +38,19 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; 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 expired items not yet processed into new offers - * @returns items that need to be turned into offers + * Get an array of arrays of expired offer items + children + * @returns Expired offer assorts + */ + getExpiredOfferAssorts(): Item[][]; + /** + * Clear out internal expiredOffers dictionary of all items */ - getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -78,5 +83,5 @@ export declare class RagfairOfferService { * @param staleOffer Stale offer to process */ protected processStaleOffer(staleOffer: IRagfairOffer): void; - protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; + protected returnPlayerOffer(playerOffer: IRagfairOffer): void; } diff --git a/types/services/RagfairPriceService.d.ts b/types/services/RagfairPriceService.d.ts index ff35327..5649751 100644 --- a/types/services/RagfairPriceService.d.ts +++ b/types/services/RagfairPriceService.d.ts @@ -1,19 +1,20 @@ -import { OnLoad } from "../di/OnLoad"; -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { MinMax } from "../models/common/MinMax"; -import { IPreset } from "../models/eft/common/IGlobals"; -import { Item } from "../models/eft/common/tables/IItem"; -import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { IRagfairServerPrices } from "../models/spt/ragfair/IRagfairServerPrices"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { LocalisationService } from "./LocalisationService"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { PresetHelper } from "@spt-aki/helpers/PresetHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { MinMax } from "@spt-aki/models/common/MinMax"; +import { IPreset } from "@spt-aki/models/eft/common/IGlobals"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader"; +import { IRagfairConfig, IUnreasonableModPrices } from "@spt-aki/models/spt/config/IRagfairConfig"; +import { IRagfairServerPrices } from "@spt-aki/models/spt/ragfair/IRagfairServerPrices"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; /** * Stores flea prices for items as well as methods to interact with them */ @@ -52,6 +53,12 @@ export declare class RagfairPriceService implements OnLoad { * @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 * Grabs prices from prices.json and stores in class if none currently exist @@ -66,7 +73,7 @@ export declare class RagfairPriceService implements OnLoad { */ getStaticPriceForItem(itemTpl: string): number; /** - * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing * @returns Dictionary of item tpls and rouble cost */ getAllFleaPrices(): Record; @@ -86,12 +93,21 @@ export declare class RagfairPriceService implements OnLoad { getBarterPrice(barterScheme: IBarterScheme[]): number; /** * Generate a currency cost for an item and its mods - * @param items Item with mods to get price for + * @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(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, 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 @@ -100,7 +116,7 @@ export declare class RagfairPriceService implements OnLoad { */ protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** - * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * 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 @@ -115,12 +131,12 @@ export declare class RagfairPriceService implements OnLoad { 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 item base weapon - * @param items weapon plus mods + * @param weaponRootItem base weapon + * @param weaponWithChildren weapon plus mods * @param existingPrice price of existing base weapon * @returns price of weapon in roubles */ - protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; + 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 @@ -133,7 +149,7 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): { + protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset; }; diff --git a/types/services/RagfairRequiredItemsService.d.ts b/types/services/RagfairRequiredItemsService.d.ts index 95c3ddb..6749c68 100644 --- a/types/services/RagfairRequiredItemsService.d.ts +++ b/types/services/RagfairRequiredItemsService.d.ts @@ -1,12 +1,13 @@ -import { PaymentHelper } from "../helpers/PaymentHelper"; -import { RagfairOfferService } from "../services/RagfairOfferService"; -import { ILogger } from "../models/spt/utils/ILogger"; +import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { RagfairOfferService } from "@spt-aki/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): any; + getRequiredItemsById(searchId: string): IRagfairOffer[]; buildRequiredItemTable(): void; } diff --git a/types/services/RagfairTaxService.d.ts b/types/services/RagfairTaxService.d.ts index e6b3d7c..dd9cc5f 100644 --- a/types/services/RagfairTaxService.d.ts +++ b/types/services/RagfairTaxService.d.ts @@ -1,11 +1,11 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IStorePlayerOfferTaxAmountRequestData } from "../models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RagfairPriceService } from "../services/RagfairPriceService"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IStorePlayerOfferTaxAmountRequestData } from "@spt-aki/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService"; export declare class RagfairTaxService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -16,6 +16,16 @@ export declare class RagfairTaxService { 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; } diff --git a/types/services/RaidTimeAdjustmentService.d.ts b/types/services/RaidTimeAdjustmentService.d.ts new file mode 100644 index 0000000..a2a223a --- /dev/null +++ b/types/services/RaidTimeAdjustmentService.d.ts @@ -0,0 +1,60 @@ +import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; +import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest"; +import { ExtractChange, IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse"; +import { ILocationConfig, IScavRaidTimeLocationSettings, LootMultiplier } from "@spt-aki/models/spt/config/ILocationConfig"; +import { IRaidChanges } from "@spt-aki/models/spt/location/IRaidChanges"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +export declare class RaidTimeAdjustmentService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected weightedRandomHelper: WeightedRandomHelper; + protected applicationContext: ApplicationContext; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, 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[]; +} diff --git a/types/services/RepairService.d.ts b/types/services/RepairService.d.ts index 2fd22ed..cc90eee 100644 --- a/types/services/RepairService.d.ts +++ b/types/services/RepairService.d.ts @@ -1,25 +1,27 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { QuestHelper } from "../helpers/QuestHelper"; -import { RepairHelper } from "../helpers/RepairHelper"; -import { TraderHelper } from "../helpers/TraderHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Item } from "../models/eft/common/tables/IItem"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; -import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; -import { BonusSettings, IRepairConfig } from "../models/spt/config/IRepairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { RandomUtil } from "../utils/RandomUtil"; -import { LocalisationService } from "./LocalisationService"; -import { PaymentService } from "./PaymentService"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { RepairHelper } from "@spt-aki/helpers/RepairHelper"; +import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; +import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; +import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "@spt-aki/models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "@spt-aki/models/eft/repair/ITraderRepairActionDataRequest"; +import { BonusType } from "@spt-aki/models/enums/BonusType"; +import { SkillTypes } from "@spt-aki/models/enums/SkillTypes"; +import { BonusSettings, IRepairConfig } from "@spt-aki/models/spt/config/IRepairConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { PaymentService } from "@spt-aki/services/PaymentService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; export declare class RepairService { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected questHelper: QuestHelper; + protected profileHelper: ProfileHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; protected traderHelper: TraderHelper; @@ -29,7 +31,7 @@ export declare class RepairService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, questHelper: QuestHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, traderHelper: TraderHelper, weightedRandomHelper: WeightedRandomHelper, paymentService: PaymentService, repairHelper: RepairHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, 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 @@ -40,7 +42,6 @@ export declare class RepairService { */ 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 @@ -56,8 +57,14 @@ export declare class RepairService { * @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 @@ -76,11 +83,18 @@ export declare class RepairService { protected getKitDivisor(itemToRepairDetails: ITemplateItem, isArmor: boolean, pmcData: IPmcData): number; /** * Get the bonus multiplier for a skill from a player profile - * @param skillBonusName Name of bonus to get multipler of + * @param skillBonus Bonus to get multipler of * @param pmcData Player profile to look in for skill * @returns Multiplier value */ - protected getBonusMultiplierValue(skillBonusName: string, pmcData: IPmcData): number; + 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 @@ -112,17 +126,18 @@ export declare class RepairService { * @param itemTemplate Item to check for skill * @returns Skill name */ - protected getItemSkillType(itemTemplate: ITemplateItem): string; + protected getItemSkillType(itemTemplate: ITemplateItem): SkillTypes | undefined; /** * Ensure multiplier is between 1 and 0.01 - * @param receiveDurabilityMaxPercent Max durabiltiy percent + * @param receiveDurabilityMaxPercent Max durability percent * @param receiveDurabilityPercent current durability percent - * @returns durability multipler value + * @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; diff --git a/types/services/SeasonalEventService.d.ts b/types/services/SeasonalEventService.d.ts index 9fb3454..4c51bab 100644 --- a/types/services/SeasonalEventService.d.ts +++ b/types/services/SeasonalEventService.d.ts @@ -1,17 +1,18 @@ -import { BotHelper } from "../helpers/BotHelper"; -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IConfig } from "../models/eft/common/IGlobals"; -import { Inventory } from "../models/eft/common/tables/IBotType"; -import { SeasonalEventType } from "../models/enums/SeasonalEventType"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IQuestConfig } from "../models/spt/config/IQuestConfig"; -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { DatabaseImporter } from "../utils/DatabaseImporter"; -import { GiftService } from "./GiftService"; -import { LocalisationService } from "./LocalisationService"; +import { BotHelper } from "@spt-aki/helpers/BotHelper"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { IConfig } from "@spt-aki/models/eft/common/IGlobals"; +import { Inventory } from "@spt-aki/models/eft/common/tables/IBotType"; +import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; +import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { GiftService } from "@spt-aki/services/GiftService"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { DatabaseImporter } from "@spt-aki/utils/DatabaseImporter"; export declare class SeasonalEventService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -24,6 +25,11 @@ export declare class SeasonalEventService { 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, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; @@ -46,28 +52,24 @@ export declare class SeasonalEventService { */ itemIsSeasonalRelated(itemTpl: string): boolean; /** - * Get an array of items that appear during a seasonal event - * returns multiple seasonal event items if they are both active + * 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 */ - getAllSeasonalEventItems(): string[]; - /** - * Get an array of seasonal items that should be blocked as season is not currently active - * @returns Array of tpl strings - */ - getSeasonalEventItemsToBlock(): string[]; + getInactiveSeasonalEventItems(): string[]; /** * Is a seasonal event currently active * @returns true if event is active */ seasonalEventEnabled(): boolean; /** - * Is christmas event active (Globals eventtype array contains even name) + * Is christmas event active * @returns true if active */ christmasEventEnabled(): boolean; /** - * is halloween event active (Globals eventtype array contains even name) + * is halloween event active * @returns true if active */ halloweenEventEnabled(): boolean; @@ -95,16 +97,17 @@ export declare class SeasonalEventService { */ isQuestRelatedToEvent(questId: string, event: SeasonalEventType): boolean; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them + * Handle seasonal events * @param sessionId Players id */ - checkForAndEnableSeasonalEvents(sessionId: string): void; + enableSeasonalEvents(sessionId: string): void; + protected cacheActiveEvents(): void; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) - * @param nodeInventory Bots inventory to iterate over + * @param botInventory Bots inventory to iterate over * @param botRole the role of the bot being processed */ - removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in * @param sessionId Player id @@ -112,6 +115,9 @@ export declare class SeasonalEventService { * @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 @@ -141,4 +147,11 @@ export declare class SeasonalEventService { * @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; } diff --git a/types/services/TraderAssortService.d.ts b/types/services/TraderAssortService.d.ts index 03b4e12..9130de6 100644 --- a/types/services/TraderAssortService.d.ts +++ b/types/services/TraderAssortService.d.ts @@ -1,4 +1,4 @@ -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITraderAssort } from "@spt-aki/models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; diff --git a/types/services/TraderPurchasePersisterService.d.ts b/types/services/TraderPurchasePersisterService.d.ts index 25b02ad..92aaec3 100644 --- a/types/services/TraderPurchasePersisterService.d.ts +++ b/types/services/TraderPurchasePersisterService.d.ts @@ -1,21 +1,23 @@ -import { ProfileHelper } from "../helpers/ProfileHelper"; -import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; -import { ITraderConfig } from "../models/spt/config/ITraderConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { TimeUtil } from "../utils/TimeUtil"; -import { LocalisationService } from "./LocalisationService"; +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { TraderPurchaseData } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/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, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); + 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 @@ -23,6 +25,14 @@ export declare class TraderPurchasePersisterService { * @returns Dict of assort id and count purchased */ getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * 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; /** * Remove all trader purchase records from all profiles that exist * @param traderId Traders id diff --git a/types/services/TraderServicesService.d.ts b/types/services/TraderServicesService.d.ts new file mode 100644 index 0000000..4533989 --- /dev/null +++ b/types/services/TraderServicesService.d.ts @@ -0,0 +1,13 @@ +import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; +import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +export declare class TraderServicesService { + protected profileHelper: ProfileHelper; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected databaseServer: DatabaseServer; + constructor(profileHelper: ProfileHelper, jsonUtil: JsonUtil, logger: ILogger, databaseServer: DatabaseServer); + getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]; +} diff --git a/types/services/cache/BundleHashCacheService.d.ts b/types/services/cache/BundleHashCacheService.d.ts new file mode 100644 index 0000000..00f5e4c --- /dev/null +++ b/types/services/cache/BundleHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class BundleHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected bundleHashes: Record; + 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; +} diff --git a/types/services/cache/ModHashCacheService.d.ts b/types/services/cache/ModHashCacheService.d.ts new file mode 100644 index 0000000..dd33640 --- /dev/null +++ b/types/services/cache/ModHashCacheService.d.ts @@ -0,0 +1,18 @@ +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; +export declare class ModHashCacheService { + protected vfs: VFS; + protected hashUtil: HashUtil; + protected jsonUtil: JsonUtil; + protected logger: ILogger; + protected modHashes: Record; + 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; +} diff --git a/types/services/mod/CustomItemService.d.ts b/types/services/mod/CustomItemService.d.ts index 87bda40..fe9c16c 100644 --- a/types/services/mod/CustomItemService.d.ts +++ b/types/services/mod/CustomItemService.d.ts @@ -1,17 +1,21 @@ -import { ITemplateItem, Props } from "../../models/eft/common/tables/ITemplateItem"; -import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetails } from "../../models/spt/mod/NewItemDetails"; -import { IDatabaseTables } from "../../models/spt/server/IDatabaseTables"; -import { ILogger } from "../../models/spt/utils/ILogger"; -import { DatabaseServer } from "../../servers/DatabaseServer"; -import { HashUtil } from "../../utils/HashUtil"; -import { JsonUtil } from "../../utils/JsonUtil"; +import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetails } from "@spt-aki/models/spt/mod/NewItemDetails"; +import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class CustomItemService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected itemBaseClassService: ItemBaseClassService; protected tables: IDatabaseTables; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService); /** * 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 @@ -77,4 +81,16 @@ export declare class CustomItemService { * @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; } diff --git a/types/services/mod/dynamicRouter/DynamicRouterMod.d.ts b/types/services/mod/dynamicRouter/DynamicRouterMod.d.ts index abfe237..5eed5b4 100644 --- a/types/services/mod/dynamicRouter/DynamicRouterMod.d.ts +++ b/types/services/mod/dynamicRouter/DynamicRouterMod.d.ts @@ -1,4 +1,4 @@ -import { DynamicRouter, RouteAction } from "../../../di/Router"; +import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; export declare class DynamicRouterMod extends DynamicRouter { private topLevelRoute; constructor(routes: RouteAction[], topLevelRoute: string); diff --git a/types/services/mod/dynamicRouter/DynamicRouterModService.d.ts b/types/services/mod/dynamicRouter/DynamicRouterModService.d.ts index 6742fc6..648d191 100644 --- a/types/services/mod/dynamicRouter/DynamicRouterModService.d.ts +++ b/types/services/mod/dynamicRouter/DynamicRouterModService.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "tsyringe"; -import { RouteAction } from "../../../di/Router"; +import { RouteAction } from "@spt-aki/di/Router"; export declare class DynamicRouterModService { private container; constructor(container: DependencyContainer); diff --git a/types/services/mod/httpListener/HttpListenerMod.d.ts b/types/services/mod/httpListener/HttpListenerMod.d.ts index 2cdfbda..ebfa946 100644 --- a/types/services/mod/httpListener/HttpListenerMod.d.ts +++ b/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -1,6 +1,6 @@ /// -import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "../../../servers/http/IHttpListener"; +import { IncomingMessage, ServerResponse } from "node:http"; +import { IHttpListener } from "@spt-aki/servers/http/IHttpListener"; export declare class HttpListenerMod implements IHttpListener { private canHandleOverride; private handleOverride; diff --git a/types/services/mod/httpListener/HttpListenerModService.d.ts b/types/services/mod/httpListener/HttpListenerModService.d.ts index 9dd3473..23abfbe 100644 --- a/types/services/mod/httpListener/HttpListenerModService.d.ts +++ b/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -1,5 +1,5 @@ /// -import { IncomingMessage, ServerResponse } from "http"; +import { IncomingMessage, ServerResponse } from "node:http"; import { DependencyContainer } from "tsyringe"; export declare class HttpListenerModService { protected container: DependencyContainer; diff --git a/types/services/mod/onLoad/OnLoadMod.d.ts b/types/services/mod/onLoad/OnLoadMod.d.ts index a4b58b5..2bd5a31 100644 --- a/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/types/services/mod/onLoad/OnLoadMod.d.ts @@ -1,4 +1,4 @@ -import { OnLoad } from "../../../di/OnLoad"; +import { OnLoad } from "@spt-aki/di/OnLoad"; export declare class OnLoadMod implements OnLoad { private onLoadOverride; private getRouteOverride; diff --git a/types/services/mod/onUpdate/OnUpdateMod.d.ts b/types/services/mod/onUpdate/OnUpdateMod.d.ts index 8dfe6dd..bef1d1c 100644 --- a/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -1,4 +1,4 @@ -import { OnUpdate } from "../../../di/OnUpdate"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; export declare class OnUpdateMod implements OnUpdate { private onUpdateOverride; private getRouteOverride; diff --git a/types/services/mod/staticRouter/StaticRouterMod.d.ts b/types/services/mod/staticRouter/StaticRouterMod.d.ts index 1e62747..e01aaab 100644 --- a/types/services/mod/staticRouter/StaticRouterMod.d.ts +++ b/types/services/mod/staticRouter/StaticRouterMod.d.ts @@ -1,4 +1,4 @@ -import { RouteAction, StaticRouter } from "../../../di/Router"; +import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; export declare class StaticRouterMod extends StaticRouter { private topLevelRoute; constructor(routes: RouteAction[], topLevelRoute: string); diff --git a/types/services/mod/staticRouter/StaticRouterModService.d.ts b/types/services/mod/staticRouter/StaticRouterModService.d.ts index f28fd45..775caae 100644 --- a/types/services/mod/staticRouter/StaticRouterModService.d.ts +++ b/types/services/mod/staticRouter/StaticRouterModService.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "tsyringe"; -import { RouteAction } from "../../../di/Router"; +import { RouteAction } from "@spt-aki/di/Router"; export declare class StaticRouterModService { protected container: DependencyContainer; constructor(container: DependencyContainer); diff --git a/types/utils/App.d.ts b/types/utils/App.d.ts index dd8f24c..64800ce 100644 --- a/types/utils/App.d.ts +++ b/types/utils/App.d.ts @@ -1,19 +1,22 @@ -import { OnLoad } from "../di/OnLoad"; -import { OnUpdate } from "../di/OnUpdate"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { LocalisationService } from "../services/LocalisationService"; -import { EncodingUtil } from "./EncodingUtil"; -import { TimeUtil } from "./TimeUtil"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { OnUpdate } from "@spt-aki/di/OnUpdate"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { EncodingUtil } from "@spt-aki/utils/EncodingUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; protected localisationService: LocalisationService; + protected configServer: ConfigServer; protected encodingUtil: EncodingUtil; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - protected os: any; - constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, configServer: ConfigServer, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): Promise; protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/types/utils/AsyncQueue.d.ts b/types/utils/AsyncQueue.d.ts index da6ab18..2fab517 100644 --- a/types/utils/AsyncQueue.d.ts +++ b/types/utils/AsyncQueue.d.ts @@ -1,5 +1,5 @@ -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { ICommand } from "../models/spt/utils/ICommand"; +import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; +import { ICommand } from "@spt-aki/models/spt/utils/ICommand"; export declare class AsyncQueue implements IAsyncQueue { protected commandsQueue: ICommand[]; constructor(); diff --git a/types/utils/AyncQueue.d.ts b/types/utils/AyncQueue.d.ts new file mode 100644 index 0000000..da6ab18 --- /dev/null +++ b/types/utils/AyncQueue.d.ts @@ -0,0 +1,7 @@ +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ICommand } from "../models/spt/utils/ICommand"; +export declare class AsyncQueue implements IAsyncQueue { + protected commandsQueue: ICommand[]; + constructor(); + waitFor(command: ICommand): Promise; +} diff --git a/types/utils/DatabaseImporter.d.ts b/types/utils/DatabaseImporter.d.ts index b1afefc..f8218bf 100644 --- a/types/utils/DatabaseImporter.d.ts +++ b/types/utils/DatabaseImporter.d.ts @@ -1,15 +1,15 @@ -import { OnLoad } from "../di/OnLoad"; -import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ImageRouter } from "../routers/ImageRouter"; -import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocalisationService } from "../services/LocalisationService"; -import { EncodingUtil } from "./EncodingUtil"; -import { HashUtil } from "./HashUtil"; -import { ImporterUtil } from "./ImporterUtil"; -import { JsonUtil } from "./JsonUtil"; -import { VFS } from "./VFS"; +import { OnLoad } from "@spt-aki/di/OnLoad"; +import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ImageRouter } from "@spt-aki/routers/ImageRouter"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { EncodingUtil } from "@spt-aki/utils/EncodingUtil"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { ImporterUtil } from "@spt-aki/utils/ImporterUtil"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class DatabaseImporter implements OnLoad { protected logger: ILogger; protected vfs: VFS; diff --git a/types/utils/HashUtil.d.ts b/types/utils/HashUtil.d.ts index c017ca8..d428072 100644 --- a/types/utils/HashUtil.d.ts +++ b/types/utils/HashUtil.d.ts @@ -1,6 +1,8 @@ /// -import crypto from "crypto"; -import { TimeUtil } from "./TimeUtil"; +/// +import crypto from "node:crypto"; +import fs from "node:fs"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); @@ -11,6 +13,7 @@ export declare class HashUtil { generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + generateCRC32ForFile(filePath: fs.PathLike): number; /** * Create a hash for the data parameter * @param algorithm algorithm to use to hash diff --git a/types/utils/HttpFileUtil.d.ts b/types/utils/HttpFileUtil.d.ts index afc8409..222d204 100644 --- a/types/utils/HttpFileUtil.d.ts +++ b/types/utils/HttpFileUtil.d.ts @@ -1,8 +1,8 @@ /// -import { ServerResponse } from "http"; -import { HttpServerHelper } from "../helpers/HttpServerHelper"; +import { ServerResponse } from "node:http"; +import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; export declare class HttpFileUtil { protected httpServerHelper: HttpServerHelper; constructor(httpServerHelper: HttpServerHelper); - sendFile(resp: ServerResponse, file: any): void; + sendFile(resp: ServerResponse, filePath: string): void; } diff --git a/types/utils/HttpResponseUtil.d.ts b/types/utils/HttpResponseUtil.d.ts index 70282ab..318e98b 100644 --- a/types/utils/HttpResponseUtil.d.ts +++ b/types/utils/HttpResponseUtil.d.ts @@ -1,9 +1,9 @@ -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; -import { LocalisationService } from "../services/LocalisationService"; -import { JsonUtil } from "./JsonUtil"; +import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; +import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; +import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "@spt-aki/models/enums/BackendErrorCodes"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; protected localisationService: LocalisationService; @@ -15,10 +15,24 @@ export declare class HttpResponseUtil { * @returns */ noBody(data: any): any; - getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; + /** + * Game client needs server responses in a particular format + * @param data + * @param err + * @param errmsg + * @returns + */ + getBody(data: T, err?: number, errmsg?: any, sanitize?: boolean): IGetBodyResponseData; getUnclearedBody(data: any, err?: number, errmsg?: any): string; emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; + /** + * Add an error into the 'warnings' array of the client response message + * @param output IItemEventRouterResponse + * @param message Error message + * @param errorCode Error code + * @returns IItemEventRouterResponse + */ appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/types/utils/ImporterUtil.d.ts b/types/utils/ImporterUtil.d.ts index 75aaf54..7ce1bdb 100644 --- a/types/utils/ImporterUtil.d.ts +++ b/types/utils/ImporterUtil.d.ts @@ -1,5 +1,5 @@ -import { JsonUtil } from "./JsonUtil"; -import { VFS } from "./VFS"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class ImporterUtil { protected vfs: VFS; protected jsonUtil: JsonUtil; diff --git a/types/utils/JsonUtil.d.ts b/types/utils/JsonUtil.d.ts index 30cf2ac..befc3cb 100644 --- a/types/utils/JsonUtil.d.ts +++ b/types/utils/JsonUtil.d.ts @@ -1,7 +1,7 @@ import { IParseOptions, IStringifyOptions, Reviver } from "jsonc/lib/interfaces"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { HashUtil } from "./HashUtil"; -import { VFS } from "./VFS"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { HashUtil } from "@spt-aki/utils/HashUtil"; +import { VFS } from "@spt-aki/utils/VFS"; export declare class JsonUtil { protected vfs: VFS; protected hashUtil: HashUtil; @@ -28,9 +28,9 @@ export declare class JsonUtil { /** * From object to string * @param data object to turn into JSON - * @param filename Name of file being serialized - * @param options Stringify options or a replacer. - * @returns The string converted from the JavaScript value + * @param filename Name of file being serialized + * @param options Stringify options or a replacer. + * @returns The string converted from the JavaScript value */ serializeJsonC(data: any, filename?: string | null, options?: IStringifyOptions | Reviver): string; serializeJson5(data: any, filename?: string | null, prettify?: boolean): string; diff --git a/types/utils/MathUtil.d.ts b/types/utils/MathUtil.d.ts index ea5fd69..4acfeaf 100644 --- a/types/utils/MathUtil.d.ts +++ b/types/utils/MathUtil.d.ts @@ -1,9 +1,9 @@ export declare class MathUtil { /** * Helper to create the sum of all array elements - * @param {array} values The array with numbers of which to calculate the sum - * @return {number} sum(values) - */ + * @param {array} values The array with numbers of which to calculate the sum + * @return {number} sum(values) + */ arraySum(values: number[]): number; /** * Helper to create the cumulative sum of all array elements @@ -41,13 +41,13 @@ export declare class MathUtil { */ mapToRange(x: number, minIn: number, maxIn: number, minOut: number, maxOut: number): number; /** - * Linear interpolation - * e.g. used to do a continuous integration for quest rewards which are defined for specific support centers of pmcLevel - * - * @param {string} xp the point of x at which to interpolate - * @param {array} x support points in x (of same length as y) - * @param {array} y support points in y (of same length as x) - * @return {number} y(xp) - */ + * Linear interpolation + * e.g. used to do a continuous integration for quest rewards which are defined for specific support centers of pmcLevel + * + * @param {string} xp the point of x at which to interpolate + * @param {array} x support points in x (of same length as y) + * @param {array} y support points in y (of same length as x) + * @return {number} y(xp) + */ interp1(xp: number, x: number[], y: number[]): number; } diff --git a/types/utils/ObjectId.d.ts b/types/utils/ObjectId.d.ts index 03aae56..309354f 100644 --- a/types/utils/ObjectId.d.ts +++ b/types/utils/ObjectId.d.ts @@ -1,5 +1,5 @@ /// -import { TimeUtil } from "./TimeUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export declare class ObjectId { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); diff --git a/types/utils/RagfairOfferHolder.d.ts b/types/utils/RagfairOfferHolder.d.ts index cc294da..3942ed1 100644 --- a/types/utils/RagfairOfferHolder.d.ts +++ b/types/utils/RagfairOfferHolder.d.ts @@ -1,4 +1,4 @@ -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { protected offersById: Map; protected offersByTemplate: Map>; @@ -10,9 +10,13 @@ export declare class RagfairOfferHolder { getOffers(): Array; addOffers(offers: Array): void; addOffer(offer: IRagfairOffer): void; + /** + * Purge offer from offer cache + * @param offer Offer to remove + */ removeOffer(offer: IRagfairOffer): void; removeOffers(offers: Array): void; - removeOfferByTrader(traderId: string): void; + removeAllOffersByTrader(traderId: string): void; /** * Get an array of stale offers that are still shown to player * @returns IRagfairOffer array diff --git a/types/utils/RandomUtil.d.ts b/types/utils/RandomUtil.d.ts index 92c37da..9236773 100644 --- a/types/utils/RandomUtil.d.ts +++ b/types/utils/RandomUtil.d.ts @@ -1,21 +1,21 @@ -import { ILogger } from "../models/spt/utils/ILogger"; -import { JsonUtil } from "./JsonUtil"; -import { MathUtil } from "./MathUtil"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; /** - * Array of ProbabilityObjectArray which allow to randomly draw of the contained objects - * based on the relative probability of each of its elements. - * The probabilities of the contained element is not required to be normalized. - * - * Example: - * po = new ProbabilityObjectArray( - * new ProbabilityObject("a", 5), - * new ProbabilityObject("b", 1), - * new ProbabilityObject("c", 1) - * ); - * res = po.draw(10000); - * // count the elements which should be distributed according to the relative probabilities - * res.filter(x => x==="b").reduce((sum, x) => sum + 1 , 0) - */ + * Array of ProbabilityObjectArray which allow to randomly draw of the contained objects + * based on the relative probability of each of its elements. + * The probabilities of the contained element is not required to be normalized. + * + * Example: + * po = new ProbabilityObjectArray( + * new ProbabilityObject("a", 5), + * new ProbabilityObject("b", 1), + * new ProbabilityObject("c", 1) + * ); + * res = po.draw(10000); + * // count the elements which should be distributed according to the relative probabilities + * res.filter(x => x==="b").reduce((sum, x) => sum + 1 , 0) + */ export declare class ProbabilityObjectArray extends Array> { private mathUtil; private jsonUtil; @@ -87,19 +87,19 @@ export declare class ProbabilityObjectArray extends Array): K[]; } /** - * A ProbabilityObject which is use as an element to the ProbabilityObjectArray array - * It contains a key, the relative probability as well as optional data. - */ + * A ProbabilityObject which is use as an element to the ProbabilityObjectArray array + * It contains a key, the relative probability as well as optional data. + */ export declare class ProbabilityObject { key: K; relativeProbability: number; data: V; /** - * Constructor for the ProbabilityObject - * @param {string} key The key of the element - * @param {number} relativeProbability The relative probability of this element - * @param {any} data Optional data attached to the element - */ + * Constructor for the ProbabilityObject + * @param {string} key The key of the element + * @param {number} relativeProbability The relative probability of this element + * @param {any} data Optional data attached to the element + */ constructor(key: K, relativeProbability: number, data?: V); } export declare class RandomUtil { @@ -111,6 +111,13 @@ export declare class RandomUtil { getFloat(min: number, max: number): number; getBool(): boolean; getPercentOfValue(percent: number, number: number, toFixed?: number): number; + /** + * Reduce a value by a percentage + * @param number Value to reduce + * @param percentage Percentage to reduce value by + * @returns Reduced value + */ + reduceValueByPercent(number: number, percentage: number): number; /** * Check if number passes a check out of 100 * @param chancePercent value check needs to be above @@ -124,12 +131,13 @@ export declare class RandomUtil { [x: string]: any; }): any; /** - * Draw from normal distribution - * @param {number} mu Mean of the normal distribution + * Generate a normally distributed random number + * Uses the Box-Muller transform + * @param {number} mean Mean of the normal distribution * @param {number} sigma Standard deviation of the normal distribution * @returns {number} The value drawn */ - randn(mu: number, sigma: number): number; + getNormallyDistributedRandomNumber(mean: number, sigma: number, attempt?: number): number; /** * Draw Random integer low inclusive, high exclusive * if high is not set we draw from 0 to low (exclusive) @@ -142,11 +150,11 @@ export declare class RandomUtil { * Draw a random element of the provided list N times to return an array of N random elements * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from - * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array(defult true) + * @param {integer} count The number of times we want to draw + * @param {boolean} replacement Draw with or without replacement from the input array(default true) * @return {array} Array consisting of N random elements */ - drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; + drawRandomFromList(originalList: Array, count?: number, replacement?: boolean): Array; /** * Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys * Drawing can be with or without replacement @@ -163,4 +171,12 @@ export declare class RandomUtil { * @returns Shuffled array */ shuffle(array: Array): Array; + /** + * Rolls for a probability based on chance + * @param number Probability Chance as float (0-1) + * @returns If roll succeed or not + * @example + * rollForChanceProbability(0.25); // returns true 25% probability + */ + rollForChanceProbability(probabilityChance: number): boolean; } diff --git a/types/utils/TimeUtil.d.ts b/types/utils/TimeUtil.d.ts index 1367e26..2b844ba 100644 --- a/types/utils/TimeUtil.d.ts +++ b/types/utils/TimeUtil.d.ts @@ -1,31 +1,65 @@ /** - * Utility class to handle time related problems + * Utility class to handle time related operations. */ export declare class TimeUtil { - static readonly oneHourAsSeconds = 3600; + static readonly ONE_HOUR_AS_SECONDS = 3600; + /** + * Pads a number with a leading zero if it is less than 10. + * + * @param {number} number - The number to pad. + * @returns {string} The padded number as a string. + */ + protected pad(number: number): string; + /** + * Formats the time part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted time as 'HH-MM-SS'. + */ formatTime(date: Date): string; + /** + * Formats the date part of a date as a UTC string. + * + * @param {Date} date - The date to format in UTC. + * @returns {string} The formatted date as 'YYYY-MM-DD'. + */ formatDate(date: Date): string; + /** + * Gets the current date as a formatted UTC string. + * + * @returns {string} The current date as 'YYYY-MM-DD'. + */ getDate(): string; + /** + * Gets the current time as a formatted UTC string. + * + * @returns {string} The current time as 'HH-MM-SS'. + */ getTime(): string; /** - * Get timestamp in seconds - * @returns + * Gets the current timestamp in seconds in UTC. + * + * @returns {number} The current timestamp in seconds since the Unix epoch in UTC. */ getTimestamp(): number; /** - * mail in eft requires time be in a specific format - * @returns current time in format: 00:00 (hh:mm) + * Gets the current time in UTC in a format suitable for mail in EFT. + * + * @returns {string} The current time as 'HH:MM' in UTC. */ getTimeMailFormat(): string; /** - * Mail in eft requires date be in a specific format - * @returns current date in format: 00.00.0000 (dd.mm.yyyy) + * Gets the current date in UTC in a format suitable for emails in EFT. + * + * @returns {string} The current date as 'DD.MM.YYYY' in UTC. */ getDateMailFormat(): string; /** - * Convert hours into seconds - * @param hours hours to convert to seconds - * @returns number + * Converts a number of hours into seconds. + * + * @param {number} hours - The number of hours to convert. + * @returns {number} The equivalent number of seconds. */ getHoursAsSeconds(hours: number): number; + getTimestampOfNextHour(): number; } diff --git a/types/utils/VFS.d.ts b/types/utils/VFS.d.ts index 2cb09fa..d880bf5 100644 --- a/types/utils/VFS.d.ts +++ b/types/utils/VFS.d.ts @@ -1,12 +1,10 @@ /// /// -import fs from "fs"; import "reflect-metadata"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; +import fs from "node:fs"; +import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; export declare class VFS { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { @@ -24,7 +22,7 @@ export declare class VFS { unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; copyFile(filepath: fs.PathLike, target: fs.PathLike): void; @@ -48,8 +46,8 @@ export declare class VFS { removeDirAsync(filepath: string): Promise; rename(oldPath: string, newPath: string): void; renameAsync(oldPath: string, newPath: string): Promise; - protected lockFileSync(filepath: any): void; - protected checkFileSync(filepath: any): any; + protected lockFileSync(filepath: any): () => void; + protected checkFileSync(filepath: any): boolean; protected unlockFileSync(filepath: any): void; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; diff --git a/types/utils/Watermark.d.ts b/types/utils/Watermark.d.ts index fa63205..eb24706 100644 --- a/types/utils/Watermark.d.ts +++ b/types/utils/Watermark.d.ts @@ -1,15 +1,13 @@ -import { ICoreConfig } from "../models/spt/config/ICoreConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -import { LocalisationService } from "../services/LocalisationService"; +import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { LocalisationService } from "@spt-aki/services/LocalisationService"; export declare class WatermarkLocale { protected localisationService: LocalisationService; + protected description: string[]; + protected warning: string[]; + protected modding: string[]; constructor(localisationService: LocalisationService); - protected watermark: { - description: string[]; - warning: string[]; - modding: string[]; - }; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -20,9 +18,9 @@ export declare class Watermark { protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); initialize(): void; /** * Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) @@ -42,6 +40,4 @@ export declare class Watermark { protected resetCursor(): void; /** Draw the watermark */ protected draw(): void; - /** Caculate text length */ - protected textLength(s: string): number; } diff --git a/types/utils/collections/lists/LinkedList.d.ts b/types/utils/collections/lists/LinkedList.d.ts index aca0659..6a084fa 100644 --- a/types/utils/collections/lists/LinkedList.d.ts +++ b/types/utils/collections/lists/LinkedList.d.ts @@ -1,30 +1,56 @@ export declare class LinkedList { - private head; - private tail; - add(t: T): void; - addRange(list: T[]): void; - getHead(): LinkedListNode; - getTail(): LinkedListNode; - isEmpty(): boolean; - getSize(): number; - removeFirst(): LinkedListNode; - removeLast(): LinkedListNode; - indexOf(func: (t: T) => boolean): number; - contains(func: (t: T) => boolean): boolean; - forEachNode(func: (t: LinkedListNode) => void): void; - forEachValue(func: (t: T) => void): void; - findFirstNode(func: (t: LinkedListNode) => boolean): LinkedListNode; - findFirstValue(func: (t: T) => boolean): T; - toList(): T[]; -} -export declare class LinkedListNode { - private previous; - private value; - private next; - constructor(value: T, previous?: LinkedListNode, next?: LinkedListNode); - getValue(): T; - getNextNode(): LinkedListNode; - setNextNode(node: LinkedListNode): void; - getPreviousNode(): LinkedListNode; - setPreviousNode(node: LinkedListNode): void; + private head?; + private tail?; + private _length; + get length(): number; + private set length(value); + constructor(); + /** + * Adds an element to the start of the list. + */ + prepend(value: T): void; + /** + * Adds an element at the given index to the list. + */ + insertAt(value: T, idx: number): void; + /** + * Adds an element to the end of the list. + */ + append(value: T): void; + /** + * Returns the first element's value. + */ + getHead(): T; + /** + * Finds the element from the list at the given index and returns it's value. + */ + get(idx: number): T; + /** + * Returns the last element's value. + */ + getTail(): T; + /** + * Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it. + */ + remove(value: T): T; + /** + * Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + shift(): T; + /** + * Removes the element from the list at the given index and returns it's value. + */ + removeAt(idx: number): T; + /** + * Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified. + */ + pop(): T; + /** + * Returns an iterable of index, value pairs for every entry in the list. + */ + entries(): IterableIterator<[number, T]>; + /** + * Returns an iterable of values in the list. + */ + values(): IterableIterator; } diff --git a/types/utils/collections/lists/Nodes.d.ts b/types/utils/collections/lists/Nodes.d.ts new file mode 100644 index 0000000..8e29e59 --- /dev/null +++ b/types/utils/collections/lists/Nodes.d.ts @@ -0,0 +1,6 @@ +export declare class LinkedListNode { + value: T; + prev?: LinkedListNode; + next?: LinkedListNode; + constructor(value: T, prev?: LinkedListNode, next?: LinkedListNode); +} diff --git a/types/utils/collections/queue/Queue.d.ts b/types/utils/collections/queue/Queue.d.ts index 645d462..8ea3d32 100644 --- a/types/utils/collections/queue/Queue.d.ts +++ b/types/utils/collections/queue/Queue.d.ts @@ -1,12 +1,21 @@ export declare class Queue { - private elements; - private head; - private tail; + private list; + get length(): number; constructor(); + /** + * Adds an element to the end of the queue. + */ enqueue(element: T): void; + /** + * Iterates over the elements received and adds each one to the end of the queue. + */ enqueueAll(elements: T[]): void; + /** + * Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified. + */ dequeue(): T; + /** + * Returns the first element's value. + */ peek(): T; - getLength(): number; - isEmpty(): boolean; } diff --git a/types/utils/logging/AbstractWinstonLogger.d.ts b/types/utils/logging/AbstractWinstonLogger.d.ts index 1ae1100..11179b0 100644 --- a/types/utils/logging/AbstractWinstonLogger.d.ts +++ b/types/utils/logging/AbstractWinstonLogger.d.ts @@ -1,16 +1,14 @@ /// -import fs from "fs"; +import fs from "node:fs"; import winston from "winston"; -import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest"; -import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor"; -import { LogTextColor } from "../../models/spt/logging/LogTextColor"; -import { SptLogger } from "../../models/spt/logging/SptLogger"; -import { IAsyncQueue } from "../../models/spt/utils/IAsyncQueue"; -import { ILogger } from "../../models/spt/utils/ILogger"; -import { IUUidGenerator } from "../../models/spt/utils/IUuidGenerator"; +import { Daum } from "@spt-aki/models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "@spt-aki/models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor"; +import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; +import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; +import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; export declare abstract class AbstractWinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; protected showDebugInConsole: boolean; protected filePath: string; protected logLevels: { @@ -44,7 +42,7 @@ export declare abstract class AbstractWinstonLogger implements ILogger { }; protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected abstract isLogToFile(): boolean; protected abstract isLogToConsole(): boolean; protected abstract isLogExceptions(): boolean; diff --git a/types/utils/logging/WinstonMainLogger.d.ts b/types/utils/logging/WinstonMainLogger.d.ts index 3c67902..53cd9d3 100644 --- a/types/utils/logging/WinstonMainLogger.d.ts +++ b/types/utils/logging/WinstonMainLogger.d.ts @@ -1,10 +1,8 @@ -import { IAsyncQueue } from "../../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../../models/spt/utils/IUuidGenerator"; -import { AbstractWinstonLogger } from "./AbstractWinstonLogger"; +import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; +import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonMainLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean; diff --git a/types/utils/logging/WinstonRequestLogger.d.ts b/types/utils/logging/WinstonRequestLogger.d.ts index 1475e43..45bc436 100644 --- a/types/utils/logging/WinstonRequestLogger.d.ts +++ b/types/utils/logging/WinstonRequestLogger.d.ts @@ -1,10 +1,8 @@ -import { IAsyncQueue } from "../../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../../models/spt/utils/IUuidGenerator"; -import { AbstractWinstonLogger } from "./AbstractWinstonLogger"; +import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue"; +import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLogger"; export declare class WinstonRequestLogger extends AbstractWinstonLogger { protected asyncQueue: IAsyncQueue; - protected uuidGenerator: IUUidGenerator; - constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); + constructor(asyncQueue: IAsyncQueue); protected isLogExceptions(): boolean; protected isLogToFile(): boolean; protected isLogToConsole(): boolean;