Updated interfaces to follow correct naming convention

Removed some interface duplication
This commit is contained in:
Dev 2024-09-24 12:47:29 +01:00
parent 5fd9271491
commit ab1422bc40
127 changed files with 876 additions and 905 deletions

View File

@ -4,7 +4,7 @@ import { BotController } from "@spt/controllers/BotController";
import { IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData"; import { IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData";
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData"; import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase"; import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
import { Difficulties } from "@spt/models/eft/common/tables/IBotType"; import { IDifficulties } from "@spt/models/eft/common/tables/IBotType";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData"; import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
@ -56,7 +56,7 @@ export class BotCallbacks {
url: string, url: string,
info: IEmptyRequestData, info: IEmptyRequestData,
sessionID: string, sessionID: string,
): Record<string, Difficulties> { ): Record<string, IDifficulties> {
return this.httpResponse.noBody(this.botController.getAllBotDifficulties()); return this.httpResponse.noBody(this.botController.getAllBotDifficulties());
} }

View File

@ -5,7 +5,7 @@ import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData"; import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
import { IGetMiniProfileRequestData } from "@spt/models/eft/launcher/IGetMiniProfileRequestData"; import { IGetMiniProfileRequestData } from "@spt/models/eft/launcher/IGetMiniProfileRequestData";
import { GetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData"; import { IGetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData";
import { ICreateProfileResponse } from "@spt/models/eft/profile/ICreateProfileResponse"; import { ICreateProfileResponse } from "@spt/models/eft/profile/ICreateProfileResponse";
import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest"; import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse"; import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
@ -129,7 +129,7 @@ export class ProfileCallbacks {
url: string, url: string,
info: IEmptyRequestData, info: IEmptyRequestData,
sessionID: string, sessionID: string,
): IGetBodyResponseData<GetProfileStatusResponseData> { ): IGetBodyResponseData<IGetProfileStatusResponseData> {
return this.httpResponse.getBody(this.profileController.getProfileStatus(sessionID)); return this.httpResponse.getBody(this.profileController.getProfileStatus(sessionID));
} }

View File

@ -6,11 +6,11 @@ import { BotHelper } from "@spt/helpers/BotHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { MinMax } from "@spt/models/common/MinMax"; import { MinMax } from "@spt/models/common/MinMax";
import { Condition, IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData"; import { ICondition, IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase"; import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
import { IBotCore } from "@spt/models/eft/common/tables/IBotCore"; import { IBotCore } from "@spt/models/eft/common/tables/IBotCore";
import { Difficulty } from "@spt/models/eft/common/tables/IBotType"; import { IDifficultyCategories } from "@spt/models/eft/common/tables/IBotType";
import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData"; import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { SideType } from "@spt/models/enums/SideType"; import { SideType } from "@spt/models/enums/SideType";
@ -95,7 +95,7 @@ export class BotController {
diffLevel: string, diffLevel: string,
raidConfig?: IGetRaidConfigurationRequestData, raidConfig?: IGetRaidConfigurationRequestData,
ignoreRaidSettings = false, ignoreRaidSettings = false,
): Difficulty { ): IDifficultyCategories {
let difficulty = diffLevel.toLowerCase(); let difficulty = diffLevel.toLowerCase();
if (!(raidConfig || ignoreRaidSettings)) { if (!(raidConfig || ignoreRaidSettings)) {
@ -237,7 +237,7 @@ export class BotController {
* @returns BotGenerationDetails * @returns BotGenerationDetails
*/ */
protected getBotGenerationDetailsForWave( protected getBotGenerationDetailsForWave(
condition: Condition, condition: ICondition,
pmcProfile: IPmcData, pmcProfile: IPmcData,
allPmcsHaveSameNameAsPlayer: boolean, allPmcsHaveSameNameAsPlayer: boolean,
raidSettings: IGetRaidConfigurationRequestData, raidSettings: IGetRaidConfigurationRequestData,
@ -277,7 +277,7 @@ export class BotController {
* @returns A promise for the bots to be done generating * @returns A promise for the bots to be done generating
*/ */
protected async generateWithBotDetails( protected async generateWithBotDetails(
condition: Condition, condition: ICondition,
botGenerationDetails: BotGenerationDetails, botGenerationDetails: BotGenerationDetails,
sessionId: string, sessionId: string,
): Promise<void> { ): Promise<void> {
@ -353,7 +353,7 @@ export class BotController {
const raidSettings = this.getMostRecentRaidSettings(); const raidSettings = this.getMostRecentRaidSettings();
// Create generation request for when cache is empty // Create generation request for when cache is empty
const condition: Condition = { const condition: ICondition = {
Role: requestedBot.Role, Role: requestedBot.Role,
Limit: 5, Limit: 5,
Difficulty: requestedBot.Difficulty, Difficulty: requestedBot.Difficulty,

View File

@ -2,7 +2,7 @@ import { HealthHelper } from "@spt/helpers/HealthHelper";
import { InventoryHelper } from "@spt/helpers/InventoryHelper"; import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { BodyPart, IHealthTreatmentRequestData } from "@spt/models/eft/health/IHealthTreatmentRequestData"; import { IBodyPart, IHealthTreatmentRequestData } from "@spt/models/eft/health/IHealthTreatmentRequestData";
import { IOffraidEatRequestData } from "@spt/models/eft/health/IOffraidEatRequestData"; import { IOffraidEatRequestData } from "@spt/models/eft/health/IOffraidEatRequestData";
import { IOffraidHealRequestData } from "@spt/models/eft/health/IOffraidHealRequestData"; import { IOffraidHealRequestData } from "@spt/models/eft/health/IOffraidHealRequestData";
import { ISyncHealthRequestData } from "@spt/models/eft/health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "@spt/models/eft/health/ISyncHealthRequestData";
@ -169,7 +169,7 @@ export class HealthController {
for (const bodyPartKey in healthTreatmentRequest.difference.BodyParts) { for (const bodyPartKey in healthTreatmentRequest.difference.BodyParts) {
// Get body part from request + from pmc profile // Get body part from request + from pmc profile
const partRequest: BodyPart = healthTreatmentRequest.difference.BodyParts[bodyPartKey]; const partRequest: IBodyPart = healthTreatmentRequest.difference.BodyParts[bodyPartKey];
const profilePart = pmcData.Health.BodyParts[bodyPartKey]; const profilePart = pmcData.Health.BodyParts[bodyPartKey];
// Bodypart healing is chosen when part request hp is above 0 // Bodypart healing is chosen when part request hp is above 0

View File

@ -7,7 +7,7 @@ import { PresetHelper } from "@spt/helpers/PresetHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IBotHideoutArea, IProduct, IScavCase, ITaskConditionCounter } from "@spt/models/eft/common/tables/IBotBase"; import { IBotHideoutArea, IProduct, IScavCase, ITaskConditionCounter } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { HideoutUpgradeCompleteRequestData } from "@spt/models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { HideoutUpgradeCompleteRequestData } from "@spt/models/eft/hideout/HideoutUpgradeCompleteRequestData";
import { IHandleQTEEventRequestData } from "@spt/models/eft/hideout/IHandleQTEEventRequestData"; import { IHandleQTEEventRequestData } from "@spt/models/eft/hideout/IHandleQTEEventRequestData";
import { IHideoutArea, Stage } from "@spt/models/eft/hideout/IHideoutArea"; import { IHideoutArea, Stage } from "@spt/models/eft/hideout/IHideoutArea";
@ -353,7 +353,7 @@ export class HideoutController {
pmcData.Inventory.items.push(mannequinToAdd); pmcData.Inventory.items.push(mannequinToAdd);
// Add pocket child item // Add pocket child item
const mannequinPocketItemToAdd: Item = { const mannequinPocketItemToAdd: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: pmcData.Inventory.items.find( _tpl: pmcData.Inventory.items.find(
(item) => item.slotId === "Pockets" && item.parentId === pmcData.Inventory.equipment, (item) => item.slotId === "Pockets" && item.parentId === pmcData.Inventory.equipment,
@ -878,7 +878,7 @@ export class HideoutController {
let hoursCrafting = counterHoursCrafting.value; let hoursCrafting = counterHoursCrafting.value;
/** Array of arrays of item + children */ /** Array of arrays of item + children */
let itemAndChildrenToSendToPlayer: Item[][] = []; let itemAndChildrenToSendToPlayer: IItem[][] = [];
// Reward is weapon/armor preset, handle differently compared to 'normal' items // Reward is weapon/armor preset, handle differently compared to 'normal' items
const rewardIsPreset = this.presetHelper.hasPreset(recipe.endProduct); const rewardIsPreset = this.presetHelper.hasPreset(recipe.endProduct);
@ -886,7 +886,7 @@ export class HideoutController {
const defaultPreset = this.presetHelper.getDefaultPreset(recipe.endProduct); const defaultPreset = this.presetHelper.getDefaultPreset(recipe.endProduct);
// Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
@ -897,7 +897,7 @@ export class HideoutController {
const rewardIsStackable = this.itemHelper.isItemTplStackable(recipe.endProduct); const rewardIsStackable = this.itemHelper.isItemTplStackable(recipe.endProduct);
if (rewardIsStackable) { if (rewardIsStackable) {
// Create root item // Create root item
const rewardToAdd: Item = { const rewardToAdd: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: recipe.endProduct, _tpl: recipe.endProduct,
upd: { StackObjectsCount: recipe.count }, upd: { StackObjectsCount: recipe.count },
@ -918,7 +918,7 @@ export class HideoutController {
// Start index at one so we ignore first item in array // Start index at one so we ignore first item in array
const countOfItemsToReward = recipe.count; const countOfItemsToReward = recipe.count;
for (let index = 1; index < countOfItemsToReward; index++) { for (let index = 1; index < countOfItemsToReward; index++) {
const itemAndMods: Item[] = this.itemHelper.replaceIDs(itemAndChildrenToSendToPlayer[0]); const itemAndMods: IItem[] = this.itemHelper.replaceIDs(itemAndChildrenToSendToPlayer[0]);
itemAndChildrenToSendToPlayer.push(...[itemAndMods]); itemAndChildrenToSendToPlayer.push(...[itemAndMods]);
} }
} }
@ -933,7 +933,7 @@ export class HideoutController {
} }
// Build an array of the tools that need to be returned to the player // Build an array of the tools that need to be returned to the player
const toolsToSendToPlayer: Item[][] = []; const toolsToSendToPlayer: IItem[][] = [];
const production = pmcData.Hideout.Production[prodId]; const production = pmcData.Hideout.Production[prodId];
if (production.sptRequiredTools?.length > 0) { if (production.sptRequiredTools?.length > 0) {
for (const tool of production.sptRequiredTools) { for (const tool of production.sptRequiredTools) {

View File

@ -4,7 +4,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IGetInsuranceCostRequestData } from "@spt/models/eft/insurance/IGetInsuranceCostRequestData"; import { IGetInsuranceCostRequestData } from "@spt/models/eft/insurance/IGetInsuranceCostRequestData";
import { IGetInsuranceCostResponseData } from "@spt/models/eft/insurance/IGetInsuranceCostResponseData"; import { IGetInsuranceCostResponseData } from "@spt/models/eft/insurance/IGetInsuranceCostResponseData";
import { IInsureRequestData } from "@spt/models/eft/insurance/IInsureRequestData"; import { IInsureRequestData } from "@spt/models/eft/insurance/IInsureRequestData";
@ -232,9 +232,9 @@ export class InsuranceController {
protected populateParentAttachmentsMap( protected populateParentAttachmentsMap(
rootItemParentID: string, rootItemParentID: string,
insured: Insurance, insured: Insurance,
itemsMap: Map<string, Item>, itemsMap: Map<string, IItem>,
): Map<string, Item[]> { ): Map<string, IItem[]> {
const mainParentToAttachmentsMap = new Map<string, Item[]>(); const mainParentToAttachmentsMap = new Map<string, IItem[]>();
for (const insuredItem of insured.items) { for (const insuredItem of insured.items) {
// Use the parent ID from the item to get the parent item. // Use the parent ID from the item to get the parent item.
const parentItem = insured.items.find((item) => item._id === insuredItem.parentId); const parentItem = insured.items.find((item) => item._id === insuredItem.parentId);
@ -301,14 +301,14 @@ export class InsuranceController {
* @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid.
*/ */
protected removeNonModdableAttachments( protected removeNonModdableAttachments(
parentAttachmentsMap: Map<string, Item[]>, parentAttachmentsMap: Map<string, IItem[]>,
itemsMap: Map<string, Item>, itemsMap: Map<string, IItem>,
): Map<string, Item[]> { ): Map<string, IItem[]> {
const updatedMap = new Map<string, Item[]>(); const updatedMap = new Map<string, IItem[]>();
for (const [parentId, attachmentItems] of parentAttachmentsMap) { for (const [parentId, attachmentItems] of parentAttachmentsMap) {
const parentItem = itemsMap.get(parentId); const parentItem = itemsMap.get(parentId);
const moddableAttachments: Item[] = []; const moddableAttachments: IItem[] = [];
for (const attachment of attachmentItems) { for (const attachment of attachmentItems) {
// By default, assume the parent of the current attachment is the main-parent included in the map. // By default, assume the parent of the current attachment is the main-parent included in the map.
let attachmentParentItem = parentItem; let attachmentParentItem = parentItem;
@ -350,7 +350,7 @@ export class InsuranceController {
protected processRegularItems( protected processRegularItems(
insured: Insurance, insured: Insurance,
toDelete: Set<string>, toDelete: Set<string>,
parentAttachmentsMap: Map<string, Item[]>, parentAttachmentsMap: Map<string, IItem[]>,
): void { ): void {
for (const insuredItem of insured.items) { for (const insuredItem of insured.items) {
// Skip if the item is an attachment. These are handled separately. // Skip if the item is an attachment. These are handled separately.
@ -393,8 +393,8 @@ export class InsuranceController {
* @param toDelete A Set object to keep track of items marked for deletion. * @param toDelete A Set object to keep track of items marked for deletion.
*/ */
protected processAttachments( protected processAttachments(
mainParentToAttachmentsMap: Map<string, Item[]>, mainParentToAttachmentsMap: Map<string, IItem[]>,
itemsMap: Map<string, Item>, itemsMap: Map<string, IItem>,
traderId: string, traderId: string,
toDelete: Set<string>, toDelete: Set<string>,
): void { ): void {
@ -426,7 +426,7 @@ export class InsuranceController {
* @param toDelete The array that accumulates the IDs of the items to be deleted. * @param toDelete The array that accumulates the IDs of the items to be deleted.
* @returns void * @returns void
*/ */
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void { protected processAttachmentByParent(attachments: IItem[], traderId: string, toDelete: Set<string>): void {
// Create dict of item ids + their flea/handbook price (highest is chosen) // Create dict of item ids + their flea/handbook price (highest is chosen)
const weightedAttachmentByPrice = this.weightAttachmentsByPrice(attachments); const weightedAttachmentByPrice = this.weightAttachmentsByPrice(attachments);
@ -454,7 +454,7 @@ export class InsuranceController {
protected logAttachmentsBeingRemoved( protected logAttachmentsBeingRemoved(
attachmentIdsToRemove: string[], attachmentIdsToRemove: string[],
attachments: Item[], attachments: IItem[],
attachmentPrices: Record<string, number>, attachmentPrices: Record<string, number>,
): void { ): void {
let index = 1; let index = 1;
@ -468,7 +468,7 @@ export class InsuranceController {
} }
} }
protected weightAttachmentsByPrice(attachments: Item[]): Record<string, number> { protected weightAttachmentsByPrice(attachments: IItem[]): Record<string, number> {
const result: Record<string, number> = {}; const result: Record<string, number> = {};
// Get a dictionary of item tpls + their rouble price // Get a dictionary of item tpls + their rouble price
@ -573,7 +573,7 @@ export class InsuranceController {
* @param insuredItem Optional. The item to roll for. Only used for logging. * @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 undefined on error. * @returns true if the insured item should be removed from inventory, false otherwise, or undefined on error.
*/ */
protected rollForDelete(traderId: string, insuredItem?: Item): boolean | undefined { protected rollForDelete(traderId: string, insuredItem?: IItem): boolean | undefined {
const trader = this.traderHelper.getTraderById(traderId); const trader = this.traderHelper.getTraderById(traderId);
if (!trader) { if (!trader) {
return undefined; return undefined;
@ -664,11 +664,11 @@ export class InsuranceController {
* @param pmcData Player profile * @param pmcData Player profile
* @param body Insurance request data * @param body Insurance request data
*/ */
public insureSoftInserts(item: Item, pmcData: IPmcData, body: IInsureRequestData): void { public insureSoftInserts(item: IItem, pmcData: IPmcData, body: IInsureRequestData): void {
const softInsertIds = this.itemHelper.getSoftInsertSlotIds(); const softInsertIds = this.itemHelper.getSoftInsertSlotIds();
const softInsertSlots = pmcData.Inventory.items.filter( const softInsertSlots = pmcData.Inventory.items.filter(
(_item) => _item.parentId === item._id && softInsertIds.includes(_item.slotId.toLowerCase()) (_item) => _item.parentId === item._id && softInsertIds.includes(_item.slotId.toLowerCase()),
); );
for (const softInsertSlot of softInsertSlots) { for (const softInsertSlot of softInsertSlots) {
this.logger.debug(`SoftInsertSlots: ${softInsertSlot.slotId}`); this.logger.debug(`SoftInsertSlots: ${softInsertSlot.slotId}`);
@ -687,7 +687,7 @@ export class InsuranceController {
public cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData { public cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData {
const response: IGetInsuranceCostResponseData = {}; const response: IGetInsuranceCostResponseData = {};
const pmcData = this.profileHelper.getPmcProfile(sessionID); const pmcData = this.profileHelper.getPmcProfile(sessionID);
const inventoryItemsHash: Record<string, Item> = {}; const inventoryItemsHash: Record<string, IItem> = {};
for (const item of pmcData.Inventory.items) { for (const item of pmcData.Inventory.items) {
inventoryItemsHash[item._id] = item; inventoryItemsHash[item._id] = item;
@ -718,7 +718,7 @@ export class InsuranceController {
} }
// Represents an insurance item that has had it's common locale-name and value added to it. // Represents an insurance item that has had it's common locale-name and value added to it.
interface EnrichedItem extends Item { interface EnrichedItem extends IItem {
name: string; name: string;
dynamicPrice: number; dynamicPrice: number;
} }

View File

@ -8,7 +8,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { QuestHelper } from "@spt/helpers/QuestHelper"; import { QuestHelper } from "@spt/helpers/QuestHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest"; import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest";
import { IInventoryBindRequestData } from "@spt/models/eft/inventory/IInventoryBindRequestData"; import { IInventoryBindRequestData } from "@spt/models/eft/inventory/IInventoryBindRequestData";
import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData";
@ -803,7 +803,7 @@ export class InventoryController {
const isSealedWeaponBox = containerDetailsDb[1]._name.includes("event_container_airdrop"); const isSealedWeaponBox = containerDetailsDb[1]._name.includes("event_container_airdrop");
let foundInRaid = openedItem.upd?.SpawnedInSession; let foundInRaid = openedItem.upd?.SpawnedInSession;
const rewards: Item[][] = []; const rewards: IItem[][] = [];
const unlockedWeaponCrates = [ const unlockedWeaponCrates = [
"665829424de4820934746ce6", "665829424de4820934746ce6",
"665732e7ac60f009f270d1ef", "665732e7ac60f009f270d1ef",
@ -933,14 +933,13 @@ export class InventoryController {
for (const itemId of request.items) { for (const itemId of request.items) {
// If id already exists in array, we're removing it // If id already exists in array, we're removing it
const indexOfItemAlreadyFavorited = pmcData.Inventory.favoriteItems.findIndex(x => x._id === itemId); const indexOfItemAlreadyFavorited = pmcData.Inventory.favoriteItems.findIndex((x) => x._id === itemId);
if (indexOfItemAlreadyFavorited > -1) { if (indexOfItemAlreadyFavorited > -1) {
pmcData.Inventory.favoriteItems.splice(indexOfItemAlreadyFavorited, 1); pmcData.Inventory.favoriteItems.splice(indexOfItemAlreadyFavorited, 1);
} else { } else {
let item = pmcData.Inventory.items.find(i => i._id === itemId); const item = pmcData.Inventory.items.find((i) => i._id === itemId);
if (item === undefined) if (item === undefined) {
{
continue; continue;
} }

View File

@ -8,7 +8,7 @@ import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { ITemplateSide } from "@spt/models/eft/common/tables/IProfileTemplate"; import { ITemplateSide } from "@spt/models/eft/common/tables/IProfileTemplate";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IMiniProfile } from "@spt/models/eft/launcher/IMiniProfile"; import { IMiniProfile } from "@spt/models/eft/launcher/IMiniProfile";
import { GetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData"; import { IGetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData";
import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest"; import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse"; import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
import { IGetProfileSettingsRequest } from "@spt/models/eft/profile/IGetProfileSettingsRequest"; import { IGetProfileSettingsRequest } from "@spt/models/eft/profile/IGetProfileSettingsRequest";
@ -386,9 +386,9 @@ export class ProfileController {
/** /**
* Handle client/profile/status * Handle client/profile/status
*/ */
public getProfileStatus(sessionId: string): GetProfileStatusResponseData { public getProfileStatus(sessionId: string): IGetProfileStatusResponseData {
const account = this.saveServer.getProfile(sessionId).info; const account = this.saveServer.getProfile(sessionId).info;
const response: GetProfileStatusResponseData = { const response: IGetProfileStatusResponseData = {
maxPveCountExceeded: false, maxPveCountExceeded: false,
profiles: [ profiles: [
{ profileid: account.scavId, profileToken: undefined, status: "Free", sid: "", ip: "", port: 0 }, { profileid: account.scavId, profileToken: undefined, status: "Free", sid: "", ip: "", port: 0 },

View File

@ -6,7 +6,7 @@ import { QuestHelper } from "@spt/helpers/QuestHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IQuestStatus } from "@spt/models/eft/common/tables/IBotBase"; import { IQuestStatus } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IQuest, IQuestCondition } from "@spt/models/eft/common/tables/IQuest"; import { IQuest, IQuestCondition } from "@spt/models/eft/common/tables/IQuest";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
@ -594,7 +594,7 @@ export class QuestController {
sessionID: string, sessionID: string,
pmcData: IPmcData, pmcData: IPmcData,
completedQuestId: string, completedQuestId: string,
questRewards: Item[], questRewards: IItem[],
): void { ): void {
const quest = this.questHelper.getQuestFromDb(completedQuestId, pmcData); const quest = this.questHelper.getQuestFromDb(completedQuestId, pmcData);
@ -855,7 +855,7 @@ export class QuestController {
*/ */
protected showQuestItemHandoverMatchError( protected showQuestItemHandoverMatchError(
handoverQuestRequest: IHandoverQuestRequestData, handoverQuestRequest: IHandoverQuestRequestData,
itemHandedOver: Item, itemHandedOver: IItem,
handoverRequirements: IQuestCondition, handoverRequirements: IQuestCondition,
output: IItemEventRouterResponse, output: IItemEventRouterResponse,
): IItemEventRouterResponse { ): IItemEventRouterResponse {

View File

@ -10,7 +10,7 @@ import { RagfairSellHelper } from "@spt/helpers/RagfairSellHelper";
import { RagfairSortHelper } from "@spt/helpers/RagfairSortHelper"; import { RagfairSortHelper } from "@spt/helpers/RagfairSortHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IBarterScheme, ITraderAssort } from "@spt/models/eft/common/tables/ITrader"; import { IBarterScheme, ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile"; import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
@ -728,7 +728,7 @@ export class RagfairController {
*/ */
protected chargePlayerTaxFee( protected chargePlayerTaxFee(
sessionID: string, sessionID: string,
rootItem: Item, rootItem: IItem,
pmcData: IPmcData, pmcData: IPmcData,
requirementsPriceInRub: number, requirementsPriceInRub: number,
itemStackCount: number, itemStackCount: number,
@ -817,8 +817,8 @@ export class RagfairController {
protected getItemsToListOnFleaFromInventory( protected getItemsToListOnFleaFromInventory(
pmcData: IPmcData, pmcData: IPmcData,
itemIdsFromFleaOfferRequest: string[], itemIdsFromFleaOfferRequest: string[],
): { items: Item[][] | undefined; errorMessage: string | undefined } { ): { items: IItem[][] | undefined; errorMessage: string | undefined } {
const itemsToReturn: Item[][] = []; const itemsToReturn: IItem[][] = [];
let errorMessage: string | undefined = undefined; let errorMessage: string | undefined = undefined;
// Count how many items are being sold and multiply the requested amount accordingly // Count how many items are being sold and multiply the requested amount accordingly
@ -850,11 +850,11 @@ export class RagfairController {
public createPlayerOffer( public createPlayerOffer(
sessionId: string, sessionId: string,
requirements: Requirement[], requirements: Requirement[],
items: Item[], items: IItem[],
sellInOnePiece: boolean, sellInOnePiece: boolean,
): IRagfairOffer { ): IRagfairOffer {
const loyalLevel = 1; const loyalLevel = 1;
const formattedItems: Item[] = items.map((item) => { const formattedItems: IItem[] = items.map((item) => {
const isChild = items.some((subItem) => subItem._id === item.parentId); const isChild = items.some((subItem) => subItem._id === item.parentId);
return { return {

View File

@ -4,7 +4,7 @@ import { RagfairOfferHelper } from "@spt/helpers/RagfairOfferHelper";
import { TradeHelper } from "@spt/helpers/TradeHelper"; import { TradeHelper } from "@spt/helpers/TradeHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITraderBase } from "@spt/models/eft/common/tables/ITrader"; import { ITraderBase } from "@spt/models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
@ -313,7 +313,7 @@ export class TradeController {
*/ */
protected getPriceOfItemAndChildren( protected getPriceOfItemAndChildren(
parentItemId: string, parentItemId: string,
items: Item[], items: IItem[],
handbookPrices: Record<string, number>, handbookPrices: Record<string, number>,
traderDetails: ITraderBase, traderDetails: ITraderBase,
): number { ): number {

View File

@ -8,9 +8,9 @@ import { ProbabilityHelper } from "@spt/helpers/ProbabilityHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IPreset } from "@spt/models/eft/common/IGlobals"; import { IPreset } from "@spt/models/eft/common/IGlobals";
import { Mods, ModsChances } from "@spt/models/eft/common/tables/IBotType"; import { IMods, IModsChances } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem, Slot } from "@spt/models/eft/common/tables/ITemplateItem"; import { ISlot, ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ModSpawn } from "@spt/models/enums/ModSpawn"; import { ModSpawn } from "@spt/models/enums/ModSpawn";
@ -75,12 +75,12 @@ export class BotEquipmentModGenerator {
* @returns Item + compatible mods as an array * @returns Item + compatible mods as an array
*/ */
public generateModsForEquipment( public generateModsForEquipment(
equipment: Item[], equipment: IItem[],
parentId: string, parentId: string,
parentTemplate: ITemplateItem, parentTemplate: ITemplateItem,
settings: IGenerateEquipmentProperties, settings: IGenerateEquipmentProperties,
shouldForceSpawn = false, shouldForceSpawn = false,
): Item[] { ): IItem[] {
let forceSpawn = shouldForceSpawn; let forceSpawn = shouldForceSpawn;
const compatibleModsPool = settings.modPool[parentTemplate._id]; const compatibleModsPool = settings.modPool[parentTemplate._id];
@ -310,7 +310,7 @@ export class BotEquipmentModGenerator {
* @param request Data used to generate the weapon * @param request Data used to generate the weapon
* @returns Weapon + mods array * @returns Weapon + mods array
*/ */
public generateModsForWeapon(sessionId: string, request: IGenerateWeaponRequest): Item[] { public generateModsForWeapon(sessionId: string, request: IGenerateWeaponRequest): IItem[] {
const pmcProfile = this.profileHelper.getPmcProfile(sessionId); const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
// Get pool of mods that fit weapon // Get pool of mods that fit weapon
@ -603,7 +603,7 @@ export class BotEquipmentModGenerator {
* @param modSpawnChances Chance dictionary to update * @param modSpawnChances Chance dictionary to update
*/ */
protected adjustSlotSpawnChances( protected adjustSlotSpawnChances(
modSpawnChances: ModsChances, modSpawnChances: IModsChances,
modSlotsToAdjust: string[], modSlotsToAdjust: string[],
newChancePercent: number, newChancePercent: number,
): void { ): void {
@ -710,7 +710,7 @@ export class BotEquipmentModGenerator {
* @param parentTemplate item template * @param parentTemplate item template
* @returns Slot item * @returns Slot item
*/ */
protected getModItemSlotFromDb(modSlot: string, parentTemplate: ITemplateItem): Slot { protected getModItemSlotFromDb(modSlot: string, parentTemplate: ITemplateItem): ISlot {
const modSlotLower = modSlot.toLowerCase(); const modSlotLower = modSlot.toLowerCase();
switch (modSlotLower) { switch (modSlotLower) {
case "patron_in_weapon": case "patron_in_weapon":
@ -733,9 +733,9 @@ export class BotEquipmentModGenerator {
* @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped * @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped
*/ */
protected shouldModBeSpawned( protected shouldModBeSpawned(
itemSlot: Slot, itemSlot: ISlot,
modSlot: string, modSlot: string,
modSpawnChances: ModsChances, modSpawnChances: IModsChances,
botEquipConfig: EquipmentFilters, botEquipConfig: EquipmentFilters,
): ModSpawn { ): ModSpawn {
const slotRequired = itemSlot._required; const slotRequired = itemSlot._required;
@ -860,9 +860,9 @@ export class BotEquipmentModGenerator {
protected getCompatibleWeaponModTplForSlotFromPool( protected getCompatibleWeaponModTplForSlotFromPool(
request: IModToSpawnRequest, request: IModToSpawnRequest,
modPool: string[], modPool: string[],
parentSlot: Slot, parentSlot: ISlot,
choiceTypeEnum: ModSpawn, choiceTypeEnum: ModSpawn,
weapon: Item[], weapon: IItem[],
modSlotName: string, modSlotName: string,
): IChooseRandomCompatibleModResult { ): IChooseRandomCompatibleModResult {
// Filter out incompatible mods from pool // Filter out incompatible mods from pool
@ -895,7 +895,7 @@ export class BotEquipmentModGenerator {
protected getCompatibleModFromPool( protected getCompatibleModFromPool(
modPool: string[], modPool: string[],
modSpawnType: ModSpawn, modSpawnType: ModSpawn,
weapon: Item[], weapon: IItem[],
): IChooseRandomCompatibleModResult { ): IChooseRandomCompatibleModResult {
// Create exhaustable pool to pick mod item from // Create exhaustable pool to pick mod item from
const exhaustableModPool = this.createExhaustableArray(modPool); const exhaustableModPool = this.createExhaustableArray(modPool);
@ -1103,7 +1103,7 @@ export class BotEquipmentModGenerator {
* @param modTpl Mod to check compatibility with weapon * @param modTpl Mod to check compatibility with weapon
* @returns True if incompatible * @returns True if incompatible
*/ */
protected weaponModComboIsIncompatible(weapon: Item[], modTpl: string): boolean { protected weaponModComboIsIncompatible(weapon: IItem[], modTpl: string): boolean {
// STM-9 + AR-15 Lone Star Ion Lite handguard // STM-9 + AR-15 Lone Star Ion Lite handguard
if (weapon[0]._tpl === "60339954d62c9b14ed777c06" && modTpl === "5d4405f0a4b9361e6a4e6bd9") { if (weapon[0]._tpl === "60339954d62c9b14ed777c06" && modTpl === "5d4405f0a4b9361e6a4e6bd9") {
return true; return true;
@ -1129,7 +1129,7 @@ export class BotEquipmentModGenerator {
modSlot: string, modSlot: string,
modTemplate: ITemplateItem, modTemplate: ITemplateItem,
botRole: string, botRole: string,
): Item { ): IItem {
return { return {
_id: modId, _id: modId,
_tpl: modTpl, _tpl: modTpl,
@ -1158,9 +1158,9 @@ export class BotEquipmentModGenerator {
*/ */
protected getRandomModTplFromItemDb( protected getRandomModTplFromItemDb(
fallbackModTpl: string, fallbackModTpl: string,
parentSlot: Slot, parentSlot: ISlot,
modSlot: string, modSlot: string,
items: Item[], items: IItem[],
): string | undefined { ): string | undefined {
// Find compatible mods and make an array of them // Find compatible mods and make an array of them
const allowedItems = parentSlot._props.filters[0].Filter; const allowedItems = parentSlot._props.filters[0].Filter;
@ -1190,7 +1190,7 @@ export class BotEquipmentModGenerator {
*/ */
protected isModValidForSlot( protected isModValidForSlot(
modToAdd: [boolean, ITemplateItem], modToAdd: [boolean, ITemplateItem],
slotAddedToTemplate: Slot, slotAddedToTemplate: ISlot,
modSlot: string, modSlot: string,
parentTemplate: ITemplateItem, parentTemplate: ITemplateItem,
botRole: string, botRole: string,
@ -1241,7 +1241,7 @@ export class BotEquipmentModGenerator {
protected addCompatibleModsForProvidedMod( protected addCompatibleModsForProvidedMod(
desiredSlotName: string, desiredSlotName: string,
modTemplate: ITemplateItem, modTemplate: ITemplateItem,
modPool: Mods, modPool: IMods,
botEquipBlacklist: EquipmentFilterDetails, botEquipBlacklist: EquipmentFilterDetails,
): void { ): void {
const desiredSlotObject = modTemplate._props.Slots?.find((slot) => slot._name.includes(desiredSlotName)); const desiredSlotObject = modTemplate._props.Slots?.find((slot) => slot._name.includes(desiredSlotName));
@ -1339,8 +1339,8 @@ export class BotEquipmentModGenerator {
* @param cylinderMagTemplate The CylinderMagazine's template * @param cylinderMagTemplate The CylinderMagazine's template
*/ */
protected fillCamora( protected fillCamora(
items: Item[], items: IItem[],
modPool: Mods, modPool: IMods,
cylinderMagParentId: string, cylinderMagParentId: string,
cylinderMagTemplate: ITemplateItem, cylinderMagTemplate: ITemplateItem,
): void { ): void {
@ -1426,7 +1426,7 @@ export class BotEquipmentModGenerator {
* @returns Array of scope tpls that have been filtered to just ones allowed for that weapon type * @returns Array of scope tpls that have been filtered to just ones allowed for that weapon type
*/ */
protected filterSightsByWeaponType( protected filterSightsByWeaponType(
weapon: Item, weapon: IItem,
scopes: string[], scopes: string[],
botWeaponSightWhitelist: Record<string, string[]>, botWeaponSightWhitelist: Record<string, string[]>,
): string[] { ): string[] {

View File

@ -13,8 +13,8 @@ import {
IHealth as PmcHealth, IHealth as PmcHealth,
ISkills as botSkills, ISkills as botSkills,
} from "@spt/models/eft/common/tables/IBotBase"; } from "@spt/models/eft/common/tables/IBotBase";
import { Appearance, BodyPart, Health, IBotType, Inventory } from "@spt/models/eft/common/tables/IBotType"; import { IAppearance, IBodyPart, IBotType, IHealth, IInventory } from "@spt/models/eft/common/tables/IBotType";
import { Item, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpd } from "@spt/models/eft/common/tables/IItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { GameEditions } from "@spt/models/enums/GameEditions"; import { GameEditions } from "@spt/models/enums/GameEditions";
import { ItemTpl } from "@spt/models/enums/ItemTpl"; import { ItemTpl } from "@spt/models/enums/ItemTpl";
@ -253,7 +253,7 @@ export class BotGenerator {
* Remove items from item.json/lootableItemBlacklist from bots inventory * Remove items from item.json/lootableItemBlacklist from bots inventory
* @param botInventory Bot to filter * @param botInventory Bot to filter
*/ */
protected removeBlacklistedLootFromBotTemplate(botInventory: Inventory): void { protected removeBlacklistedLootFromBotTemplate(botInventory: IInventory): void {
const lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"]; const lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"];
// Remove blacklisted loot from loot containers // Remove blacklisted loot from loot containers
@ -285,7 +285,7 @@ export class BotGenerator {
*/ */
protected setBotAppearance( protected setBotAppearance(
bot: IBotBase, bot: IBotBase,
appearance: Appearance, appearance: IAppearance,
botGenerationDetails: BotGenerationDetails, botGenerationDetails: BotGenerationDetails,
): void { ): void {
bot.Customization.Head = this.weightedRandomHelper.getWeightedValue<string>(appearance.head); bot.Customization.Head = this.weightedRandomHelper.getWeightedValue<string>(appearance.head);
@ -321,7 +321,7 @@ export class BotGenerator {
* @param playerScav Is a pscav bot being generated * @param playerScav Is a pscav bot being generated
* @returns PmcHealth object * @returns PmcHealth object
*/ */
protected generateHealth(healthObj: Health, playerScav = false): PmcHealth { protected generateHealth(healthObj: IHealth, playerScav = false): PmcHealth {
const bodyParts = playerScav const bodyParts = playerScav
? this.getLowestHpBody(healthObj.BodyParts) ? this.getLowestHpBody(healthObj.BodyParts)
: this.randomUtil.getArrayValue(healthObj.BodyParts); : this.randomUtil.getArrayValue(healthObj.BodyParts);
@ -394,13 +394,13 @@ export class BotGenerator {
* @param bodies Body parts to sum up * @param bodies Body parts to sum up
* @returns Lowest hp collection * @returns Lowest hp collection
*/ */
protected getLowestHpBody(bodies: BodyPart[]): BodyPart | undefined { protected getLowestHpBody(bodies: IBodyPart[]): IBodyPart | undefined {
if (bodies.length === 0) { if (bodies.length === 0) {
// Handle empty input // Handle empty input
return undefined; return undefined;
} }
let result: BodyPart; let result: IBodyPart;
let currentHighest = Number.POSITIVE_INFINITY; let currentHighest = Number.POSITIVE_INFINITY;
for (const bodyParts of bodies) { for (const bodyParts of bodies) {
const hpTotal = Object.values(bodyParts).reduce((acc, curr) => acc + curr.max, 0); const hpTotal = Object.values(bodyParts).reduce((acc, curr) => acc + curr.max, 0);
@ -556,7 +556,7 @@ export class BotGenerator {
* @returns Bot with dogtag added * @returns Bot with dogtag added
*/ */
protected addDogtagToBot(bot: IBotBase): void { protected addDogtagToBot(bot: IBotBase): void {
const dogtagUpd: Upd = { const dogtagUpd: IUpd = {
SpawnedInSession: true, SpawnedInSession: true,
Dogtag: { Dogtag: {
AccountId: bot.sessionId, AccountId: bot.sessionId,
@ -573,7 +573,7 @@ export class BotGenerator {
}, },
}; };
const inventoryItem: Item = { const inventoryItem: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: this.getDogtagTplByGameVersionAndSide(bot.Info.Side, bot.Info.GameVersion), _tpl: this.getDogtagTplByGameVersionAndSide(bot.Info.Side, bot.Info.GameVersion),
parentId: bot.Inventory.equipment, parentId: bot.Inventory.equipment,

View File

@ -6,7 +6,7 @@ import { BotHelper } from "@spt/helpers/BotHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
import { Chances, Equipment, Generation, IBotType, Inventory } from "@spt/models/eft/common/tables/IBotType"; import { IBotType, IChances, IEquipment, IGeneration, IInventory } from "@spt/models/eft/common/tables/IBotType";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots"; import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -138,8 +138,8 @@ export class BotInventoryGenerator {
* @param chosenGameVersion Game version for bot, only really applies for PMCs * @param chosenGameVersion Game version for bot, only really applies for PMCs
*/ */
protected generateAndAddEquipmentToBot( protected generateAndAddEquipmentToBot(
templateInventory: Inventory, templateInventory: IInventory,
wornItemChances: Chances, wornItemChances: IChances,
botRole: string, botRole: string,
botInventory: PmcInventory, botInventory: PmcInventory,
botLevel: number, botLevel: number,
@ -275,7 +275,7 @@ export class BotInventoryGenerator {
* @param templateEquipment Equpiment to filter TacticalVest of * @param templateEquipment Equpiment to filter TacticalVest of
* @param botRole Role of bot vests are being filtered for * @param botRole Role of bot vests are being filtered for
*/ */
protected filterRigsToThoseWithProtection(templateEquipment: Equipment, botRole: string): void { protected filterRigsToThoseWithProtection(templateEquipment: IEquipment, botRole: string): void {
const tacVestsWithArmor = Object.entries(templateEquipment.TacticalVest).reduce( const tacVestsWithArmor = Object.entries(templateEquipment.TacticalVest).reduce(
(newVestDictionary, [tplKey]) => { (newVestDictionary, [tplKey]) => {
if (this.itemHelper.itemHasSlots(tplKey)) { if (this.itemHelper.itemHasSlots(tplKey)) {
@ -302,7 +302,7 @@ export class BotInventoryGenerator {
* @param allowEmptyResult Should the function return all rigs when 0 unarmored are found * @param allowEmptyResult Should the function return all rigs when 0 unarmored are found
*/ */
protected filterRigsToThoseWithoutProtection( protected filterRigsToThoseWithoutProtection(
templateEquipment: Equipment, templateEquipment: IEquipment,
botRole: string, botRole: string,
allowEmptyResult = true, allowEmptyResult = true,
): void { ): void {
@ -475,13 +475,13 @@ export class BotInventoryGenerator {
* @param botLevel level of bot having weapon generated * @param botLevel level of bot having weapon generated
*/ */
protected generateAndAddWeaponsToBot( protected generateAndAddWeaponsToBot(
templateInventory: Inventory, templateInventory: IInventory,
equipmentChances: Chances, equipmentChances: IChances,
sessionId: string, sessionId: string,
botInventory: PmcInventory, botInventory: PmcInventory,
botRole: string, botRole: string,
isPmc: boolean, isPmc: boolean,
itemGenerationLimitsMinMax: Generation, itemGenerationLimitsMinMax: IGeneration,
botLevel: number, botLevel: number,
): void { ): void {
const weaponSlotsToFill = this.getDesiredWeaponsForBot(equipmentChances); const weaponSlotsToFill = this.getDesiredWeaponsForBot(equipmentChances);
@ -508,7 +508,7 @@ export class BotInventoryGenerator {
* @param equipmentChances Chances bot has certain equipment * @param equipmentChances Chances bot has certain equipment
* @returns What slots bot should have weapons generated for * @returns What slots bot should have weapons generated for
*/ */
protected getDesiredWeaponsForBot(equipmentChances: Chances): { slot: EquipmentSlots; shouldSpawn: boolean }[] { protected getDesiredWeaponsForBot(equipmentChances: IChances): { slot: EquipmentSlots; shouldSpawn: boolean }[] {
const shouldSpawnPrimary = this.randomUtil.getChance100(equipmentChances.equipment.FirstPrimaryWeapon); const shouldSpawnPrimary = this.randomUtil.getChance100(equipmentChances.equipment.FirstPrimaryWeapon);
return [ return [
{ slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary }, { slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary },
@ -541,12 +541,12 @@ export class BotInventoryGenerator {
protected addWeaponAndMagazinesToInventory( protected addWeaponAndMagazinesToInventory(
sessionId: string, sessionId: string,
weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean }, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean },
templateInventory: Inventory, templateInventory: IInventory,
botInventory: PmcInventory, botInventory: PmcInventory,
equipmentChances: Chances, equipmentChances: IChances,
botRole: string, botRole: string,
isPmc: boolean, isPmc: boolean,
itemGenerationWeights: Generation, itemGenerationWeights: IGeneration,
botLevel: number, botLevel: number,
): void { ): void {
const generatedWeapon = this.botWeaponGenerator.generateRandomWeapon( const generatedWeapon = this.botWeaponGenerator.generateRandomWeapon(

View File

@ -6,8 +6,8 @@ import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
import { IBotType, Inventory, ModsChances } from "@spt/models/eft/common/tables/IBotType"; import { IBotType, IInventory, IModsChances } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -457,7 +457,7 @@ export class BotLootGenerator {
} }
const newRootItemId = this.hashUtil.generate(); const newRootItemId = this.hashUtil.generate();
const itemWithChildrenToAdd: Item[] = [ const itemWithChildrenToAdd: IItem[] = [
{ {
_id: newRootItemId, _id: newRootItemId,
_tpl: itemToAddTemplate._id, _tpl: itemToAddTemplate._id,
@ -549,8 +549,8 @@ export class BotLootGenerator {
} }
} }
protected createWalletLoot(walletId: string): Item[][] { protected createWalletLoot(walletId: string): IItem[][] {
const result: Item[][] = []; const result: IItem[][] = [];
// Choose how many stacks of currency will be added to wallet // Choose how many stacks of currency will be added to wallet
const itemCount = this.randomUtil.getInt( const itemCount = this.randomUtil.getInt(
@ -584,7 +584,7 @@ export class BotLootGenerator {
*/ */
protected addRequiredChildItemsToParent( protected addRequiredChildItemsToParent(
itemToAddTemplate: ITemplateItem, itemToAddTemplate: ITemplateItem,
itemToAddChildrenTo: Item[], itemToAddChildrenTo: IItem[],
isPmc: boolean, isPmc: boolean,
botRole: string, botRole: string,
): void { ): void {
@ -619,8 +619,8 @@ export class BotLootGenerator {
sessionId: string, sessionId: string,
botInventory: PmcInventory, botInventory: PmcInventory,
equipmentSlot: string, equipmentSlot: string,
templateInventory: Inventory, templateInventory: IInventory,
modChances: ModsChances, modChances: IModsChances,
botRole: string, botRole: string,
isPmc: boolean, isPmc: boolean,
botLevel: number, botLevel: number,
@ -739,7 +739,7 @@ export class BotLootGenerator {
* @param itemTemplate item details from db * @param itemTemplate item details from db
* @param moneyItem Money item to randomise * @param moneyItem Money item to randomise
*/ */
protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void { protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: IItem): void {
// Get all currency weights for this bot type // Get all currency weights for this bot type
let currencyWeights = this.botConfig.currencyStackSize[botRole]; let currencyWeights = this.botConfig.currencyStackSize[botRole];
if (!currencyWeights) { if (!currencyWeights) {
@ -759,7 +759,7 @@ export class BotLootGenerator {
* @param itemTemplate item details from db * @param itemTemplate item details from db
* @param ammoItem Ammo item to randomise * @param ammoItem Ammo item to randomise
*/ */
protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void { protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: IItem): void {
const randomSize = this.itemHelper.getRandomisedAmmoStackSize(itemTemplate); const randomSize = this.itemHelper.getRandomisedAmmoStackSize(itemTemplate);
this.itemHelper.addUpdObjectToItem(ammoItem); this.itemHelper.addUpdObjectToItem(ammoItem);

View File

@ -7,8 +7,8 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IPreset } from "@spt/models/eft/common/IGlobals"; import { IPreset } from "@spt/models/eft/common/IGlobals";
import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
import { GenerationData, Inventory, ModsChances } from "@spt/models/eft/common/tables/IBotType"; import { IGenerationData, IInventory, IModsChances } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots"; import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -71,9 +71,9 @@ export class BotWeaponGenerator {
public generateRandomWeapon( public generateRandomWeapon(
sessionId: string, sessionId: string,
equipmentSlot: string, equipmentSlot: string,
botTemplateInventory: Inventory, botTemplateInventory: IInventory,
weaponParentId: string, weaponParentId: string,
modChances: ModsChances, modChances: IModsChances,
botRole: string, botRole: string,
isPmc: boolean, isPmc: boolean,
botLevel: number, botLevel: number,
@ -98,7 +98,7 @@ export class BotWeaponGenerator {
* @param botTemplateInventory e.g. assault.json * @param botTemplateInventory e.g. assault.json
* @returns weapon tpl * @returns weapon tpl
*/ */
public pickWeightedWeaponTplFromPool(equipmentSlot: string, botTemplateInventory: Inventory): string { public pickWeightedWeaponTplFromPool(equipmentSlot: string, botTemplateInventory: IInventory): string {
const weaponPool = botTemplateInventory.equipment[equipmentSlot]; const weaponPool = botTemplateInventory.equipment[equipmentSlot];
return this.weightedRandomHelper.getWeightedValue<string>(weaponPool); return this.weightedRandomHelper.getWeightedValue<string>(weaponPool);
} }
@ -118,9 +118,9 @@ export class BotWeaponGenerator {
sessionId: string, sessionId: string,
weaponTpl: string, weaponTpl: string,
slotName: string, slotName: string,
botTemplateInventory: Inventory, botTemplateInventory: IInventory,
weaponParentId: string, weaponParentId: string,
modChances: ModsChances, modChances: IModsChances,
botRole: string, botRole: string,
isPmc: boolean, isPmc: boolean,
botLevel: number, botLevel: number,
@ -236,7 +236,7 @@ export class BotWeaponGenerator {
* @param ammoTpl Cartridge to add to weapon * @param ammoTpl Cartridge to add to weapon
* @param chamberSlotIds name of slots to create or add ammo to * @param chamberSlotIds name of slots to create or add ammo to
*/ */
protected addCartridgeToChamber(weaponWithModsArray: Item[], ammoTpl: string, chamberSlotIds: string[]): void { protected addCartridgeToChamber(weaponWithModsArray: IItem[], ammoTpl: string, chamberSlotIds: string[]): void {
for (const slotId of chamberSlotIds) { for (const slotId of chamberSlotIds) {
const existingItemWithSlot = weaponWithModsArray.find((x) => x.slotId === slotId); const existingItemWithSlot = weaponWithModsArray.find((x) => x.slotId === slotId);
if (!existingItemWithSlot) { if (!existingItemWithSlot) {
@ -272,7 +272,7 @@ export class BotWeaponGenerator {
equipmentSlot: string, equipmentSlot: string,
weaponItemTemplate: ITemplateItem, weaponItemTemplate: ITemplateItem,
botRole: string, botRole: string,
): Item[] { ): IItem[] {
return [ return [
{ {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
@ -297,7 +297,7 @@ export class BotWeaponGenerator {
weaponParentId: string, weaponParentId: string,
itemTemplate: ITemplateItem, itemTemplate: ITemplateItem,
botRole: string, botRole: string,
): Item[] { ): IItem[] {
// Invalid weapon generated, fallback to preset // Invalid weapon generated, fallback to preset
this.logger.warning( this.logger.warning(
this.localisationService.getText( this.localisationService.getText(
@ -340,7 +340,7 @@ export class BotWeaponGenerator {
* @param botRole role of bot weapon is for * @param botRole role of bot weapon is for
* @returns true if valid * @returns true if valid
*/ */
protected isWeaponValid(weaponItemArray: Item[], botRole: string): boolean { protected isWeaponValid(weaponItemArray: IItem[], botRole: string): boolean {
for (const mod of weaponItemArray) { for (const mod of weaponItemArray) {
const modTemplate = this.itemHelper.getItem(mod._tpl)[1]; const modTemplate = this.itemHelper.getItem(mod._tpl)[1];
if (!modTemplate._props.Slots?.length) { if (!modTemplate._props.Slots?.length) {
@ -381,7 +381,7 @@ export class BotWeaponGenerator {
*/ */
public addExtraMagazinesToInventory( public addExtraMagazinesToInventory(
generatedWeaponResult: GenerateWeaponResult, generatedWeaponResult: GenerateWeaponResult,
magWeights: GenerationData, magWeights: IGenerationData,
inventory: PmcInventory, inventory: PmcInventory,
botRole: string, botRole: string,
): void { ): void {
@ -437,7 +437,7 @@ export class BotWeaponGenerator {
* @param inventory bot inventory to add grenades to * @param inventory bot inventory to add grenades to
*/ */
protected addUbglGrenadesToBotInventory( protected addUbglGrenadesToBotInventory(
weaponMods: Item[], weaponMods: IItem[],
generatedWeaponResult: GenerateWeaponResult, generatedWeaponResult: GenerateWeaponResult,
inventory: PmcInventory, inventory: PmcInventory,
): void { ): void {
@ -446,7 +446,7 @@ export class BotWeaponGenerator {
const ubglDbTemplate = this.itemHelper.getItem(ubglMod._tpl)[1]; const ubglDbTemplate = this.itemHelper.getItem(ubglMod._tpl)[1];
// Define min/max of how many grenades bot will have // Define min/max of how many grenades bot will have
const ubglMinMax: GenerationData = { const ubglMinMax: IGenerationData = {
weights: { 1: 1, 2: 1 }, weights: { 1: 1, 2: 1 },
whitelist: {}, whitelist: {},
}; };
@ -503,7 +503,7 @@ export class BotWeaponGenerator {
* @returns magazine tpl string * @returns magazine tpl string
*/ */
protected getMagazineTplFromWeaponTemplate( protected getMagazineTplFromWeaponTemplate(
weaponMods: Item[], weaponMods: IItem[],
weaponTemplate: ITemplateItem, weaponTemplate: ITemplateItem,
botRole: string, botRole: string,
): string { ): string {
@ -643,7 +643,7 @@ export class BotWeaponGenerator {
* @param magazine Magazine item * @param magazine Magazine item
* @param cartridgeTpl Cartridge to insert into magazine * @param cartridgeTpl Cartridge to insert into magazine
*/ */
protected fillExistingMagazines(weaponMods: Item[], magazine: Item, cartridgeTpl: string): void { protected fillExistingMagazines(weaponMods: IItem[], magazine: IItem, cartridgeTpl: string): void {
const magazineTemplate = this.itemHelper.getItem(magazine._tpl)[1]; const magazineTemplate = this.itemHelper.getItem(magazine._tpl)[1];
if (!magazineTemplate) { if (!magazineTemplate) {
this.logger.error(this.localisationService.getText("bot-unable_to_find_magazine_item", magazine._tpl)); this.logger.error(this.localisationService.getText("bot-unable_to_find_magazine_item", magazine._tpl));
@ -669,7 +669,7 @@ export class BotWeaponGenerator {
* @param ubglMod UBGL item * @param ubglMod UBGL item
* @param ubglAmmoTpl Grenade ammo tpl * @param ubglAmmoTpl Grenade ammo tpl
*/ */
protected fillUbgl(weaponMods: Item[], ubglMod: Item, ubglAmmoTpl: string): void { protected fillUbgl(weaponMods: IItem[], ubglMod: IItem, ubglAmmoTpl: string): void {
weaponMods.push({ weaponMods.push({
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: ubglAmmoTpl, _tpl: ubglAmmoTpl,
@ -688,8 +688,8 @@ export class BotWeaponGenerator {
* @param magazineTemplate magazines db template * @param magazineTemplate magazines db template
*/ */
protected addOrUpdateMagazinesChildWithAmmo( protected addOrUpdateMagazinesChildWithAmmo(
weaponWithMods: Item[], weaponWithMods: IItem[],
magazine: Item, magazine: IItem,
chosenAmmoTpl: string, chosenAmmoTpl: string,
magazineTemplate: ITemplateItem, magazineTemplate: ITemplateItem,
): void { ): void {
@ -717,7 +717,7 @@ export class BotWeaponGenerator {
* @param magazineId magazine id to find and add to * @param magazineId magazine id to find and add to
* @param ammoTpl ammo template id to hydate with * @param ammoTpl ammo template id to hydate with
*/ */
protected fillCamorasWithAmmo(weaponMods: Item[], magazineId: string, ammoTpl: string): void { protected fillCamorasWithAmmo(weaponMods: IItem[], magazineId: string, ammoTpl: string): void {
// for CylinderMagazine we exchange the ammo in the "camoras". // for CylinderMagazine we exchange the ammo in the "camoras".
// This might not be necessary since we already filled the camoras with a random whitelisted and compatible ammo type, // This might not be necessary since we already filled the camoras with a random whitelisted and compatible ammo type,
// but I'm not sure whether this is also used elsewhere // but I'm not sure whether this is also used elsewhere

View File

@ -1,7 +1,7 @@
import { HandbookHelper } from "@spt/helpers/HandbookHelper"; import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader"; import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
@ -83,7 +83,7 @@ export class FenceBaseAssortGenerator {
} }
// Create item object in array // Create item object in array
const itemWithChildrenToAdd: Item[] = [ const itemWithChildrenToAdd: IItem[] = [
{ {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: rootItemDb._id, _tpl: rootItemDb._id,
@ -139,7 +139,7 @@ export class FenceBaseAssortGenerator {
} }
// Construct preset + mods // Construct preset + mods
const itemAndChildren: Item[] = this.itemHelper.replaceIDs(defaultPreset._items); const itemAndChildren: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
// Find root item and add some properties to it // Find root item and add some properties to it
for (let i = 0; i < itemAndChildren.length; i++) { for (let i = 0; i < itemAndChildren.length; i++) {
@ -230,7 +230,7 @@ export class FenceBaseAssortGenerator {
* @param armor Armor item array to add mods into * @param armor Armor item array to add mods into
* @param itemDbDetails Armor items db template * @param itemDbDetails Armor items db template
*/ */
protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void { protected addChildrenToArmorModSlots(armor: IItem[], itemDbDetails: ITemplateItem): void {
// Armor has no mods, make no additions // Armor has no mods, make no additions
const hasMods = itemDbDetails._props.Slots.length > 0; const hasMods = itemDbDetails._props.Slots.length > 0;
if (!hasMods) { if (!hasMods) {
@ -249,7 +249,7 @@ export class FenceBaseAssortGenerator {
continue; continue;
} }
const mod: Item = { const mod: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: plateTpl, _tpl: plateTpl,
parentId: armor[0]._id, parentId: armor[0]._id,

View File

@ -11,7 +11,7 @@ import {
} from "@spt/models/eft/common/ILocation"; } from "@spt/models/eft/common/ILocation";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase"; import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { ILooseLoot, ISpawnpoint, ISpawnpointTemplate, ISpawnpointsForced } from "@spt/models/eft/common/ILooseLoot"; import { ILooseLoot, ISpawnpoint, ISpawnpointTemplate, ISpawnpointsForced } from "@spt/models/eft/common/ILooseLoot";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
@ -28,7 +28,7 @@ import { ICloner } from "@spt/utils/cloners/ICloner";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
export interface IContainerItem { export interface IContainerItem {
items: Item[]; items: IItem[];
width: number; width: number;
height: number; height: number;
} }
@ -835,7 +835,7 @@ export class LocationLootGenerator {
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1]; const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
// Item array to return // Item array to return
const itemWithMods: Item[] = []; const itemWithMods: IItem[] = [];
// Money/Ammo - don't rely on items in spawnPoint.template.Items so we can randomise it ourselves // Money/Ammo - don't rely on items in spawnPoint.template.Items so we can randomise it ourselves
if (this.itemHelper.isOfBaseclasses(chosenTpl, [BaseClasses.MONEY, BaseClasses.AMMO])) { if (this.itemHelper.isOfBaseclasses(chosenTpl, [BaseClasses.MONEY, BaseClasses.AMMO])) {
@ -851,12 +851,12 @@ export class LocationLootGenerator {
}); });
} else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX)) { } else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX)) {
// Fill with cartridges // Fill with cartridges
const ammoBoxItem: Item[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }]; const ammoBoxItem: IItem[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }];
this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, itemTemplate); this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, itemTemplate);
itemWithMods.push(...ammoBoxItem); itemWithMods.push(...ammoBoxItem);
} else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MAGAZINE)) { } else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MAGAZINE)) {
// Create array with just magazine // Create array with just magazine
const magazineItem: Item[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }]; const magazineItem: IItem[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }];
if (this.randomUtil.getChance100(this.locationConfig.staticMagazineLootHasAmmoChancePercent)) { if (this.randomUtil.getChance100(this.locationConfig.staticMagazineLootHasAmmoChancePercent)) {
// Add randomised amount of cartridges // Add randomised amount of cartridges
@ -896,7 +896,7 @@ export class LocationLootGenerator {
* @param chosenTpl Tpl we want to get item with * @param chosenTpl Tpl we want to get item with
* @returns Item object * @returns Item object
*/ */
protected getItemInArray(items: Item[], chosenTpl: string): Item | undefined { protected getItemInArray(items: IItem[], chosenTpl: string): IItem | undefined {
if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.WEAPON)) { if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.WEAPON)) {
return items.find((v) => v._tpl === chosenTpl && v.parentId === undefined); return items.find((v) => v._tpl === chosenTpl && v.parentId === undefined);
} }
@ -913,7 +913,7 @@ export class LocationLootGenerator {
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1]; const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
let width = itemTemplate._props.Width; let width = itemTemplate._props.Width;
let height = itemTemplate._props.Height; let height = itemTemplate._props.Height;
let items: Item[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }]; let items: IItem[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }];
const rootItem = items[0]; const rootItem = items[0];
// Use passed in parentId as override for new item // Use passed in parentId as override for new item
@ -935,7 +935,7 @@ export class LocationLootGenerator {
} }
// No spawn point, use default template // No spawn point, use default template
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.WEAPON)) { else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.WEAPON)) {
let children: Item[] = []; let children: IItem[] = [];
const defaultPreset = this.cloner.clone(this.presetHelper.getDefaultPreset(chosenTpl)); const defaultPreset = this.cloner.clone(this.presetHelper.getDefaultPreset(chosenTpl));
if (defaultPreset?._items) { if (defaultPreset?._items) {
try { try {
@ -1039,7 +1039,7 @@ export class LocationLootGenerator {
} else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) { } else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) {
const defaultPreset = this.presetHelper.getDefaultPreset(chosenTpl); const defaultPreset = this.presetHelper.getDefaultPreset(chosenTpl);
if (defaultPreset) { if (defaultPreset) {
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
// Use original items parentId otherwise item doesnt get added to container correctly // Use original items parentId otherwise item doesnt get added to container correctly

View File

@ -3,7 +3,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IPreset } from "@spt/models/eft/common/IGlobals"; import { IPreset } from "@spt/models/eft/common/IGlobals";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ISealedAirdropContainerSettings, RewardDetails } from "@spt/models/spt/config/IInventoryConfig"; import { ISealedAirdropContainerSettings, RewardDetails } from "@spt/models/spt/config/IInventoryConfig";
@ -40,8 +40,8 @@ export class LootGenerator {
* @param options parameters to adjust how loot is generated * @param options parameters to adjust how loot is generated
* @returns An array of loot items * @returns An array of loot items
*/ */
public createRandomLoot(options: LootRequest): Item[] { public createRandomLoot(options: LootRequest): IItem[] {
const result: Item[] = []; const result: IItem[] = [];
const itemTypeCounts = this.initItemLimitCounter(options.itemLimits); const itemTypeCounts = this.initItemLimitCounter(options.itemLimits);
// Handle sealed weapon containers // Handle sealed weapon containers
@ -233,7 +233,7 @@ export class LootGenerator {
items: [string, ITemplateItem][], items: [string, ITemplateItem][],
itemTypeCounts: Record<string, { current: number; max: number }>, itemTypeCounts: Record<string, { current: number; max: number }>,
options: LootRequest, options: LootRequest,
result: Item[], result: IItem[],
): boolean { ): boolean {
const randomItem = this.randomUtil.getArrayValue(items)[1]; const randomItem = this.randomUtil.getArrayValue(items)[1];
@ -247,7 +247,7 @@ export class LootGenerator {
return false; return false;
} }
const newLootItem: Item = { const newLootItem: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: randomItem._id, _tpl: randomItem._id,
upd: { upd: {
@ -303,7 +303,7 @@ export class LootGenerator {
presetPool: IPreset[], presetPool: IPreset[],
itemTypeCounts: Record<string, { current: number; max: number }>, itemTypeCounts: Record<string, { current: number; max: number }>,
itemBlacklist: string[], itemBlacklist: string[],
result: Item[], result: IItem[],
): boolean { ): boolean {
// Choose random preset and get details from item db using encyclopedia value (encyclopedia === tplId) // Choose random preset and get details from item db using encyclopedia value (encyclopedia === tplId)
const chosenPreset = this.randomUtil.getArrayValue(presetPool); const chosenPreset = this.randomUtil.getArrayValue(presetPool);
@ -346,7 +346,7 @@ export class LootGenerator {
return false; return false;
} }
const presetAndMods: Item[] = this.itemHelper.replaceIDs(chosenPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(chosenPreset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
// Add chosen preset tpl to result array // Add chosen preset tpl to result array
presetAndMods.forEach((item) => { presetAndMods.forEach((item) => {
@ -367,8 +367,8 @@ export class LootGenerator {
* @param containerSettings sealed weapon container settings * @param containerSettings sealed weapon container settings
* @returns Array of item with children arrays * @returns Array of item with children arrays
*/ */
public getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][] { public getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): IItem[][] {
const itemsToReturn: Item[][] = []; const itemsToReturn: IItem[][] = [];
// Choose a weapon to give to the player (weighted) // Choose a weapon to give to the player (weighted)
const chosenWeaponTpl = this.weightedRandomHelper.getWeightedValue<string>( const chosenWeaponTpl = this.weightedRandomHelper.getWeightedValue<string>(
@ -399,7 +399,7 @@ export class LootGenerator {
} }
// Clean up Ids to ensure they're all unique and prevent collisions // Clean up Ids to ensure they're all unique and prevent collisions
const presetAndMods: Item[] = this.itemHelper.replaceIDs(chosenWeaponPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(chosenWeaponPreset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
// Add preset to return object // Add preset to return object
@ -426,8 +426,8 @@ export class LootGenerator {
protected getSealedContainerNonWeaponModRewards( protected getSealedContainerNonWeaponModRewards(
containerSettings: ISealedAirdropContainerSettings, containerSettings: ISealedAirdropContainerSettings,
weaponDetailsDb: ITemplateItem, weaponDetailsDb: ITemplateItem,
): Item[][] { ): IItem[][] {
const rewards: Item[][] = []; const rewards: IItem[][] = [];
for (const rewardTypeId in containerSettings.rewardTypeLimits) { for (const rewardTypeId in containerSettings.rewardTypeLimits) {
const settings = containerSettings.rewardTypeLimits[rewardTypeId]; const settings = containerSettings.rewardTypeLimits[rewardTypeId];
@ -456,7 +456,7 @@ export class LootGenerator {
for (let index = 0; index < rewardCount; index++) { for (let index = 0; index < rewardCount; index++) {
const chosenAmmoBox = this.randomUtil.getArrayValue(ammoBoxesMatchingCaliber); const chosenAmmoBox = this.randomUtil.getArrayValue(ammoBoxesMatchingCaliber);
const ammoBoxItem: Item[] = [{ _id: this.hashUtil.generate(), _tpl: chosenAmmoBox._id }]; const ammoBoxItem: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: chosenAmmoBox._id }];
this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, chosenAmmoBox); this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, chosenAmmoBox);
rewards.push(ammoBoxItem); rewards.push(ammoBoxItem);
} }
@ -483,7 +483,7 @@ export class LootGenerator {
for (let index = 0; index < rewardCount; index++) { for (let index = 0; index < rewardCount; index++) {
// Choose a random item from pool // Choose a random item from pool
const chosenRewardItem = this.randomUtil.getArrayValue(rewardItemPool); const chosenRewardItem = this.randomUtil.getArrayValue(rewardItemPool);
const rewardItem: Item[] = [{ _id: this.hashUtil.generate(), _tpl: chosenRewardItem._id }]; const rewardItem: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: chosenRewardItem._id }];
rewards.push(rewardItem); rewards.push(rewardItem);
} }
@ -503,8 +503,8 @@ export class LootGenerator {
containerSettings: ISealedAirdropContainerSettings, containerSettings: ISealedAirdropContainerSettings,
linkedItemsToWeapon: ITemplateItem[], linkedItemsToWeapon: ITemplateItem[],
chosenWeaponPreset: IPreset, chosenWeaponPreset: IPreset,
): Item[][] { ): IItem[][] {
const modRewards: Item[][] = []; const modRewards: IItem[][] = [];
for (const rewardTypeId in containerSettings.weaponModRewardLimits) { for (const rewardTypeId in containerSettings.weaponModRewardLimits) {
const settings = containerSettings.weaponModRewardLimits[rewardTypeId]; const settings = containerSettings.weaponModRewardLimits[rewardTypeId];
const rewardCount = this.randomUtil.getInt(settings.min, settings.max); const rewardCount = this.randomUtil.getInt(settings.min, settings.max);
@ -528,7 +528,7 @@ export class LootGenerator {
// Find a random item of the desired type and add as reward // Find a random item of the desired type and add as reward
for (let index = 0; index < rewardCount; index++) { for (let index = 0; index < rewardCount; index++) {
const chosenItem = this.randomUtil.drawRandomFromList(relatedItems); const chosenItem = this.randomUtil.drawRandomFromList(relatedItems);
const item: Item[] = [{ _id: this.hashUtil.generate(), _tpl: chosenItem[0]._id }]; const item: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: chosenItem[0]._id }];
modRewards.push(item); modRewards.push(item);
} }
@ -542,8 +542,8 @@ export class LootGenerator {
* @param rewardContainerDetails * @param rewardContainerDetails
* @returns Array of item with children arrays * @returns Array of item with children arrays
*/ */
public getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][] { public getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): IItem[][] {
const itemsToReturn: Item[][] = []; const itemsToReturn: IItem[][] = [];
// Get random items and add to newItemRequest // Get random items and add to newItemRequest
for (let index = 0; index < rewardContainerDetails.rewardCount; index++) { for (let index = 0; index < rewardContainerDetails.rewardCount; index++) {
@ -554,7 +554,7 @@ export class LootGenerator {
const preset = this.presetHelper.getDefaultPreset(chosenRewardItemTpl); const preset = this.presetHelper.getDefaultPreset(chosenRewardItemTpl);
// Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory
const presetAndMods: Item[] = this.itemHelper.replaceIDs(preset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(preset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
itemsToReturn.push(presetAndMods); itemsToReturn.push(presetAndMods);
@ -562,7 +562,7 @@ export class LootGenerator {
continue; continue;
} }
const rewardItem: Item[] = [{ _id: this.hashUtil.generate(), _tpl: chosenRewardItemTpl }]; const rewardItem: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: chosenRewardItemTpl }];
itemsToReturn.push(rewardItem); itemsToReturn.push(rewardItem);
} }

View File

@ -6,7 +6,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IBotBase, IBotInfoSettings, ISkills, IStats } from "@spt/models/eft/common/tables/IBotBase"; import { IBotBase, IBotInfoSettings, ISkills, IStats } from "@spt/models/eft/common/tables/IBotBase";
import { IBotType } from "@spt/models/eft/common/tables/IBotType"; import { IBotType } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { AccountTypes } from "@spt/models/enums/AccountTypes"; import { AccountTypes } from "@spt/models/enums/AccountTypes";
import { BonusType } from "@spt/models/enums/BonusType"; import { BonusType } from "@spt/models/enums/BonusType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -155,7 +155,7 @@ export class PlayerScavGenerator {
} }
const itemTemplate = itemResult[1]; const itemTemplate = itemResult[1];
const itemsToAdd: Item[] = [ const itemsToAdd: IItem[] = [
{ {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: itemTemplate._id, _tpl: itemTemplate._id,

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { IPreset } from "@spt/models/eft/common/IGlobals"; import { IPreset } from "@spt/models/eft/common/IGlobals";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
@ -13,7 +13,7 @@ import { inject, injectable } from "tsyringe";
@injectable() @injectable()
export class RagfairAssortGenerator { export class RagfairAssortGenerator {
protected generatedAssortItems: Item[][] = []; protected generatedAssortItems: IItem[][] = [];
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected ragfairItemInvalidBaseTypes: string[] = [ protected ragfairItemInvalidBaseTypes: string[] = [
@ -42,7 +42,7 @@ export class RagfairAssortGenerator {
* Each sub array contains item + children (if any) * Each sub array contains item + children (if any)
* @returns array of arrays * @returns array of arrays
*/ */
public getAssortItems(): Item[][] { public getAssortItems(): IItem[][] {
if (!this.assortsAreGenerated()) { if (!this.assortsAreGenerated()) {
this.generatedAssortItems = this.generateRagfairAssortItems(); this.generatedAssortItems = this.generateRagfairAssortItems();
} }
@ -62,8 +62,8 @@ export class RagfairAssortGenerator {
* Generate an array of arrays (item + children) the flea can sell * Generate an array of arrays (item + children) the flea can sell
* @returns array of arrays (item + children) * @returns array of arrays (item + children)
*/ */
protected generateRagfairAssortItems(): Item[][] { protected generateRagfairAssortItems(): IItem[][] {
const results: Item[][] = []; const results: IItem[][] = [];
/** Get cloned items from db */ /** Get cloned items from db */
const dbItemsClone = this.itemHelper.getItems().filter((item) => item._type !== "Node"); const dbItemsClone = this.itemHelper.getItems().filter((item) => item._type !== "Node");
@ -76,7 +76,7 @@ export class RagfairAssortGenerator {
const presets = this.getPresetsToAdd(); const presets = this.getPresetsToAdd();
for (const preset of presets) { for (const preset of presets) {
// Update Ids and clone // Update Ids and clone
const presetAndMods: Item[] = this.itemHelper.replaceIDs(preset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(preset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
// Add presets base item tpl to the processed list so its skipped later on when processing items // Add presets base item tpl to the processed list so its skipped later on when processing items
@ -133,7 +133,7 @@ export class RagfairAssortGenerator {
* @param id id to add to item * @param id id to add to item
* @returns Hydrated Item object * @returns Hydrated Item object
*/ */
protected createRagfairAssortRootItem(tplId: string, id = this.hashUtil.generate()): Item { protected createRagfairAssortRootItem(tplId: string, id = this.hashUtil.generate()): IItem {
return { return {
_id: id, _id: id,
_tpl: tplId, _tpl: tplId,

View File

@ -6,7 +6,7 @@ import { PaymentHelper } from "@spt/helpers/PaymentHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper"; import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader"; import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import { IRagfairOffer, IRagfairOfferUser, OfferRequirement } from "@spt/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer, IRagfairOfferUser, OfferRequirement } from "@spt/models/eft/ragfair/IRagfairOffer";
@ -80,7 +80,7 @@ export class RagfairOfferGenerator {
public createAndAddFleaOffer( public createAndAddFleaOffer(
userID: string, userID: string,
time: number, time: number,
items: Item[], items: IItem[],
barterScheme: IBarterScheme[], barterScheme: IBarterScheme[],
loyalLevel: number, loyalLevel: number,
sellInOnePiece = false, sellInOnePiece = false,
@ -104,7 +104,7 @@ export class RagfairOfferGenerator {
protected createOffer( protected createOffer(
userID: string, userID: string,
time: number, time: number,
items: Item[], items: IItem[],
barterScheme: IBarterScheme[], barterScheme: IBarterScheme[],
loyalLevel: number, loyalLevel: number,
isPackOffer = false, isPackOffer = false,
@ -337,11 +337,11 @@ export class RagfairOfferGenerator {
* Create multiple offers for items by using a unique list of items we've generated previously * Create multiple offers for items by using a unique list of items we've generated previously
* @param expiredOffers optional, expired offers to regenerate * @param expiredOffers optional, expired offers to regenerate
*/ */
public async generateDynamicOffers(expiredOffers?: Item[][]): Promise<void> { public async generateDynamicOffers(expiredOffers?: IItem[][]): Promise<void> {
const replacingExpiredOffers = Boolean(expiredOffers?.length); const replacingExpiredOffers = Boolean(expiredOffers?.length);
// get assort items from param if they exist, otherwise grab freshly generated assorts // get assort items from param if they exist, otherwise grab freshly generated assorts
const assortItemsToProcess: Item[][] = replacingExpiredOffers const assortItemsToProcess: IItem[][] = replacingExpiredOffers
? expiredOffers ? expiredOffers
: this.ragfairAssortGenerator.getAssortItems(); : this.ragfairAssortGenerator.getAssortItems();
@ -359,7 +359,7 @@ export class RagfairOfferGenerator {
* @param config Ragfair dynamic config * @param config Ragfair dynamic config
*/ */
protected async createOffersFromAssort( protected async createOffersFromAssort(
assortItemWithChildren: Item[], assortItemWithChildren: IItem[],
isExpiredOffer: boolean, isExpiredOffer: boolean,
config: Dynamic, config: Dynamic,
): Promise<void> { ): Promise<void> {
@ -406,7 +406,7 @@ export class RagfairOfferGenerator {
* @returns True if plate removed * @returns True if plate removed
*/ */
protected removeBannedPlatesFromPreset( protected removeBannedPlatesFromPreset(
presetWithChildren: Item[], presetWithChildren: IItem[],
plateSettings: IArmorPlateBlacklistSettings, plateSettings: IArmorPlateBlacklistSettings,
): boolean { ): boolean {
if (!this.itemHelper.armorItemCanHoldMods(presetWithChildren[0]._tpl)) { if (!this.itemHelper.armorItemCanHoldMods(presetWithChildren[0]._tpl)) {
@ -447,7 +447,7 @@ export class RagfairOfferGenerator {
* @returns Item array * @returns Item array
*/ */
protected async createSingleOfferForItem( protected async createSingleOfferForItem(
itemWithChildren: Item[], itemWithChildren: IItem[],
isPreset: boolean, isPreset: boolean,
itemDetails: [boolean, ITemplateItem], itemDetails: [boolean, ITemplateItem],
): Promise<void> { ): Promise<void> {
@ -562,7 +562,7 @@ export class RagfairOfferGenerator {
} }
const isPreset = this.presetHelper.isPreset(item._id); const isPreset = this.presetHelper.isPreset(item._id);
const items: Item[] = isPreset const items: IItem[] = isPreset
? this.ragfairServerHelper.getPresetItems(item) ? this.ragfairServerHelper.getPresetItems(item)
: [...[item], ...this.itemHelper.findAndReturnChildrenByAssort(item._id, assorts.items)]; : [...[item], ...this.itemHelper.findAndReturnChildrenByAssort(item._id, assorts.items)];
@ -595,7 +595,7 @@ export class RagfairOfferGenerator {
* @param itemWithMods Item and mods, get condition of first item (only first array item is modified) * @param itemWithMods Item and mods, get condition of first item (only first array item is modified)
* @param itemDetails db details of first item * @param itemDetails db details of first item
*/ */
protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void { protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: IItem[], itemDetails: ITemplateItem): void {
// Add any missing properties to first item in array // Add any missing properties to first item in array
this.addMissingConditions(itemWithMods[0]); this.addMissingConditions(itemWithMods[0]);
@ -638,7 +638,7 @@ export class RagfairOfferGenerator {
*/ */
protected randomiseItemCondition( protected randomiseItemCondition(
conditionSettingsId: string, conditionSettingsId: string,
itemWithMods: Item[], itemWithMods: IItem[],
itemDetails: ITemplateItem, itemDetails: ITemplateItem,
): void { ): void {
const rootItem = itemWithMods[0]; const rootItem = itemWithMods[0];
@ -721,7 +721,7 @@ export class RagfairOfferGenerator {
* @param currentMultiplier Value to multiply current durability by * @param currentMultiplier Value to multiply current durability by
*/ */
protected randomiseWeaponDurability( protected randomiseWeaponDurability(
item: Item, item: IItem,
itemDbDetails: ITemplateItem, itemDbDetails: ITemplateItem,
maxMultiplier: number, maxMultiplier: number,
currentMultiplier: number, currentMultiplier: number,
@ -748,7 +748,7 @@ export class RagfairOfferGenerator {
* @param maxMultiplier Chosen multipler to use for max durability value * @param maxMultiplier Chosen multipler to use for max durability value
*/ */
protected randomiseArmorDurabilityValues( protected randomiseArmorDurabilityValues(
armorWithMods: Item[], armorWithMods: IItem[],
currentMultiplier: number, currentMultiplier: number,
maxMultiplier: number, maxMultiplier: number,
): void { ): void {
@ -782,7 +782,7 @@ export class RagfairOfferGenerator {
* HpResource for medical items * HpResource for medical items
* @param item item to add conditions to * @param item item to add conditions to
*/ */
protected addMissingConditions(item: Item): void { protected addMissingConditions(item: IItem): void {
const props = this.itemHelper.getItem(item._tpl)[1]._props; const props = this.itemHelper.getItem(item._tpl)[1]._props;
const isRepairable = "Durability" in props; const isRepairable = "Durability" in props;
const isMedkit = "MaxHpResource" in props; const isMedkit = "MaxHpResource" in props;
@ -825,7 +825,7 @@ export class RagfairOfferGenerator {
* @param offerItems Items for sale in offer * @param offerItems Items for sale in offer
* @returns Barter scheme * @returns Barter scheme
*/ */
protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[] { protected createBarterBarterScheme(offerItems: IItem[]): IBarterScheme[] {
// get flea price of item being sold // get flea price of item being sold
const priceOfItemOffer = this.ragfairPriceService.getDynamicOfferPriceForOffer( const priceOfItemOffer = this.ragfairPriceService.getDynamicOfferPriceForOffer(
offerItems, offerItems,
@ -902,7 +902,7 @@ export class RagfairOfferGenerator {
* @returns Barter scheme for offer * @returns Barter scheme for offer
*/ */
protected createCurrencyBarterScheme( protected createCurrencyBarterScheme(
offerWithChildren: Item[], offerWithChildren: IItem[],
isPackOffer: boolean, isPackOffer: boolean,
multipler = 1, multipler = 1,
): IBarterScheme[] { ): IBarterScheme[] {

View File

@ -1,7 +1,7 @@
import { HandbookHelper } from "@spt/helpers/HandbookHelper"; import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IQuestReward, IQuestRewards } from "@spt/models/eft/common/tables/IQuest"; import { IQuestReward, IQuestRewards } from "@spt/models/eft/common/tables/IQuest";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
@ -513,7 +513,7 @@ export class RepeatableQuestRewardGenerator {
* @param preset Optional array of preset items * @param preset Optional array of preset items
* @returns {object} Object of "Reward"-item-type * @returns {object} Object of "Reward"-item-type
*/ */
protected generatePresetReward(tpl: string, count: number, index: number, preset?: Item[]): IQuestReward { protected generatePresetReward(tpl: string, count: number, index: number, preset?: IItem[]): IQuestReward {
const id = this.objectId.generate(); const id = this.objectId.generate();
const questRewardItem: IQuestReward = { const questRewardItem: IQuestReward = {
target: id, target: id,

View File

@ -1,6 +1,6 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase"; import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
@ -50,7 +50,7 @@ export class ScavCaseRewardGenerator {
* @param recipeId recipe of the scav case craft * @param recipeId recipe of the scav case craft
* @returns Product array * @returns Product array
*/ */
public generate(recipeId: string): Item[][] { public generate(recipeId: string): IItem[][] {
this.cacheDbItems(); this.cacheDbItems();
// Get scavcase details from hideout/scavcase.json // Get scavcase details from hideout/scavcase.json
@ -286,11 +286,11 @@ export class ScavCaseRewardGenerator {
* @param rewardItems items to convert * @param rewardItems items to convert
* @returns Product array * @returns Product array
*/ */
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][] { protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): IItem[][] {
/** Each array is an item + children */ /** Each array is an item + children */
const result: Item[][] = []; const result: IItem[][] = [];
for (const rewardItemDb of rewardItems) { for (const rewardItemDb of rewardItems) {
let resultItem: Item[] = [{ _id: this.hashUtil.generate(), _tpl: rewardItemDb._id, upd: undefined }]; let resultItem: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: rewardItemDb._id, upd: undefined }];
const rootItem = resultItem[0]; const rootItem = resultItem[0];
if (this.itemHelper.isOfBaseclass(rewardItemDb._id, BaseClasses.AMMO_BOX)) { if (this.itemHelper.isOfBaseclass(rewardItemDb._id, BaseClasses.AMMO_BOX)) {
@ -309,7 +309,7 @@ export class ScavCaseRewardGenerator {
} }
// Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory
const presetAndMods: Item[] = this.itemHelper.replaceIDs(preset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(preset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
resultItem = presetAndMods; resultItem = presetAndMods;

View File

@ -1,17 +1,17 @@
import { IInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory } from "@spt/models/eft/common/tables/IBotBase";
import { GenerationData } from "@spt/models/eft/common/tables/IBotType"; import { IGenerationData } from "@spt/models/eft/common/tables/IBotType";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
export class InventoryMagGen { export class InventoryMagGen {
constructor( constructor(
private magCounts: GenerationData, private magCounts: IGenerationData,
private magazineTemplate: ITemplateItem, private magazineTemplate: ITemplateItem,
private weaponTemplate: ITemplateItem, private weaponTemplate: ITemplateItem,
private ammoTemplate: ITemplateItem, private ammoTemplate: ITemplateItem,
private pmcInventory: IInventory, private pmcInventory: IInventory,
) {} ) {}
public getMagCount(): GenerationData { public getMagCount(): IGenerationData {
return this.magCounts; return this.magCounts;
} }

View File

@ -1,5 +1,5 @@
import { BotHelper } from "@spt/helpers/BotHelper"; import { BotHelper } from "@spt/helpers/BotHelper";
import { Difficulty } from "@spt/models/eft/common/tables/IBotType"; import { IDifficultyCategories } from "@spt/models/eft/common/tables/IBotType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IBots } from "@spt/models/spt/bots/IBots"; import { IBots } from "@spt/models/spt/bots/IBots";
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig"; import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
@ -34,7 +34,7 @@ export class BotDifficultyHelper {
* @param botDb bots from database * @param botDb bots from database
* @returns Difficulty object * @returns Difficulty object
*/ */
public getBotDifficultySettings(type: string, difficulty: string, botDb: IBots): Difficulty { public getBotDifficultySettings(type: string, difficulty: string, botDb: IBots): IDifficultyCategories {
const desiredType = type.toLowerCase(); const desiredType = type.toLowerCase();
const bot = botDb.types[desiredType]; const bot = botDb.types[desiredType];
if (!bot) { if (!bot) {
@ -67,7 +67,7 @@ export class BotDifficultyHelper {
* @param difficulty what difficulty to retrieve * @param difficulty what difficulty to retrieve
* @returns Difficulty object * @returns Difficulty object
*/ */
protected getDifficultySettings(type: string, difficulty: string): Difficulty { protected getDifficultySettings(type: string, difficulty: string): IDifficultyCategories {
let difficultySetting = let difficultySetting =
this.pmcConfig.difficulty.toLowerCase() === "asonline" this.pmcConfig.difficulty.toLowerCase() === "asonline"
? difficulty ? difficulty

View File

@ -5,8 +5,8 @@ import { DurabilityLimitsHelper } from "@spt/helpers/DurabilityLimitsHelper";
import { InventoryHelper } from "@spt/helpers/InventoryHelper"; import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { IInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory } from "@spt/models/eft/common/tables/IBotBase";
import { Item, Repairable, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpd, IUpdRepairable } from "@spt/models/eft/common/tables/IItem";
import { Grid, ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { IGrid, ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData"; import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -49,14 +49,14 @@ export class BotGeneratorHelper {
* @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items
* @returns Item Upd object with extra properties * @returns Item Upd object with extra properties
*/ */
public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd } { public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: IUpd } {
// Get raid settings, if no raid, default to day // Get raid settings, if no raid, default to day
const raidSettings = this.applicationContext const raidSettings = this.applicationContext
.getLatestValue(ContextVariableType.RAID_CONFIGURATION) .getLatestValue(ContextVariableType.RAID_CONFIGURATION)
?.getValue<IGetRaidConfigurationRequestData>(); ?.getValue<IGetRaidConfigurationRequestData>();
const raidIsNight = raidSettings?.timeVariant === "PAST"; const raidIsNight = raidSettings?.timeVariant === "PAST";
const itemProperties: Upd = {}; const itemProperties: IUpd = {};
if (itemTemplate._props.MaxDurability) { if (itemTemplate._props.MaxDurability) {
if (itemTemplate._props.weapClass) { if (itemTemplate._props.weapClass) {
@ -215,7 +215,7 @@ export class BotGeneratorHelper {
* @param botRole type of bot being generated for * @param botRole type of bot being generated for
* @returns Repairable object * @returns Repairable object
*/ */
protected generateWeaponRepairableProperties(itemTemplate: ITemplateItem, botRole?: string): Repairable { protected generateWeaponRepairableProperties(itemTemplate: ITemplateItem, botRole?: string): IUpdRepairable {
const maxDurability = this.durabilityLimitsHelper.getRandomizedMaxWeaponDurability(itemTemplate, botRole); const maxDurability = this.durabilityLimitsHelper.getRandomizedMaxWeaponDurability(itemTemplate, botRole);
const currentDurability = this.durabilityLimitsHelper.getRandomizedWeaponDurability( const currentDurability = this.durabilityLimitsHelper.getRandomizedWeaponDurability(
itemTemplate, itemTemplate,
@ -232,7 +232,7 @@ export class BotGeneratorHelper {
* @param botRole type of bot being generated for * @param botRole type of bot being generated for
* @returns Repairable object * @returns Repairable object
*/ */
protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole?: string): Repairable { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole?: string): IUpdRepairable {
let maxDurability: number; let maxDurability: number;
let currentDurability: number; let currentDurability: number;
if (Number.parseInt(`${itemTemplate._props.armorClass}`) === 0) { if (Number.parseInt(`${itemTemplate._props.armorClass}`) === 0) {
@ -258,7 +258,7 @@ export class BotGeneratorHelper {
* @returns false if no incompatibilities, also has incompatibility reason * @returns false if no incompatibilities, also has incompatibility reason
*/ */
public isItemIncompatibleWithCurrentItems( public isItemIncompatibleWithCurrentItems(
itemsEquipped: Item[], itemsEquipped: IItem[],
tplToCheck: string, tplToCheck: string,
equipmentSlot: string, equipmentSlot: string,
): IChooseRandomCompatibleModResult { ): IChooseRandomCompatibleModResult {
@ -411,7 +411,7 @@ export class BotGeneratorHelper {
equipmentSlots: string[], equipmentSlots: string[],
rootItemId: string, rootItemId: string,
rootItemTplId: string, rootItemTplId: string,
itemWithChildren: Item[], itemWithChildren: IItem[],
inventory: IInventory, inventory: IInventory,
containersIdFull?: Set<string>, containersIdFull?: Set<string>,
): ItemAddedResult { ): ItemAddedResult {
@ -548,7 +548,7 @@ export class BotGeneratorHelper {
* @param itemTpl Item tpl being placed * @param itemTpl Item tpl being placed
* @returns True if allowed * @returns True if allowed
*/ */
protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean { protected itemAllowedInContainer(slotGrid: IGrid, itemTpl: string): boolean {
const propFilters = slotGrid._props.filters; const propFilters = slotGrid._props.filters;
const excludedFilter = propFilters[0]?.ExcludedFilter ?? []; const excludedFilter = propFilters[0]?.ExcludedFilter ?? [];
const filter = propFilters[0]?.Filter ?? []; const filter = propFilters[0]?.Filter ?? [];

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt/models/common/MinMax"; import { MinMax } from "@spt/models/common/MinMax";
import { Difficulty, IBotType } from "@spt/models/eft/common/tables/IBotType"; import { IBotType, IDifficultyCategories } from "@spt/models/eft/common/tables/IBotType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt/models/spt/config/IBotConfig"; import { EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt/models/spt/config/IBotConfig";
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig"; import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
@ -55,7 +55,7 @@ export class BotHelper {
* @param difficultySettings bot settings to alter * @param difficultySettings bot settings to alter
* @param typeToAdd bot type to add to friendly list * @param typeToAdd bot type to add to friendly list
*/ */
public addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void { public addBotToFriendlyList(difficultySettings: IDifficultyCategories, typeToAdd: string): void {
const friendlyBotTypesKey = "FRIENDLY_BOT_TYPES"; const friendlyBotTypesKey = "FRIENDLY_BOT_TYPES";
// Null guard // Null guard
@ -71,7 +71,7 @@ export class BotHelper {
* @param difficultySettings bot settings to alter * @param difficultySettings bot settings to alter
* @param typesToAdd bot type to add to revenge list * @param typesToAdd bot type to add to revenge list
*/ */
public addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void { public addBotToRevengeList(difficultySettings: IDifficultyCategories, typesToAdd: string[]): void {
const revengePropKey = "REVENGE_BOT_TYPES"; const revengePropKey = "REVENGE_BOT_TYPES";
// Nothing to add // Nothing to add

View File

@ -2,8 +2,8 @@ import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory } from "@spt/models/eft/common/tables/IBotBase";
import { GenerationData } from "@spt/models/eft/common/tables/IBotType"; import { IGenerationData } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots"; import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -34,7 +34,7 @@ export class BotWeaponGeneratorHelper {
* @param magTemplate magazine to generate bullet count for * @param magTemplate magazine to generate bullet count for
* @returns bullet count number * @returns bullet count number
*/ */
public getRandomizedBulletCount(magCounts: GenerationData, magTemplate: ITemplateItem): number { public getRandomizedBulletCount(magCounts: IGenerationData, magTemplate: ITemplateItem): number {
const randomizedMagazineCount = this.getRandomizedMagazineCount(magCounts); const randomizedMagazineCount = this.getRandomizedMagazineCount(magCounts);
const parentItem = this.itemHelper.getItem(magTemplate._parent)[1]; const parentItem = this.itemHelper.getItem(magTemplate._parent)[1];
let chamberBulletCount = 0; let chamberBulletCount = 0;
@ -62,7 +62,7 @@ export class BotWeaponGeneratorHelper {
* @param magCounts min and max value returned value can be between * @param magCounts min and max value returned value can be between
* @returns numerical value of magazine count * @returns numerical value of magazine count
*/ */
public getRandomizedMagazineCount(magCounts: GenerationData): number { public getRandomizedMagazineCount(magCounts: IGenerationData): number {
// const range = magCounts.max - magCounts.min; // const range = magCounts.max - magCounts.min;
// return this.randomUtil.getBiasedRandomNumber(magCounts.min, magCounts.max, Math.round(range * 0.75), 4); // return this.randomUtil.getBiasedRandomNumber(magCounts.min, magCounts.max, Math.round(range * 0.75), 4);
@ -85,8 +85,8 @@ export class BotWeaponGeneratorHelper {
* @param magTemplate template object of magazine * @param magTemplate template object of magazine
* @returns Item array * @returns Item array
*/ */
public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[] { public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): IItem[] {
const magazine: Item[] = [{ _id: this.hashUtil.generate(), _tpl: magazineTpl }]; const magazine: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: magazineTpl }];
this.itemHelper.fillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1); this.itemHelper.fillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1);

View File

@ -2,7 +2,7 @@ import { SavedCommand } from "@spt/helpers/Dialogue/Commando/SptCommands/GiveCom
import { ISptCommand } from "@spt/helpers/Dialogue/Commando/SptCommands/ISptCommand"; import { ISptCommand } from "@spt/helpers/Dialogue/Commando/SptCommands/ISptCommand";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { ISendMessageRequest } from "@spt/models/eft/dialog/ISendMessageRequest"; import { ISendMessageRequest } from "@spt/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile"; import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile";
@ -192,7 +192,7 @@ export class GiveSptCommand implements ISptCommand {
return request.dialogId; return request.dialogId;
} }
const itemsToSend: Item[] = []; const itemsToSend: IItem[] = [];
const preset = this.presetHelper.getDefaultPreset(checkedItem[1]._id); const preset = this.presetHelper.getDefaultPreset(checkedItem[1]._id);
if (preset && !GiveSptCommand.excludedPresetItems.has(checkedItem[1]._id)) { if (preset && !GiveSptCommand.excludedPresetItems.has(checkedItem[1]._id)) {
for (let i = 0; i < quantity; i++) { for (let i = 0; i < quantity; i++) {
@ -202,7 +202,7 @@ export class GiveSptCommand implements ISptCommand {
} }
} else if (this.itemHelper.isOfBaseclass(checkedItem[1]._id, BaseClasses.AMMO_BOX)) { } else if (this.itemHelper.isOfBaseclass(checkedItem[1]._id, BaseClasses.AMMO_BOX)) {
for (let i = 0; i < quantity; i++) { for (let i = 0; i < quantity; i++) {
const ammoBoxArray: Item[] = []; const ammoBoxArray: IItem[] = [];
ammoBoxArray.push({ _id: this.hashUtil.generate(), _tpl: checkedItem[1]._id }); ammoBoxArray.push({ _id: this.hashUtil.generate(), _tpl: checkedItem[1]._id });
// DO NOT generate the ammo box cartridges, the mail service does it for us! :) // DO NOT generate the ammo box cartridges, the mail service does it for us! :)
// this.itemHelper.addCartridgesToAmmoBox(ammoBoxArray, checkedItem[1]); // this.itemHelper.addCartridgesToAmmoBox(ammoBoxArray, checkedItem[1]);
@ -218,7 +218,7 @@ export class GiveSptCommand implements ISptCommand {
}); });
} }
} else { } else {
const item: Item = { const item: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: checkedItem[1]._id, _tpl: checkedItem[1]._id,
upd: this.itemHelper.generateUpdForItem(checkedItem[1]), upd: this.itemHelper.generateUpdForItem(checkedItem[1]),

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper"; import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper";
import { NotifierHelper } from "@spt/helpers/NotifierHelper"; import { NotifierHelper } from "@spt/helpers/NotifierHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { Dialogue, MessagePreview } from "@spt/models/eft/profile/ISptProfile"; import { Dialogue, MessagePreview } from "@spt/models/eft/profile/ISptProfile";
import { ILogger } from "@spt/models/spt/utils/ILogger"; import { ILogger } from "@spt/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt/servers/DatabaseServer"; import { DatabaseServer } from "@spt/servers/DatabaseServer";
@ -56,7 +56,7 @@ export class DialogueHelper {
* @param itemId Item being moved to inventory * @param itemId Item being moved to inventory
* @returns * @returns
*/ */
public getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[] { public getMessageItemContents(messageID: string, sessionID: string, itemId: string): IItem[] {
const dialogueData = this.saveServer.getProfile(sessionID).dialogues; const dialogueData = this.saveServer.getProfile(sessionID).dialogues;
for (const dialogueId in dialogueData) { for (const dialogueId in dialogueData) {
const message = dialogueData[dialogueId].messages.find((x) => x._id === messageID); const message = dialogueData[dialogueId].messages.find((x) => x._id === messageID);

View File

@ -1,5 +1,5 @@
import { IHandbookCategory } from "@spt/models/eft/common/tables/IHandbookBase"; import { IHandbookCategory } from "@spt/models/eft/common/tables/IHandbookBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { Money } from "@spt/models/enums/Money"; import { Money } from "@spt/models/enums/Money";
import { IItemConfig } from "@spt/models/spt/config/IItemConfig"; import { IItemConfig } from "@spt/models/spt/config/IItemConfig";
@ -110,7 +110,7 @@ export class HandbookHelper {
return handbookItem.Price; return handbookItem.Price;
} }
public getTemplatePriceForItems(items: Item[]): number { public getTemplatePriceForItems(items: IItem[]): number {
let total = 0; let total = 0;
for (const item of items) { for (const item of items) {
total += this.getTemplatePrice(item._tpl); total += this.getTemplatePrice(item._tpl);

View File

@ -3,7 +3,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IBotHideoutArea, IHideoutImprovement, IProduction, IProductive } from "@spt/models/eft/common/tables/IBotBase"; import { IBotHideoutArea, IHideoutImprovement, IProduction, IProductive } from "@spt/models/eft/common/tables/IBotBase";
import { Item, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpd } from "@spt/models/eft/common/tables/IItem";
import { IHideoutArea, StageBonus } from "@spt/models/eft/hideout/IHideoutArea"; import { IHideoutArea, StageBonus } from "@spt/models/eft/hideout/IHideoutArea";
import { IHideoutContinuousProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutContinuousProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutContinuousProductionStartRequestData";
import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction"; import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction";
@ -829,7 +829,7 @@ export class HideoutHelper {
resourceValue: number, resourceValue: number,
resourceUnitsConsumed: number, resourceUnitsConsumed: number,
isFoundInRaid: boolean, isFoundInRaid: boolean,
): Upd { ): IUpd {
return { return {
StackObjectsCount: stackCount, StackObjectsCount: stackCount,
Resource: { Value: resourceValue, UnitsConsumed: resourceUnitsConsumed }, Resource: { Value: resourceValue, UnitsConsumed: resourceUnitsConsumed },
@ -1142,7 +1142,7 @@ export class HideoutHelper {
return; return;
} }
const itemsToAdd: Item[][] = []; const itemsToAdd: IItem[][] = [];
for (let index = 0; index < craftedCoinCount; index++) { for (let index = 0; index < craftedCoinCount; index++) {
itemsToAdd.push([ itemsToAdd.push([
{ {
@ -1266,7 +1266,7 @@ export class HideoutHelper {
* @param activeDogtags Active dogtags in place of fame dogtag slots * @param activeDogtags Active dogtags in place of fame dogtag slots
* @returns combat bonus * @returns combat bonus
*/ */
protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number { protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: IItem[]): number {
// Not own dogtag // Not own dogtag
// Side = opposite of player // Side = opposite of player
let result = 0; let result = 0;

View File

@ -2,7 +2,7 @@ import { QuestController } from "@spt/controllers/QuestController";
import { InventoryHelper } from "@spt/helpers/InventoryHelper"; import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig";
import { ILostOnDeathConfig } from "@spt/models/spt/config/ILostOnDeathConfig"; import { ILostOnDeathConfig } from "@spt/models/spt/config/ILostOnDeathConfig";
@ -177,7 +177,7 @@ export class InRaidHelper {
* @param pmcProfile Profile to get items from * @param pmcProfile Profile to get items from
* @returns Array of items lost on death * @returns Array of items lost on death
*/ */
protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[] { protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): IItem[] {
const inventoryItems = pmcProfile.Inventory.items ?? []; const inventoryItems = pmcProfile.Inventory.items ?? [];
const equipmentRootId = pmcProfile?.Inventory?.equipment; const equipmentRootId = pmcProfile?.Inventory?.equipment;
const questRaidItemContainerId = pmcProfile?.Inventory?.questRaidItems; const questRaidItemContainerId = pmcProfile?.Inventory?.questRaidItems;
@ -208,7 +208,7 @@ export class InRaidHelper {
* @itemToCheck Item to check should be kept * @itemToCheck Item to check should be kept
* @returns true if item is kept after death * @returns true if item is kept after death
*/ */
protected isItemKeptAfterDeath(pmcData: IPmcData, itemToCheck: Item): boolean { protected isItemKeptAfterDeath(pmcData: IPmcData, itemToCheck: IItem): boolean {
// Use pocket slotId's otherwise it deletes the root pocket item. // Use pocket slotId's otherwise it deletes the root pocket item.
const pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"]; const pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"];

View File

@ -7,7 +7,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper"; import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory } from "@spt/models/eft/common/tables/IBotBase";
import { Item, Location, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IItemLocation, IUpd } from "@spt/models/eft/common/tables/IItem";
import { IAddItemDirectRequest } from "@spt/models/eft/inventory/IAddItemDirectRequest"; import { IAddItemDirectRequest } from "@spt/models/eft/inventory/IAddItemDirectRequest";
import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest"; import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest";
import { IInventoryMergeRequestData } from "@spt/models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMergeRequestData } from "@spt/models/eft/inventory/IInventoryMergeRequestData";
@ -172,7 +172,7 @@ export class InventoryHelper {
* @param itemWithChildren An item * @param itemWithChildren An item
* @param foundInRaid Item was found in raid * @param foundInRaid Item was found in raid
*/ */
protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void { protected setFindInRaidStatusForItem(itemWithChildren: IItem[], foundInRaid: boolean): void {
for (const item of itemWithChildren) { for (const item of itemWithChildren) {
// Ensure item has upd object // Ensure item has upd object
this.itemHelper.addUpdObjectToItem(item); this.itemHelper.addUpdObjectToItem(item);
@ -189,7 +189,7 @@ export class InventoryHelper {
* Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player * Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player
* @param upd Object to update * @param upd Object to update
*/ */
protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void { protected removeTraderRagfairRelatedUpdProperties(upd: IUpd): void {
if (upd.UnlimitedCount !== undefined) { if (upd.UnlimitedCount !== undefined) {
delete upd.UnlimitedCount; delete upd.UnlimitedCount;
} }
@ -209,7 +209,7 @@ export class InventoryHelper {
* @param itemsWithChildren array of items with children to try and fit * @param itemsWithChildren array of items with children to try and fit
* @returns True all items fit * @returns True all items fit
*/ */
public canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean { public canPlaceItemsInInventory(sessionId: string, itemsWithChildren: IItem[][]): boolean {
const pmcData = this.profileHelper.getPmcProfile(sessionId); const pmcData = this.profileHelper.getPmcProfile(sessionId);
const stashFS2D = this.cloner.clone(this.getStashSlotMap(pmcData, sessionId)); const stashFS2D = this.cloner.clone(this.getStashSlotMap(pmcData, sessionId));
@ -233,7 +233,7 @@ export class InventoryHelper {
* @param itemsWithChildren items to try and fit into grid * @param itemsWithChildren items to try and fit into grid
* @returns True all fit * @returns True all fit
*/ */
public canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean { public canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: IItem[][]): boolean {
for (const itemWithChildren of itemsWithChildren) { for (const itemWithChildren of itemsWithChildren) {
if (!this.canPlaceItemInContainer(containerFS2D, itemWithChildren)) { if (!this.canPlaceItemInContainer(containerFS2D, itemWithChildren)) {
return false; return false;
@ -249,7 +249,7 @@ export class InventoryHelper {
* @param itemWithChildren item to check fits * @param itemWithChildren item to check fits
* @returns True it fits * @returns True it fits
*/ */
public canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean { public canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: IItem[]): boolean {
// Get x/y size of item // Get x/y size of item
const rootItem = itemWithChildren[0]; const rootItem = itemWithChildren[0];
const itemSize = this.getItemSize(rootItem._tpl, rootItem._id, itemWithChildren); const itemSize = this.getItemSize(rootItem._tpl, rootItem._id, itemWithChildren);
@ -291,7 +291,7 @@ export class InventoryHelper {
*/ */
public placeItemInContainer( public placeItemInContainer(
containerFS2D: number[][], containerFS2D: number[][],
itemWithChildren: Item[], itemWithChildren: IItem[],
containerId: string, containerId: string,
desiredSlotId = "hideout", desiredSlotId = "hideout",
): void { ): void {
@ -344,7 +344,7 @@ export class InventoryHelper {
protected placeItemInInventory( protected placeItemInInventory(
stashFS2D: number[][], stashFS2D: number[][],
sortingTableFS2D: number[][], sortingTableFS2D: number[][],
itemWithChildren: Item[], itemWithChildren: IItem[],
playerInventory: IInventory, playerInventory: IInventory,
useSortingTable: boolean, useSortingTable: boolean,
output: IItemEventRouterResponse, output: IItemEventRouterResponse,
@ -582,7 +582,7 @@ export class InventoryHelper {
* @param inventoryItems * @param inventoryItems
* @returns [width, height] * @returns [width, height]
*/ */
public getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[] { public getItemSize(itemTpl: string, itemID: string, inventoryItems: IItem[]): number[] {
// -> Prepares item Width and height returns [sizeX, sizeY] // -> Prepares item Width and height returns [sizeX, sizeY]
return this.getSizeByInventoryItemHash(itemTpl, itemID, this.getInventoryItemHash(inventoryItems)); return this.getSizeByInventoryItemHash(itemTpl, itemID, this.getInventoryItemHash(inventoryItems));
} }
@ -734,7 +734,7 @@ export class InventoryHelper {
* @param containerId Id of the container * @param containerId Id of the container
* @returns Two-dimensional representation of container * @returns Two-dimensional representation of container
*/ */
public getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][] { public getContainerMap(containerH: number, containerV: number, itemList: IItem[], containerId: string): number[][] {
// Create blank 2d map of container // Create blank 2d map of container
const container2D = this.getBlankContainerMap(containerH, containerV); const container2D = this.getBlankContainerMap(containerH, containerV);
@ -751,7 +751,7 @@ export class InventoryHelper {
// Check each item in container // Check each item in container
for (const item of containerItemHash) { for (const item of containerItemHash) {
const itemLocation = item?.location as Location; const itemLocation = item?.location as IItemLocation;
if (!itemLocation) { if (!itemLocation) {
// item has no location property // item has no location property
this.logger.error(`Unable to find 'location' property on item with id: ${item._id}, skipping`); this.logger.error(`Unable to find 'location' property on item with id: ${item._id}, skipping`);
@ -787,11 +787,11 @@ export class InventoryHelper {
return container2D; return container2D;
} }
protected isVertical(itemLocation: Location): boolean { protected isVertical(itemLocation: IItemLocation): boolean {
return itemLocation.r === 1 || itemLocation.r === "Vertical" || itemLocation.rotation === "Vertical"; return itemLocation.r === 1 || itemLocation.r === "Vertical" || itemLocation.rotation === "Vertical";
} }
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash { protected getInventoryItemHash(inventoryItem: IItem[]): InventoryHelper.InventoryItemHash {
const inventoryItemHash: InventoryHelper.InventoryItemHash = { byItemId: {}, byParentId: {} }; const inventoryItemHash: InventoryHelper.InventoryItemHash = { byItemId: {}, byParentId: {} };
for (const item of inventoryItem) { for (const item of inventoryItem) {
inventoryItemHash.byItemId[item._id] = item; inventoryItemHash.byItemId[item._id] = item;
@ -960,7 +960,7 @@ export class InventoryHelper {
* @param toItems Inventory of the destination * @param toItems Inventory of the destination
* @param request Move request * @param request Move request
*/ */
public moveItemToProfile(sourceItems: Item[], toItems: Item[], request: IInventoryMoveRequestData): void { public moveItemToProfile(sourceItems: IItem[], toItems: IItem[], request: IInventoryMoveRequestData): void {
this.handleCartridges(sourceItems, request); this.handleCartridges(sourceItems, request);
// Get all children item has, they need to move with item // Get all children item has, they need to move with item
@ -1002,7 +1002,7 @@ export class InventoryHelper {
*/ */
public moveItemInternal( public moveItemInternal(
pmcData: IPmcData, pmcData: IPmcData,
inventoryItems: Item[], inventoryItems: IItem[],
moveRequest: IInventoryMoveRequestData, moveRequest: IInventoryMoveRequestData,
): { success: boolean; errorMessage?: string } { ): { success: boolean; errorMessage?: string } {
this.handleCartridges(inventoryItems, moveRequest); this.handleCartridges(inventoryItems, moveRequest);
@ -1057,7 +1057,7 @@ export class InventoryHelper {
* @param pmcData Player profile * @param pmcData Player profile
* @param itemBeingMoved item being moved * @param itemBeingMoved item being moved
*/ */
protected updateFastPanelBinding(pmcData: IPmcData, itemBeingMoved: Item): void { protected updateFastPanelBinding(pmcData: IPmcData, itemBeingMoved: IItem): void {
// Find matching _id in fast panel // Find matching _id in fast panel
const fastPanelSlot = Object.entries(pmcData.Inventory.fastPanel).find( const fastPanelSlot = Object.entries(pmcData.Inventory.fastPanel).find(
([itemId]) => itemId === itemBeingMoved._id, ([itemId]) => itemId === itemBeingMoved._id,
@ -1084,7 +1084,7 @@ export class InventoryHelper {
/** /**
* 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[], request: IInventoryMoveRequestData): void { protected handleCartridges(items: IItem[], request: IInventoryMoveRequestData): void {
// Not moving item into a cartridge slot, skip // Not moving item into a cartridge slot, skip
if (request.to.container !== "cartridges") { if (request.to.container !== "cartridges") {
return; return;
@ -1117,7 +1117,7 @@ export class InventoryHelper {
* @param itemToCheck Item to look for * @param itemToCheck Item to look for
* @returns True if item exists inside stash * @returns True if item exists inside stash
*/ */
public isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean { public isItemInStash(pmcData: IPmcData, itemToCheck: IItem): boolean {
// Create recursive helper function // Create recursive helper function
const isParentInStash = (itemId: string): boolean => { const isParentInStash = (itemId: string): boolean => {
// Item not found / has no parent // Item not found / has no parent
@ -1139,7 +1139,7 @@ export class InventoryHelper {
return isParentInStash(itemToCheck._id); return isParentInStash(itemToCheck._id);
} }
public validateInventoryUsesMonogoIds(itemsToValidate: Item[]) { public validateInventoryUsesMonogoIds(itemsToValidate: IItem[]) {
for (const item of itemsToValidate) { for (const item of itemsToValidate) {
if (!this.hashUtil.isValidMongoId(item._id)) { if (!this.hashUtil.isValidMongoId(item._id)) {
throw new Error( throw new Error(
@ -1152,7 +1152,7 @@ export class InventoryHelper {
namespace InventoryHelper { namespace InventoryHelper {
export interface InventoryItemHash { export interface InventoryItemHash {
byItemId: Record<string, Item>; byItemId: Record<string, IItem>;
byParentId: Record<string, Item[]>; byParentId: Record<string, IItem[]>;
} }
} }

View File

@ -2,7 +2,7 @@ import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { IStaticAmmoDetails } from "@spt/models/eft/common/ILocation"; import { IStaticAmmoDetails } from "@spt/models/eft/common/ILocation";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IInsuredItem } from "@spt/models/eft/common/tables/IBotBase"; import { IInsuredItem } from "@spt/models/eft/common/tables/IBotBase";
import { Item, Location, Repairable, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IItemLocation, IUpd, IUpdRepairable } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots"; import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -59,7 +59,7 @@ export class ItemHelper {
* @param slotId OPTIONAL - slotid of desired item * @param slotId OPTIONAL - slotid of desired item
* @returns True if pool contains item * @returns True if pool contains item
*/ */
public hasItemWithTpl(itemPool: Item[], item: ItemTpl, slotId?: string): boolean { public hasItemWithTpl(itemPool: IItem[], item: ItemTpl, slotId?: string): boolean {
// Filter the pool by slotId if provided // Filter the pool by slotId if provided
const filteredPool = slotId ? itemPool.filter((item) => item.slotId?.startsWith(slotId)) : itemPool; const filteredPool = slotId ? itemPool.filter((item) => item.slotId?.startsWith(slotId)) : itemPool;
@ -74,7 +74,7 @@ export class ItemHelper {
* @param slotId OPTIONAL - slotid of desired item * @param slotId OPTIONAL - slotid of desired item
* @returns Item or undefined * @returns Item or undefined
*/ */
public getItemFromPoolByTpl(itemPool: Item[], item: ItemTpl, slotId?: string): Item | undefined { public getItemFromPoolByTpl(itemPool: IItem[], item: ItemTpl, slotId?: string): IItem | undefined {
// Filter the pool by slotId if provided // Filter the pool by slotId if provided
const filteredPool = slotId ? itemPool.filter((item) => item.slotId?.startsWith(slotId)) : itemPool; const filteredPool = slotId ? itemPool.filter((item) => item.slotId?.startsWith(slotId)) : itemPool;
@ -90,7 +90,7 @@ export class ItemHelper {
* @param compareUpdProperties Upd properties to compare between the items * @param compareUpdProperties Upd properties to compare between the items
* @returns true if they are the same, false if they arent * @returns true if they are the same, false if they arent
*/ */
public isSameItems(item1: Item[], item2: Item[], compareUpdProperties?: Set<string>): boolean { public isSameItems(item1: IItem[], item2: IItem[], compareUpdProperties?: Set<string>): boolean {
if (item1.length !== item2.length) { if (item1.length !== item2.length) {
return false; return false;
} }
@ -114,7 +114,7 @@ export class ItemHelper {
* @param compareUpdProperties Upd properties to compare between the items * @param compareUpdProperties Upd properties to compare between the items
* @returns true if they are the same, false if they arent * @returns true if they are the same, false if they arent
*/ */
public isSameItem(item1: Item, item2: Item, compareUpdProperties?: Set<string>): boolean { public isSameItem(item1: IItem, item2: IItem, compareUpdProperties?: Set<string>): boolean {
if (item1._tpl !== item2._tpl) { if (item1._tpl !== item2._tpl) {
return false; return false;
} }
@ -133,8 +133,8 @@ export class ItemHelper {
* @param itemTemplate the item template to generate a Upd for * @param itemTemplate the item template to generate a Upd for
* @returns A Upd with all the default properties set * @returns A Upd with all the default properties set
*/ */
public generateUpdForItem(itemTemplate: ITemplateItem): Upd { public generateUpdForItem(itemTemplate: ITemplateItem): IUpd {
const itemProperties: Upd = {}; const itemProperties: IUpd = {};
// armors, etc // armors, etc
if (itemTemplate._props.MaxDurability) { if (itemTemplate._props.MaxDurability) {
@ -402,7 +402,7 @@ export class ItemHelper {
* @param item Item to update * @param item Item to update
* @returns Fixed item * @returns Fixed item
*/ */
public fixItemStackCount(item: Item): Item { public fixItemStackCount(item: IItem): IItem {
if (item.upd === undefined) { if (item.upd === undefined) {
item.upd = { StackObjectsCount: 1 }; item.upd = { StackObjectsCount: 1 };
} }
@ -451,7 +451,7 @@ export class ItemHelper {
* @param skipArmorItemsWithoutDurability Skip over armor items without durability * @param skipArmorItemsWithoutDurability Skip over armor items without durability
* @returns % quality modifer between 0 and 1 * @returns % quality modifer between 0 and 1
*/ */
public getItemQualityModifierForItems(items: Item[], skipArmorItemsWithoutDurability?: boolean): number { public getItemQualityModifierForItems(items: IItem[], skipArmorItemsWithoutDurability?: boolean): number {
if (this.isOfBaseclass(items[0]._tpl, BaseClasses.WEAPON)) { if (this.isOfBaseclass(items[0]._tpl, BaseClasses.WEAPON)) {
return this.getItemQualityModifier(items[0]); return this.getItemQualityModifier(items[0]);
} }
@ -483,7 +483,7 @@ export class ItemHelper {
* @param skipArmorItemsWithoutDurability return -1 for armor items that have maxdurability of 0 * @param skipArmorItemsWithoutDurability return -1 for armor items that have maxdurability of 0
* @returns Number between 0 and 1 * @returns Number between 0 and 1
*/ */
public getItemQualityModifier(item: Item, skipArmorItemsWithoutDurability?: boolean): number { public getItemQualityModifier(item: IItem, skipArmorItemsWithoutDurability?: boolean): number {
// Default to 100% // Default to 100%
let result = 1; let result = 1;
@ -543,7 +543,11 @@ export class ItemHelper {
* @param item Item quality value is for * @param item Item quality value is for
* @returns A number between 0 and 1 * @returns A number between 0 and 1
*/ */
protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number { protected getRepairableItemQualityValue(
itemDetails: ITemplateItem,
repairable: IUpdRepairable,
item: IItem,
): number {
// Edge case, max durability is below durability // Edge case, max durability is below durability
if (repairable.Durability > repairable.MaxDurability) { if (repairable.Durability > repairable.MaxDurability) {
this.logger.warning( this.logger.warning(
@ -573,7 +577,7 @@ export class ItemHelper {
* @param baseItemId Parent items id * @param baseItemId Parent items id
* @returns an array of strings * @returns an array of strings
*/ */
public findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[] { public findAndReturnChildrenByItems(items: IItem[], baseItemId: string): string[] {
const list: string[] = []; const list: string[] = [];
for (const childitem of items) { for (const childitem of items) {
@ -594,8 +598,8 @@ export class ItemHelper {
* @param modsOnly Include only mod items, exclude items stored inside root item * @param modsOnly Include only mod items, exclude items stored inside root item
* @returns An array of Item objects * @returns An array of Item objects
*/ */
public findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly = false): Item[] { public findAndReturnChildrenAsItems(items: IItem[], baseItemId: string, modsOnly = false): IItem[] {
const list: Item[] = []; const list: IItem[] = [];
for (const childItem of items) { for (const childItem of items) {
// Include itself // Include itself
if (childItem._id === baseItemId) { if (childItem._id === baseItemId) {
@ -623,8 +627,8 @@ export class ItemHelper {
* @param assort Array of items to check in * @param assort Array of items to check in
* @returns Array of children of requested item * @returns Array of children of requested item
*/ */
public findAndReturnChildrenByAssort(itemIdToFind: string, assort: Item[]): Item[] { public findAndReturnChildrenByAssort(itemIdToFind: string, assort: IItem[]): IItem[] {
let list: Item[] = []; let list: IItem[] = [];
for (const itemFromAssort of assort) { for (const itemFromAssort of assort) {
if (itemFromAssort.parentId === itemIdToFind && !list.some((item) => itemFromAssort._id === item._id)) { if (itemFromAssort.parentId === itemIdToFind && !list.some((item) => itemFromAssort._id === item._id)) {
@ -641,7 +645,7 @@ export class ItemHelper {
* @param itemToCheck Item to check * @param itemToCheck Item to check
* @returns true if it has buy restrictions * @returns true if it has buy restrictions
*/ */
public hasBuyRestrictions(itemToCheck: Item): boolean { public hasBuyRestrictions(itemToCheck: IItem): boolean {
if (itemToCheck.upd?.BuyRestrictionCurrent !== undefined && itemToCheck.upd?.BuyRestrictionMax !== undefined) { if (itemToCheck.upd?.BuyRestrictionCurrent !== undefined && itemToCheck.upd?.BuyRestrictionMax !== undefined) {
return true; return true;
} }
@ -672,12 +676,12 @@ export class ItemHelper {
* @param item * @param item
* @returns "slotId OR slotid,locationX,locationY" * @returns "slotId OR slotid,locationX,locationY"
*/ */
public getChildId(item: Item): string { public getChildId(item: IItem): string {
if (!("location" in item)) { if (!("location" in item)) {
return item.slotId; return item.slotId;
} }
return `${item.slotId},${(item.location as Location).x},${(item.location as Location).y}`; return `${item.slotId},${(item.location as IItemLocation).x},${(item.location as IItemLocation).y}`;
} }
/** /**
@ -699,14 +703,14 @@ export class ItemHelper {
* @param itemToSplit Item to split into smaller stacks * @param itemToSplit Item to split into smaller stacks
* @returns Array of root item + children * @returns Array of root item + children
*/ */
public splitStack(itemToSplit: Item): Item[] { public splitStack(itemToSplit: IItem): IItem[] {
if (itemToSplit?.upd?.StackObjectsCount === undefined) { if (itemToSplit?.upd?.StackObjectsCount === undefined) {
return [itemToSplit]; return [itemToSplit];
} }
const maxStackSize = this.getItem(itemToSplit._tpl)[1]._props.StackMaxSize; const maxStackSize = this.getItem(itemToSplit._tpl)[1]._props.StackMaxSize;
let remainingCount = itemToSplit.upd.StackObjectsCount; let remainingCount = itemToSplit.upd.StackObjectsCount;
const rootAndChildren: Item[] = []; const rootAndChildren: IItem[] = [];
// If the current count is already equal or less than the max // If the current count is already equal or less than the max
// return the item as is. // return the item as is.
@ -734,7 +738,7 @@ export class ItemHelper {
* @param itemToSplit Item to split into smaller stacks * @param itemToSplit Item to split into smaller stacks
* @returns * @returns
*/ */
public splitStackIntoSeparateItems(itemToSplit: Item): Item[][] { public splitStackIntoSeparateItems(itemToSplit: IItem): IItem[][] {
const itemTemplate = this.getItem(itemToSplit._tpl)[1]; const itemTemplate = this.getItem(itemToSplit._tpl)[1];
const itemMaxStackSize = itemTemplate._props.StackMaxSize ?? 1; const itemMaxStackSize = itemTemplate._props.StackMaxSize ?? 1;
@ -744,7 +748,7 @@ export class ItemHelper {
} }
// Split items stack into chunks // Split items stack into chunks
const result: Item[][] = []; const result: IItem[][] = [];
let remainingCount = itemToSplit.upd.StackObjectsCount; let remainingCount = itemToSplit.upd.StackObjectsCount;
while (remainingCount) { while (remainingCount) {
const amount = Math.min(remainingCount, itemMaxStackSize); const amount = Math.min(remainingCount, itemMaxStackSize);
@ -762,16 +766,16 @@ export class ItemHelper {
/** /**
* Find Barter items from array of items * Find Barter items from array of items
* @param {string} by tpl or id * @param {string} by tpl or id
* @param {Item[]} itemsToSearch Array of items to iterate over * @param {IItem[]} itemsToSearch Array of items to iterate over
* @param {string} desiredBarterItemIds * @param {string} desiredBarterItemIds
* @returns Array of Item objects * @returns Array of Item objects
*/ */
public findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[] { public findBarterItems(by: "tpl" | "id", itemsToSearch: IItem[], desiredBarterItemIds: string | string[]): IItem[] {
// Find required items to take after buying (handles multiple items) // Find required items to take after buying (handles multiple items)
const desiredBarterIds = const desiredBarterIds =
typeof desiredBarterItemIds === "string" ? [desiredBarterItemIds] : desiredBarterItemIds; typeof desiredBarterItemIds === "string" ? [desiredBarterItemIds] : desiredBarterItemIds;
const matchingItems: Item[] = []; const matchingItems: IItem[] = [];
for (const barterId of desiredBarterIds) { for (const barterId of desiredBarterIds) {
const filterResult = itemsToSearch.filter((item) => { const filterResult = itemsToSearch.filter((item) => {
return by === "tpl" ? item._tpl === barterId : item._id === barterId; return by === "tpl" ? item._tpl === barterId : item._id === barterId;
@ -793,7 +797,7 @@ export class ItemHelper {
* @param itemWithChildren Item with mods to update * @param itemWithChildren Item with mods to update
* @param newId new id to add on chidren of base item * @param newId new id to add on chidren of base item
*/ */
public replaceRootItemID(itemWithChildren: Item[], newId = this.objectId.generate()): void { public replaceRootItemID(itemWithChildren: IItem[], newId = this.objectId.generate()): void {
// original id on base item // original id on base item
const oldId = itemWithChildren[0]._id; const oldId = itemWithChildren[0]._id;
@ -819,11 +823,11 @@ export class ItemHelper {
* @returns Item[] * @returns Item[]
*/ */
public replaceIDs( public replaceIDs(
originalItems: Item[], originalItems: IItem[],
pmcData?: IPmcData, pmcData?: IPmcData,
insuredItems?: IInsuredItem[], insuredItems?: IInsuredItem[],
fastPanel?: any, fastPanel?: any,
): Item[] { ): IItem[] {
let items = this.cloner.clone(originalItems); // Deep-clone the items to avoid mutation. let items = this.cloner.clone(originalItems); // Deep-clone the items to avoid mutation.
let serialisedInventory = this.jsonUtil.serialize(items); let serialisedInventory = this.jsonUtil.serialize(items);
const hideoutAreaStashes = Object.values(pmcData?.Inventory.hideoutAreaStashes ?? {}); const hideoutAreaStashes = Object.values(pmcData?.Inventory.hideoutAreaStashes ?? {});
@ -867,7 +871,7 @@ export class ItemHelper {
// fix duplicate id's // fix duplicate id's
const dupes: Record<string, number> = {}; const dupes: Record<string, number> = {};
const newParents: Record<string, Item[]> = {}; const newParents: Record<string, IItem[]> = {};
const childrenMapping = {}; const childrenMapping = {};
const oldToNewIds: Record<string, string[]> = {}; const oldToNewIds: Record<string, string[]> = {};
@ -925,7 +929,7 @@ export class ItemHelper {
* Modifies passed in items * Modifies passed in items
* @param items The list of items to mark as FiR * @param items The list of items to mark as FiR
*/ */
public setFoundInRaid(items: Item[]): void { public setFoundInRaid(items: IItem[]): void {
for (const item of items) { for (const item of items) {
if (!item.upd) { if (!item.upd) {
item.upd = {}; item.upd = {};
@ -995,7 +999,7 @@ export class ItemHelper {
* @param parent The parent of 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 undefined if the check cannot be performed. * @returns True if the item is actually moddable, false if it is not, and undefined if the check cannot be performed.
*/ */
public isRaidModdable(item: Item, parent: Item): boolean | undefined { public isRaidModdable(item: IItem, parent: IItem): boolean | undefined {
// This check requires the item to have the slotId property populated. // This check requires the item to have the slotId property populated.
if (!item.slotId) { if (!item.slotId) {
return undefined; return undefined;
@ -1037,7 +1041,7 @@ export class ItemHelper {
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @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 `undefined` if no such parent exists. * @returns The Item object representing the top-most parent of the given item, or `undefined` if no such parent exists.
*/ */
public getAttachmentMainParent(itemId: string, itemsMap: Map<string, Item>): Item | undefined { public getAttachmentMainParent(itemId: string, itemsMap: Map<string, IItem>): IItem | undefined {
let currentItem = itemsMap.get(itemId); let currentItem = itemsMap.get(itemId);
while (currentItem && this.isAttachmentAttached(currentItem)) { while (currentItem && this.isAttachmentAttached(currentItem)) {
currentItem = itemsMap.get(currentItem.parentId); currentItem = itemsMap.get(currentItem.parentId);
@ -1054,7 +1058,7 @@ export class ItemHelper {
* @param item The item to check. * @param item The item to check.
* @returns true if the item is attached attachment, otherwise false. * @returns true if the item is attached attachment, otherwise false.
*/ */
public isAttachmentAttached(item: Item): boolean { public isAttachmentAttached(item: IItem): boolean {
const equipmentSlots = Object.values(EquipmentSlots).map((value) => value as string); const equipmentSlots = Object.values(EquipmentSlots).map((value) => value as string);
return !( return !(
@ -1079,7 +1083,7 @@ export class ItemHelper {
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup. * @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 `undefined` if no such parent exists. * @returns The Item object representing the equipment parent of the given item, or `undefined` if no such parent exists.
*/ */
public getEquipmentParent(itemId: string, itemsMap: Map<string, Item>): Item | undefined { public getEquipmentParent(itemId: string, itemsMap: Map<string, IItem>): IItem | undefined {
let currentItem = itemsMap.get(itemId); let currentItem = itemsMap.get(itemId);
const equipmentSlots = Object.values(EquipmentSlots).map((value) => value as string); const equipmentSlots = Object.values(EquipmentSlots).map((value) => value as string);
@ -1098,7 +1102,7 @@ export class ItemHelper {
* @param rootItemId * @param rootItemId
* @returns ItemSize object (width and height) * @returns ItemSize object (width and height)
*/ */
public getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize { public getItemSize(items: IItem[], rootItemId: string): ItemHelper.IItemSize {
const rootTemplate = this.getItem(items.filter((x) => x._id === rootItemId)[0]._tpl)[1]; const rootTemplate = this.getItem(items.filter((x) => x._id === rootItemId)[0]._tpl)[1];
const width = rootTemplate._props.Width; const width = rootTemplate._props.Width;
const height = rootTemplate._props.Height; const height = rootTemplate._props.Height;
@ -1159,7 +1163,7 @@ export class ItemHelper {
* @param ammoBox Box to add cartridges to * @param ammoBox Box to add cartridges to
* @param ammoBoxDetails Item template from items db * @param ammoBoxDetails Item template from items db
*/ */
public addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void { public addCartridgesToAmmoBox(ammoBox: IItem[], ammoBoxDetails: ITemplateItem): void {
const ammoBoxMaxCartridgeCount = ammoBoxDetails._props.StackSlots[0]._max_count; const ammoBoxMaxCartridgeCount = ammoBoxDetails._props.StackSlots[0]._max_count;
const cartridgeTpl = ammoBoxDetails._props.StackSlots[0]._props.filters[0].Filter[0]; const cartridgeTpl = ammoBoxDetails._props.StackSlots[0]._props.filters[0].Filter[0];
const cartridgeDetails = this.getItem(cartridgeTpl); const cartridgeDetails = this.getItem(cartridgeTpl);
@ -1206,7 +1210,7 @@ export class ItemHelper {
* @param ammoBox Box to add cartridges to * @param ammoBox Box to add cartridges to
* @param ammoBoxDetails Item template from items db * @param ammoBoxDetails Item template from items db
*/ */
public addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void { public addSingleStackCartridgesToAmmoBox(ammoBox: IItem[], ammoBoxDetails: ITemplateItem): void {
const ammoBoxMaxCartridgeCount = ammoBoxDetails._props.StackSlots[0]._max_count; const ammoBoxMaxCartridgeCount = ammoBoxDetails._props.StackSlots[0]._max_count;
const cartridgeTpl = ammoBoxDetails._props.StackSlots[0]._props.filters[0].Filter[0]; const cartridgeTpl = ammoBoxDetails._props.StackSlots[0]._props.filters[0].Filter[0];
ammoBox.push( ammoBox.push(
@ -1227,7 +1231,7 @@ export class ItemHelper {
* @param items Inventory with child parent items to check * @param items Inventory with child parent items to check
* @returns True when item is in container * @returns True when item is in container
*/ */
public itemIsInsideContainer(itemToCheck: Item, desiredContainerSlotId: string, items: Item[]): boolean { public itemIsInsideContainer(itemToCheck: IItem, desiredContainerSlotId: string, items: IItem[]): boolean {
// Get items parent // Get items parent
const parent = items.find((item) => item._id === itemToCheck.parentId); const parent = items.find((item) => item._id === itemToCheck.parentId);
if (!parent) { if (!parent) {
@ -1253,7 +1257,7 @@ export class ItemHelper {
* @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist) * @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist)
*/ */
public fillMagazineWithRandomCartridge( public fillMagazineWithRandomCartridge(
magazine: Item[], magazine: IItem[],
magTemplate: ITemplateItem, magTemplate: ITemplateItem,
staticAmmoDist: Record<string, IStaticAmmoDetails[]>, staticAmmoDist: Record<string, IStaticAmmoDetails[]>,
caliber?: string, caliber?: string,
@ -1294,7 +1298,7 @@ export class ItemHelper {
* @param minSizeMultiplier % the magazine must be filled to * @param minSizeMultiplier % the magazine must be filled to
*/ */
public fillMagazineWithCartridge( public fillMagazineWithCartridge(
magazineWithChildCartridges: Item[], magazineWithChildCartridges: IItem[],
magTemplate: ITemplateItem, magTemplate: ITemplateItem,
cartridgeTpl: string, cartridgeTpl: string,
minSizeMultiplier = 0.25, minSizeMultiplier = 0.25,
@ -1450,7 +1454,7 @@ export class ItemHelper {
stackCount: number, stackCount: number,
location: number, location: number,
foundInRaid = false, foundInRaid = false,
): Item { ): IItem {
return { return {
_id: this.objectId.generate(), _id: this.objectId.generate(),
_tpl: ammoTpl, _tpl: ammoTpl,
@ -1466,7 +1470,7 @@ export class ItemHelper {
* @param item Item to get stack size of * @param item Item to get stack size of
* @returns size of stack * @returns size of stack
*/ */
public getItemStackSize(item: Item): number { public getItemStackSize(item: IItem): number {
if (item.upd?.StackObjectsCount) { if (item.upd?.StackObjectsCount) {
return item.upd.StackObjectsCount; return item.upd.StackObjectsCount;
} }
@ -1509,11 +1513,11 @@ export class ItemHelper {
* @returns Item with children * @returns Item with children
*/ */
public addChildSlotItems( public addChildSlotItems(
itemToAdd: Item[], itemToAdd: IItem[],
itemToAddTemplate: ITemplateItem, itemToAddTemplate: ITemplateItem,
modSpawnChanceDict?: Record<string, number>, modSpawnChanceDict?: Record<string, number>,
requiredOnly = false, requiredOnly = false,
): Item[] { ): IItem[] {
const result = itemToAdd; const result = itemToAdd;
const incompatibleModTpls: Set<string> = new Set(); const incompatibleModTpls: Set<string> = new Set();
for (const slot of itemToAddTemplate._props.Slots) { for (const slot of itemToAddTemplate._props.Slots) {
@ -1625,7 +1629,7 @@ export class ItemHelper {
* @param itemWithChildren Primary item + children of primary item * @param itemWithChildren Primary item + children of primary item
* @returns Item array with updated IDs * @returns Item array with updated IDs
*/ */
public reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[] { public reparentItemAndChildren(rootItem: IItem, itemWithChildren: IItem[]): IItem[] {
const oldRootId = itemWithChildren[0]._id; const oldRootId = itemWithChildren[0]._id;
const idMappings = {}; const idMappings = {};
@ -1664,7 +1668,7 @@ export class ItemHelper {
* @param newId Optional: new id to use * @param newId Optional: new id to use
* @returns New root id * @returns New root id
*/ */
public remapRootItemId(itemWithChildren: Item[], newId = this.hashUtil.generate()): string { public remapRootItemId(itemWithChildren: IItem[], newId = this.hashUtil.generate()): string {
const rootItemExistingId = itemWithChildren[0]._id; const rootItemExistingId = itemWithChildren[0]._id;
for (const item of itemWithChildren) { for (const item of itemWithChildren) {
@ -1693,7 +1697,7 @@ export class ItemHelper {
* @param items Array of Items that should be adjusted. * @param items Array of Items that should be adjusted.
* @returns Array of Items that have been adopted. * @returns Array of Items that have been adopted.
*/ */
public adoptOrphanedItems(rootId: string, items: Item[]): Item[] { public adoptOrphanedItems(rootId: string, items: IItem[]): IItem[] {
for (const item of items) { for (const item of items) {
// Check if the item's parent exists. // Check if the item's parent exists.
const parentExists = items.some((parentItem) => parentItem._id === item.parentId); const parentExists = items.some((parentItem) => parentItem._id === item.parentId);
@ -1716,8 +1720,8 @@ export class ItemHelper {
* @param items An array of Items that should be added to a Map. * @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. * @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
*/ */
public generateItemsMap(items: Item[]): Map<string, Item> { public generateItemsMap(items: IItem[]): Map<string, IItem> {
const itemsMap = new Map<string, Item>(); const itemsMap = new Map<string, IItem>();
for (const item of items) { for (const item of items) {
itemsMap.set(item._id, item); itemsMap.set(item._id, item);
} }
@ -1730,7 +1734,7 @@ export class ItemHelper {
* @param warningMessageWhenMissing text to write to log when upd object was not found * @param warningMessageWhenMissing text to write to log when upd object was not found
* @returns True when upd object was added * @returns True when upd object was added
*/ */
public addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean { public addUpdObjectToItem(item: IItem, warningMessageWhenMissing?: string): boolean {
if (!item.upd) { if (!item.upd) {
item.upd = {}; item.upd = {};
@ -1769,7 +1773,7 @@ export class ItemHelper {
} }
namespace ItemHelper { namespace ItemHelper {
export interface ItemSize { export interface IItemSize {
width: number; width: number;
height: number; height: number;
} }

View File

@ -8,7 +8,7 @@ import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Common, IQuestStatus } from "@spt/models/eft/common/tables/IBotBase"; import { Common, IQuestStatus } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IQuest, IQuestCondition, IQuestReward } from "@spt/models/eft/common/tables/IQuest"; import { IQuest, IQuestCondition, IQuestReward } from "@spt/models/eft/common/tables/IQuest";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
@ -242,11 +242,11 @@ export class QuestHelper {
* @param questReward Reward item to fix * @param questReward Reward item to fix
* @returns Fixed rewards * @returns Fixed rewards
*/ */
protected processReward(questReward: IQuestReward): Item[] { protected processReward(questReward: IQuestReward): IItem[] {
/** item with mods to return */ /** item with mods to return */
let rewardItems: Item[] = []; let rewardItems: IItem[] = [];
let targets: Item[] = []; let targets: IItem[] = [];
const mods: Item[] = []; const mods: IItem[] = [];
// Is armor item that may need inserts / plates // Is armor item that may need inserts / plates
if (questReward.items.length === 1 && this.itemHelper.armorItemCanHoldMods(questReward.items[0]._tpl)) { if (questReward.items.length === 1 && this.itemHelper.armorItemCanHoldMods(questReward.items[0]._tpl)) {
@ -314,12 +314,12 @@ export class QuestHelper {
* @param originalRewardRootItem Original armor reward item from IQuestReward.items object * @param originalRewardRootItem Original armor reward item from IQuestReward.items object
* @param questReward Armor reward from quest * @param questReward Armor reward from quest
*/ */
protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void { protected generateArmorRewardChildSlots(originalRewardRootItem: IItem, questReward: IQuestReward): void {
// Look for a default preset from globals for armor // Look for a default preset from globals for armor
const defaultPreset = this.presetHelper.getDefaultPreset(originalRewardRootItem._tpl); const defaultPreset = this.presetHelper.getDefaultPreset(originalRewardRootItem._tpl);
if (defaultPreset) { if (defaultPreset) {
// Found preset, use mods to hydrate reward item // Found preset, use mods to hydrate reward item
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
const newRootId = this.itemHelper.remapRootItemId(presetAndMods); const newRootId = this.itemHelper.remapRootItemId(presetAndMods);
questReward.items = presetAndMods; questReward.items = presetAndMods;
@ -353,7 +353,7 @@ export class QuestHelper {
* @param status Quest status that holds the items (Started, Success, Fail) * @param status Quest status that holds the items (Started, Success, Fail)
* @returns array of items with the correct maxStack * @returns array of items with the correct maxStack
*/ */
public getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[] { public getQuestRewardItems(quest: IQuest, status: QuestStatus): IItem[] {
// Iterate over all rewards with the desired status, flatten out items that have a type of Item // Iterate over all rewards with the desired status, flatten out items that have a type of Item
const questRewards = quest.rewards[QuestStatus[status]].flatMap((reward: IQuestReward) => const questRewards = quest.rewards[QuestStatus[status]].flatMap((reward: IQuestReward) =>
reward.type === "Item" ? this.processReward(reward) : [], reward.type === "Item" ? this.processReward(reward) : [],
@ -645,7 +645,7 @@ export class QuestHelper {
protected addItemStackSizeChangeIntoEventResponse( protected addItemStackSizeChangeIntoEventResponse(
output: IItemEventRouterResponse, output: IItemEventRouterResponse,
sessionId: string, sessionId: string,
item: Item, item: IItem,
): void { ): void {
output.profileChanges[sessionId].items.change.push({ output.profileChanges[sessionId].items.change.push({
_id: item._id, _id: item._id,
@ -862,7 +862,7 @@ export class QuestHelper {
state: QuestStatus, state: QuestStatus,
sessionId: string, sessionId: string,
questResponse: IItemEventRouterResponse, questResponse: IItemEventRouterResponse,
): Item[] { ): IItem[] {
// Repeatable quest base data is always in PMCProfile, `profileData` may be scav profile // Repeatable quest base data is always in PMCProfile, `profileData` may be scav profile
// TODO: consider moving repeatable quest data to profile-agnostic location // TODO: consider moving repeatable quest data to profile-agnostic location
const pmcProfile = this.profileHelper.getPmcProfile(sessionId); const pmcProfile = this.profileHelper.getPmcProfile(sessionId);

View File

@ -2,7 +2,7 @@ import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper"; import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper";
import { UtilityHelper } from "@spt/helpers/UtilityHelper"; import { UtilityHelper } from "@spt/helpers/UtilityHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITraderAssort } from "@spt/models/eft/common/tables/ITrader"; import { ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData"; import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -130,7 +130,7 @@ export class RagfairHelper {
* Iterate over array of identical items and merge stack count * Iterate over array of identical items and merge stack count
* Ragfair allows abnormally large stacks. * Ragfair allows abnormally large stacks.
*/ */
public mergeStackable(items: Item[]): Item[] { public mergeStackable(items: IItem[]): IItem[] {
const list = []; const list = [];
let rootItem = undefined; let rootItem = undefined;

View File

@ -9,7 +9,7 @@ import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { RagfairSortHelper } from "@spt/helpers/RagfairSortHelper"; import { RagfairSortHelper } from "@spt/helpers/RagfairSortHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITraderAssort } from "@spt/models/eft/common/tables/ITrader"; import { ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { ISptProfile, ISystemData } from "@spt/models/eft/profile/ISptProfile"; import { ISptProfile, ISystemData } from "@spt/models/eft/profile/ISptProfile";
@ -334,7 +334,7 @@ export class RagfairOfferHelper {
* @param itemsInInventoryToList items to sum up * @param itemsInInventoryToList items to sum up
* @returns Total count * @returns Total count
*/ */
public getTotalStackCountSize(itemsInInventoryToList: Item[][]): number { public getTotalStackCountSize(itemsInInventoryToList: IItem[][]): number {
let total = 0; let total = 0;
for (const itemAndChildren of itemsInInventoryToList) { for (const itemAndChildren of itemsInInventoryToList) {
// Only count the root items stack count in total // Only count the root items stack count in total
@ -402,7 +402,7 @@ export class RagfairOfferHelper {
*/ */
public completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse { public completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse {
const itemTpl = offer.items[0]._tpl; const itemTpl = offer.items[0]._tpl;
let paymentItemsToSendToPlayer: Item[] = []; let paymentItemsToSendToPlayer: IItem[] = [];
const offerStackCount = offer.items[0].upd.StackObjectsCount; const offerStackCount = offer.items[0].upd.StackObjectsCount;
// Pack or ALL items of a multi-offer were bought - remove entire ofer // Pack or ALL items of a multi-offer were bought - remove entire ofer
@ -418,7 +418,7 @@ export class RagfairOfferHelper {
// Assemble payment to send to seller now offer was purchased // Assemble payment to send to seller now offer was purchased
for (const requirement of offer.requirements) { for (const requirement of offer.requirements) {
// Create an item template item // Create an item template item
const requestedItem: Item = { const requestedItem: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: requirement._tpl, _tpl: requirement._tpl,
upd: { StackObjectsCount: requirement.count * boughtAmount }, upd: { StackObjectsCount: requirement.count * boughtAmount },
@ -598,7 +598,7 @@ export class RagfairOfferHelper {
* @param offer The flea offer * @param offer The flea offer
* @returns True if the given item is functional * @returns True if the given item is functional
*/ */
public isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean { public isItemFunctional(offerRootItem: IItem, offer: IRagfairOffer): boolean {
// Non-presets are always functional // Non-presets are always functional
if (!this.presetHelper.hasPreset(offerRootItem._tpl)) { if (!this.presetHelper.hasPreset(offerRootItem._tpl)) {
return true; return true;
@ -712,7 +712,7 @@ export class RagfairOfferHelper {
* @param item Item to check * @param item Item to check
* @returns True if has condition * @returns True if has condition
*/ */
protected isConditionItem(item: Item): boolean { protected isConditionItem(item: IItem): boolean {
// thanks typescript, undefined assertion is not returnable since it // thanks typescript, undefined assertion is not returnable since it
// tries to return a multitype object // tries to return a multitype object
return !!( return !!(
@ -732,7 +732,7 @@ export class RagfairOfferHelper {
* @param max Desired maximum quality * @param max Desired maximum quality
* @returns True if in range * @returns True if in range
*/ */
protected itemQualityInRange(item: Item, min: number, max: number): boolean { protected itemQualityInRange(item: IItem, min: number, max: number): boolean {
const itemQualityPercentage = 100 * this.itemHelper.getItemQualityModifier(item); const itemQualityPercentage = 100 * this.itemHelper.getItemQualityModifier(item);
if (min > 0 && min > itemQualityPercentage) { if (min > 0 && min > itemQualityPercentage) {
// Item condition too low // Item condition too low

View File

@ -1,4 +1,4 @@
import { SellResult } from "@spt/models/eft/ragfair/IRagfairOffer"; import { ISellResult } from "@spt/models/eft/ragfair/IRagfairOffer";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger"; import { ILogger } from "@spt/models/spt/utils/ILogger";
@ -63,7 +63,7 @@ export class RagfairSellHelper {
* @param sellInOneGo All items listed get sold at once * @param sellInOneGo All items listed get sold at once
* @returns Array of purchases of item(s) listed * @returns Array of purchases of item(s) listed
*/ */
public rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo = false): SellResult[] { public rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo = false): ISellResult[] {
const startTime = this.timeUtil.getTimestamp(); const startTime = this.timeUtil.getTimestamp();
// Get a time in future to stop simulating sell chances at // Get a time in future to stop simulating sell chances at
@ -73,7 +73,7 @@ export class RagfairSellHelper {
let sellTime = startTime; let sellTime = startTime;
let remainingCount = itemSellCount; let remainingCount = itemSellCount;
const result: SellResult[] = []; const result: ISellResult[] = [];
// Value can sometimes be NaN for whatever reason, default to base chance if that happens // Value can sometimes be NaN for whatever reason, default to base chance if that happens
const effectiveSellChance = Number.isNaN(sellChancePercent) const effectiveSellChance = Number.isNaN(sellChancePercent)

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -135,7 +135,7 @@ export class RagfairServerHelper {
* @param sessionID Player to send items to * @param sessionID Player to send items to
* @param returnedItems Items to send to player * @param returnedItems Items to send to player
*/ */
public returnItems(sessionID: string, returnedItems: Item[]): void { public returnItems(sessionID: string, returnedItems: IItem[]): void {
this.mailSendService.sendLocalisedNpcMessageToPlayer( this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID, sessionID,
this.traderHelper.getTraderById(Traders.RAGMAN), this.traderHelper.getTraderById(Traders.RAGMAN),
@ -207,7 +207,7 @@ export class RagfairServerHelper {
* @param item Preset item * @param item Preset item
* @returns Array of weapon and its children * @returns Array of weapon and its children
*/ */
public getPresetItems(item: Item): Item[] { public getPresetItems(item: IItem): IItem[] {
const preset = this.cloner.clone(this.databaseService.getGlobals().ItemPresets[item._id]._items); const preset = this.cloner.clone(this.databaseService.getGlobals().ItemPresets[item._id]._items);
return this.itemHelper.reparentItemAndChildren(item, preset); return this.itemHelper.reparentItemAndChildren(item, preset);
} }
@ -217,7 +217,7 @@ export class RagfairServerHelper {
* @param item Preset item * @param item Preset item
* @returns * @returns
*/ */
public getPresetItemsByTpl(item: Item): Item[] { public getPresetItemsByTpl(item: IItem): IItem[] {
const presets = []; const presets = [];
for (const itemId in this.databaseService.getGlobals().ItemPresets) { for (const itemId in this.databaseService.getGlobals().ItemPresets) {
if (this.databaseService.getGlobals().ItemPresets[itemId]._items[0]._tpl === item._tpl) { if (this.databaseService.getGlobals().ItemPresets[itemId]._items[0]._tpl === item._tpl) {

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem, Props } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem, Props } from "@spt/models/eft/common/tables/ITemplateItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IRepairConfig } from "@spt/models/spt/config/IRepairConfig"; import { IRepairConfig } from "@spt/models/spt/config/IRepairConfig";
@ -34,7 +34,7 @@ export class RepairHelper {
* @param applyMaxDurabilityDegradation should item have max durability reduced * @param applyMaxDurabilityDegradation should item have max durability reduced
*/ */
public updateItemDurability( public updateItemDurability(
itemToRepair: Item, itemToRepair: IItem,
itemToRepairDetails: ITemplateItem, itemToRepairDetails: ITemplateItem,
isArmor: boolean, isArmor: boolean,
amountToRepair: number, amountToRepair: number,

View File

@ -1,10 +1,10 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
export interface OwnerInventoryItems { export interface IOwnerInventoryItems {
from: Item[]; from: IItem[];
to: Item[]; to: IItem[];
sameInventory: boolean; sameInventory: boolean;
isMail: boolean; isMail: boolean;
} }
@ -18,7 +18,7 @@ export class SecureContainerHelper {
* @param items Inventory items to look for secure container in * @param items Inventory items to look for secure container in
* @returns Array of ids * @returns Array of ids
*/ */
public getSecureContainerItems(items: Item[]): string[] { public getSecureContainerItems(items: IItem[]): string[] {
const secureContainer = items.find((x) => x.slotId === "SecuredContainer"); const secureContainer = items.find((x) => x.slotId === "SecuredContainer");
// No container found, drop out // No container found, drop out

View File

@ -3,7 +3,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper"; import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest"; import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
@ -70,7 +70,7 @@ export class TradeHelper {
foundInRaid: boolean, foundInRaid: boolean,
output: IItemEventRouterResponse, output: IItemEventRouterResponse,
): void { ): void {
let offerItems: Item[] = []; let offerItems: IItem[] = [];
let buyCallback: (buyCount: number) => void; let buyCallback: (buyCount: number) => void;
if (buyRequestData.tid.toLocaleLowerCase() === "ragfair") { if (buyRequestData.tid.toLocaleLowerCase() === "ragfair") {
buyCallback = (buyCount: number) => { buyCallback = (buyCount: number) => {
@ -188,7 +188,7 @@ export class TradeHelper {
let itemsToSendRemaining = itemsToSendTotalCount; let itemsToSendRemaining = itemsToSendTotalCount;
// Construct array of items to send to player // Construct array of items to send to player
const itemsToSendToPlayer: Item[][] = []; const itemsToSendToPlayer: IItem[][] = [];
while (itemsToSendRemaining > 0) { while (itemsToSendRemaining > 0) {
const offerClone = this.cloner.clone(offerItems); const offerClone = this.cloner.clone(offerItems);
// Handle stackable items that have a max stack size limit // Handle stackable items that have a max stack size limit
@ -366,7 +366,7 @@ export class TradeHelper {
sessionId: string, sessionId: string,
pmcData: IPmcData, pmcData: IPmcData,
traderId: string, traderId: string,
assortBeingPurchased: Item, assortBeingPurchased: IItem,
assortId: string, assortId: string,
count: number, count: number,
): void { ): void {

View File

@ -4,7 +4,7 @@ import { AssortHelper } from "@spt/helpers/AssortHelper";
import { PaymentHelper } from "@spt/helpers/PaymentHelper"; import { PaymentHelper } from "@spt/helpers/PaymentHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITrader, ITraderAssort } from "@spt/models/eft/common/tables/ITrader"; import { ITrader, ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { Traders } from "@spt/models/enums/Traders"; import { Traders } from "@spt/models/enums/Traders";
@ -141,7 +141,7 @@ export class TraderAssortHelper {
* @param itemsTplsToRemove Item TPLs the assort should not have * @param itemsTplsToRemove Item TPLs the assort should not have
*/ */
protected removeItemsFromAssort(assortToFilter: ITraderAssort, itemsTplsToRemove: string[]): void { protected removeItemsFromAssort(assortToFilter: ITraderAssort, itemsTplsToRemove: string[]): void {
function isValid(item: Item, blacklist: string[]): boolean { function isValid(item: IItem, blacklist: string[]): boolean {
// Is root item + blacklisted // Is root item + blacklisted
if (item.parentId === "hideout" && blacklist.includes(item._tpl)) { if (item.parentId === "hideout" && blacklist.includes(item._tpl)) {
// We want it gone // We want it gone
@ -158,7 +158,7 @@ export class TraderAssortHelper {
* Reset every traders root item `BuyRestrictionCurrent` property to 0 * Reset every traders root item `BuyRestrictionCurrent` property to 0
* @param assortItems Items to adjust * @param assortItems Items to adjust
*/ */
protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void { protected resetBuyRestrictionCurrentValue(assortItems: IItem[]): void {
// iterate over root items // iterate over root items
for (const assort of assortItems.filter((item) => item.slotId === "hideout")) { for (const assort of assortItems.filter((item) => item.slotId === "hideout")) {
// no value to adjust // no value to adjust
@ -246,7 +246,7 @@ export class TraderAssortHelper {
* @param traderId trader id * @param traderId trader id
* @returns array of Items * @returns array of Items
*/ */
protected getPristineTraderAssorts(traderId: string): Item[] { protected getPristineTraderAssorts(traderId: string): IItem[] {
return this.cloner.clone(this.traderAssortService.getPristineTraderAssort(traderId).items); return this.cloner.clone(this.traderAssortService.getPristineTraderAssort(traderId).items);
} }

View File

@ -4,7 +4,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { BanType } from "@spt/models/eft/common/tables/IBotBase"; import { BanType } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IProfileTraderTemplate } from "@spt/models/eft/common/tables/IProfileTemplate"; import { IProfileTraderTemplate } from "@spt/models/eft/common/tables/IProfileTemplate";
import { ITraderAssort, ITraderBase, ITraderLoyaltyLevel } from "@spt/models/eft/common/tables/ITrader"; import { ITraderAssort, ITraderBase, ITraderLoyaltyLevel } from "@spt/models/eft/common/tables/ITrader";
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile"; import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
@ -90,7 +90,7 @@ export class TraderHelper {
* @param assortId Id of assort to find * @param assortId Id of assort to find
* @returns Item object * @returns Item object
*/ */
public getTraderAssortItemByAssortId(traderId: string, assortId: string): Item | undefined { public getTraderAssortItemByAssortId(traderId: string, assortId: string): IItem | undefined {
const traderAssorts = this.getTraderAssortsByTraderId(traderId); const traderAssorts = this.getTraderAssortsByTraderId(traderId);
if (!traderAssorts) { if (!traderAssorts) {
this.logger.debug(`No assorts on trader: ${traderId} found`); this.logger.debug(`No assorts on trader: ${traderId} found`);
@ -362,7 +362,7 @@ export class TraderHelper {
public addTraderPurchasesToPlayerProfile( public addTraderPurchasesToPlayerProfile(
sessionID: string, sessionID: string,
newPurchaseDetails: { items: { itemId: string; count: number }[]; traderId: string }, newPurchaseDetails: { items: { itemId: string; count: number }[]; traderId: string },
itemPurchased: Item, itemPurchased: IItem,
): void { ): void {
const profile = this.profileHelper.getFullProfile(sessionID); const profile = this.profileHelper.getFullProfile(sessionID);
const traderId = newPurchaseDetails.traderId; const traderId = newPurchaseDetails.traderId;

View File

@ -12,7 +12,7 @@ export class BundleInfo {
crc: number; crc: number;
dependencies: string[]; dependencies: string[];
constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number) { constructor(modpath: string, bundle: IBundleManifestEntry, bundleHash: number) {
this.modpath = modpath; this.modpath = modpath;
this.filename = bundle.key; this.filename = bundle.key;
this.crc = bundleHash; this.crc = bundleHash;
@ -50,7 +50,7 @@ export class BundleLoader {
} }
public addBundles(modpath: string): void { public addBundles(modpath: string): void {
const bundleManifestArr = this.jsonUtil.deserialize<BundleManifest>( const bundleManifestArr = this.jsonUtil.deserialize<IBundleManifest>(
this.vfs.readFile(`${modpath}bundles.json`), this.vfs.readFile(`${modpath}bundles.json`),
).manifest; ).manifest;
@ -73,11 +73,11 @@ export class BundleLoader {
} }
} }
export interface BundleManifest { export interface IBundleManifest {
manifest: BundleManifestEntry[]; manifest: IBundleManifestEntry[];
} }
export interface BundleManifestEntry { export interface IBundleManifestEntry {
key: string; key: string;
dependencyKeys: string[]; dependencyKeys: string[];
} }

View File

@ -1,8 +1,8 @@
export interface IGenerateBotsRequestData { export interface IGenerateBotsRequestData {
conditions: Condition[]; conditions: ICondition[];
} }
export interface Condition { export interface ICondition {
/** e.g. assault/pmcBot/bossKilla */ /** e.g. assault/pmcBot/bossKilla */
Role: string; Role: string;
Limit: number; Limit: number;

View File

@ -1,5 +1,5 @@
import { Ixyz } from "@spt/models/eft/common/Ixyz"; import { Ixyz } from "@spt/models/eft/common/Ixyz";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IGlobals { export interface IGlobals {
time: number; time: number;
@ -539,10 +539,10 @@ export interface IKarmaCalculationSettings {
} }
export interface IArenaEftTransferSettings { export interface IArenaEftTransferSettings {
ArenaEftTransferSettings: ArenaEftTransferSettings; ArenaEftTransferSettings: IArenaEftTransferSettings;
} }
export interface ArenaEftTransferSettings { export interface IArenaEftTransferSettings {
ArenaManagerReputationTaxMultiplier: number; ArenaManagerReputationTaxMultiplier: number;
CharismaTaxMultiplier: number; CharismaTaxMultiplier: number;
CreditPriceTaxMultiplier: number; CreditPriceTaxMultiplier: number;
@ -1847,7 +1847,7 @@ export interface IPreset {
_changeWeaponName: boolean; _changeWeaponName: boolean;
_name: string; _name: string;
_parent: string; _parent: string;
_items: Item[]; _items: IItem[];
/** Default presets have this property */ /** Default presets have this property */
_encyclopedia?: string; _encyclopedia?: string;
} }

View File

@ -1,7 +1,7 @@
import { IExit, ILocationBase } from "@spt/models/eft/common/ILocationBase"; import { IExit, ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { IGroupPostion, ILooseLoot } from "@spt/models/eft/common/ILooseLoot"; import { IGroupPostion, ILooseLoot } from "@spt/models/eft/common/ILooseLoot";
import { Ixyz } from "@spt/models/eft/common/Ixyz"; import { Ixyz } from "@spt/models/eft/common/Ixyz";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface ILocation { export interface ILocation {
/** Map meta-data */ /** Map meta-data */
@ -61,11 +61,11 @@ export interface IStaticPropsBase {
IsAlwaysSpawn: boolean; IsAlwaysSpawn: boolean;
GroupPositions: IGroupPostion[]; GroupPositions: IGroupPostion[];
Root: string; Root: string;
Items: Item[]; Items: IItem[];
} }
export interface IStaticWeaponProps extends IStaticPropsBase { export interface IStaticWeaponProps extends IStaticPropsBase {
Items: Item[]; Items: IItem[];
} }
export interface IStaticContainerDetails { export interface IStaticContainerDetails {

View File

@ -1,5 +1,5 @@
import { Ixyz } from "@spt/models/eft/common/Ixyz"; import { Ixyz } from "@spt/models/eft/common/Ixyz";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface ILooseLoot { export interface ILooseLoot {
spawnpointCount: ISpawnpointCount; spawnpointCount: ISpawnpointCount;
@ -29,7 +29,7 @@ export interface ISpawnpointTemplate {
IsGroupPosition: boolean; IsGroupPosition: boolean;
GroupPositions: IGroupPostion[]; GroupPositions: IGroupPostion[];
Root: string; Root: string;
Items: Item[]; Items: IItem[];
} }
export interface IGroupPostion { export interface IGroupPostion {

View File

@ -1,4 +1,4 @@
import { Item, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpd } from "@spt/models/eft/common/tables/IItem";
import { IPmcDataRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests"; import { IPmcDataRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
import { BonusSkillType } from "@spt/models/enums/BonusSkillType"; import { BonusSkillType } from "@spt/models/enums/BonusSkillType";
@ -159,7 +159,7 @@ export interface ICurrentMax {
} }
export interface IInventory { export interface IInventory {
items: Item[]; items: IItem[];
equipment: string; equipment: string;
stash: string; stash: string;
sortingTable: string; sortingTable: string;
@ -168,7 +168,7 @@ export interface IInventory {
/** Key is hideout area enum numeric as string e.g. "24", value is area _id */ /** Key is hideout area enum numeric as string e.g. "24", value is area _id */
hideoutAreaStashes: Record<string, string>; hideoutAreaStashes: Record<string, string>;
fastPanel: Record<string, string>; fastPanel: Record<string, string>;
favoriteItems: Item[]; favoriteItems: IItem[];
} }
export interface IBaseJsonSkills { export interface IBaseJsonSkills {
@ -369,7 +369,7 @@ export interface IProductive {
SkipTime?: number; SkipTime?: number;
/** Seconds needed to fully craft */ /** Seconds needed to fully craft */
ProductionTime?: number; ProductionTime?: number;
GivenItemsInStart?: Item[]; GivenItemsInStart?: IItem[];
Interrupted?: boolean; Interrupted?: boolean;
Code?: string; Code?: string;
Decoded?: boolean; Decoded?: boolean;
@ -384,7 +384,7 @@ export interface IProductive {
/** Is the craft a Continuous, e.g bitcoins/water collector */ /** Is the craft a Continuous, e.g bitcoins/water collector */
sptIsContinuous?: boolean; sptIsContinuous?: boolean;
/** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */ /** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */
sptRequiredTools?: Item[]; sptRequiredTools?: IItem[];
// Craft is cultist circle sacrifice // Craft is cultist circle sacrifice
sptIsCultistCircle?: boolean; sptIsCultistCircle?: boolean;
} }
@ -402,7 +402,7 @@ export interface IScavCase extends IProductive {
export interface IProduct { export interface IProduct {
_id: string; _id: string;
_tpl: string; _tpl: string;
upd?: Upd; upd?: IUpd;
} }
export interface IBotHideoutArea { export interface IBotHideoutArea {
@ -426,7 +426,7 @@ export interface IHideoutSlot {
export interface IHideoutItem { export interface IHideoutItem {
_id: string; _id: string;
_tpl: string; _tpl: string;
upd?: Upd; upd?: IUpd;
} }
export interface ILastCompleted { export interface ILastCompleted {
@ -437,8 +437,6 @@ export interface INotes {
Notes: INote[]; Notes: INote[];
} }
export type CarExtractCounts = {};
export enum SurvivorClass { export enum SurvivorClass {
UNKNOWN = 0, UNKNOWN = 0,
NEUTRALIZER = 1, NEUTRALIZER = 1,

View File

@ -2,19 +2,19 @@ import { MinMax } from "@spt/models/common/MinMax";
import { ISkills } from "@spt/models/eft/common/tables/IBotBase"; import { ISkills } from "@spt/models/eft/common/tables/IBotBase";
export interface IBotType { export interface IBotType {
appearance: Appearance; appearance: IAppearance;
chances: Chances; chances: IChances;
difficulty: Difficulties; difficulty: IDifficulties;
experience: Experience; experience: IExperience;
firstName: string[]; firstName: string[];
generation: Generation; generation: IGeneration;
health: Health; health: IHealth;
inventory: Inventory; inventory: IInventory;
lastName: string[]; lastName: string[];
skills: ISkills; skills: ISkills;
} }
export interface Appearance { export interface IAppearance {
body: Record<string, number>; body: Record<string, number>;
feet: Record<string, number>; feet: Record<string, number>;
hands: Record<string, number>; hands: Record<string, number>;
@ -22,10 +22,10 @@ export interface Appearance {
voice: Record<string, number>; voice: Record<string, number>;
} }
export interface Chances { export interface IChances {
equipment: EquipmentChances; equipment: EquipmentChances;
weaponMods: ModsChances; weaponMods: IModsChances;
equipmentMods: ModsChances; equipmentMods: IModsChances;
} }
export interface EquipmentChances { export interface EquipmentChances {
@ -45,7 +45,7 @@ export interface EquipmentChances {
TacticalVest: number; TacticalVest: number;
} }
export interface ModsChances { export interface IModsChances {
mod_charge: number; mod_charge: number;
mod_equipment: number; mod_equipment: number;
mod_equipment_000: number; mod_equipment_000: number;
@ -80,14 +80,14 @@ export interface ModsChances {
mod_handguard: number; mod_handguard: number;
} }
export interface Difficulties { export interface IDifficulties {
easy: Difficulty; easy: IDifficultyCategories;
normal: Difficulty; normal: IDifficultyCategories;
hard: Difficulty; hard: IDifficultyCategories;
impossible: Difficulty; impossible: IDifficultyCategories;
} }
export interface Difficulty { export interface IDifficultyCategories {
Aiming: Record<string, string | number | boolean>; Aiming: Record<string, string | number | boolean>;
Boss: Record<string, string | number | boolean>; Boss: Record<string, string | number | boolean>;
Change: Record<string, string | number | boolean>; Change: Record<string, string | number | boolean>;
@ -104,47 +104,47 @@ export interface Difficulty {
Shoot: Record<string, string | number | boolean>; Shoot: Record<string, string | number | boolean>;
} }
export interface Experience { export interface IExperience {
aggressorBonus: number; aggressorBonus: number;
level: MinMax; level: MinMax;
reward: MinMax; reward: MinMax;
standingForKill: number; standingForKill: number;
} }
export interface Generation { export interface IGeneration {
items: GenerationWeightingItems; items: IGenerationWeightingItems;
} }
export interface GenerationWeightingItems { export interface IGenerationWeightingItems {
grenades: GenerationData; grenades: IGenerationData;
healing: GenerationData; healing: IGenerationData;
drugs: GenerationData; drugs: IGenerationData;
food: GenerationData; food: IGenerationData;
drink: GenerationData; drink: IGenerationData;
currency: GenerationData; currency: IGenerationData;
stims: GenerationData; stims: IGenerationData;
backpackLoot: GenerationData; backpackLoot: IGenerationData;
pocketLoot: GenerationData; pocketLoot: IGenerationData;
vestLoot: GenerationData; vestLoot: IGenerationData;
magazines: GenerationData; magazines: IGenerationData;
specialItems: GenerationData; specialItems: IGenerationData;
} }
export interface GenerationData { export interface IGenerationData {
/** key: number of items, value: weighting */ /** key: number of items, value: weighting */
weights: Record<string, number>; weights: Record<string, number>;
/** Array of item tpls */ /** Array of item tpls */
whitelist: Record<string, number>; whitelist: Record<string, number>;
} }
export interface Health { export interface IHealth {
BodyParts: BodyPart[]; BodyParts: IBodyPart[];
Energy: MinMax; Energy: MinMax;
Hydration: MinMax; Hydration: MinMax;
Temperature: MinMax; Temperature: MinMax;
} }
export interface BodyPart { export interface IBodyPart {
Chest: MinMax; Chest: MinMax;
Head: MinMax; Head: MinMax;
LeftArm: MinMax; LeftArm: MinMax;
@ -154,14 +154,14 @@ export interface BodyPart {
Stomach: MinMax; Stomach: MinMax;
} }
export interface Inventory { export interface IInventory {
equipment: Equipment; equipment: IEquipment;
Ammo: Record<string, Record<string, number>>; Ammo: IAmmo;
items: Items; items: IItemPools;
mods: Mods; mods: IMods;
} }
export interface Equipment { export interface IEquipment {
ArmBand: Record<string, number>; ArmBand: Record<string, number>;
ArmorVest: Record<string, number>; ArmorVest: Record<string, number>;
Backpack: Record<string, number>; Backpack: Record<string, number>;
@ -178,7 +178,7 @@ export interface Equipment {
TacticalVest: Record<string, number>; TacticalVest: Record<string, number>;
} }
export interface Items { export interface IItemPools {
Backpack: Record<string, number>; Backpack: Record<string, number>;
Pockets: Record<string, number>; Pockets: Record<string, number>;
SecuredContainer: Record<string, number>; SecuredContainer: Record<string, number>;
@ -186,4 +186,5 @@ export interface Items {
TacticalVest: Record<string, number>; TacticalVest: Record<string, number>;
} }
export type Mods = Record<string, Record<string, string[]>>; export type IAmmo = Record<string, Record<string, number>>;
export type IMods = Record<string, Record<string, string[]>>;

View File

@ -19,14 +19,14 @@ export interface Props {
Body: string; Body: string;
Hands: string; Hands: string;
Feet: string; Feet: string;
Prefab: Prefab; Prefab: IPrefab;
WatchPrefab: Prefab; WatchPrefab: IPrefab;
IntegratedArmorVest: boolean; IntegratedArmorVest: boolean;
WatchPosition: Ixyz; WatchPosition: Ixyz;
WatchRotation: Ixyz; WatchRotation: Ixyz;
} }
export interface Prefab { export interface IPrefab {
path: string; path: string;
rcid: string; rcid: string;
} }

View File

@ -1,117 +1,126 @@
export interface Item { export interface IItem {
_id: string; _id: string;
_tpl: string; _tpl: string;
parentId?: string; parentId?: string;
slotId?: string; slotId?: string;
location?: Location | number; location?: IItemLocation | number;
upd?: Upd; upd?: IUpd;
} }
export interface Upd { export interface IItemLocation {
Buff?: Buff; x: number;
y: number;
r: string | number;
isSearched?: boolean;
/** SPT property? */
rotation?: string | boolean;
}
export interface IUpd {
Buff?: IUpdBuff;
OriginalStackObjectsCount?: number; OriginalStackObjectsCount?: number;
Togglable?: Togglable; Togglable?: IUpdTogglable;
Map?: Map; Map?: IUpdMap;
Tag?: Tag; Tag?: IUpdTag;
/** SPT specific property, not made by BSG */ /** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: IUpdFaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;
UnlimitedCount?: boolean; UnlimitedCount?: boolean;
Repairable?: Repairable; Repairable?: IUpdRepairable;
RecodableComponent?: RecodableComponent; RecodableComponent?: IUpdRecodableComponent;
FireMode?: FireMode; FireMode?: IUpdFireMode;
SpawnedInSession?: boolean; SpawnedInSession?: boolean;
Light?: Light; Light?: IUpdLight;
Key?: Key; Key?: IUpdKey;
Resource?: Resource; Resource?: IUpdResource;
Sight?: Sight; Sight?: IUpdSight;
MedKit?: MedKit; MedKit?: IUpdMedKit;
FoodDrink?: FoodDrink; FoodDrink?: IUpdFoodDrink;
Dogtag?: Dogtag; Dogtag?: IUpdDogtag;
BuyRestrictionMax?: number; BuyRestrictionMax?: number;
BuyRestrictionCurrent?: number; BuyRestrictionCurrent?: number;
Foldable?: Foldable; Foldable?: IUpdFoldable;
SideEffect?: SideEffect; SideEffect?: IUpdSideEffect;
RepairKit?: RepairKit; RepairKit?: IUpdRepairKit;
CultistAmulet?: ICultistAmulet; CultistAmulet?: IUpdCultistAmulet;
} }
export interface Buff { export interface IUpdBuff {
rarity: string; rarity: string;
buffType: string; buffType: string;
value: number; value: number;
thresholdDurability?: number; thresholdDurability?: number;
} }
export interface Togglable { export interface IUpdTogglable {
On: boolean; On: boolean;
} }
export interface Map { export interface IUpdMap {
Markers: MapMarker[]; Markers: IMapMarker[];
} }
export interface MapMarker { export interface IMapMarker {
X: number; X: number;
Y: number; Y: number;
} }
export interface Tag { export interface IUpdTag {
Color: number; Color: number;
Name: string; Name: string;
} }
export interface FaceShield { export interface IUpdFaceShield {
Hits: number; Hits: number;
} }
export interface Repairable { export interface IUpdRepairable {
Durability: number; Durability: number;
MaxDurability: number; MaxDurability: number;
} }
export interface RecodableComponent { export interface IUpdRecodableComponent {
IsEncoded: boolean; IsEncoded: boolean;
} }
export interface MedKit { export interface IUpdMedKit {
HpResource: number; HpResource: number;
} }
export interface Sight { export interface IUpdSight {
ScopesCurrentCalibPointIndexes: number[]; ScopesCurrentCalibPointIndexes: number[];
ScopesSelectedModes: number[]; ScopesSelectedModes: number[];
SelectedScope: number; SelectedScope: number;
} }
export interface Foldable { export interface IUpdFoldable {
Folded: boolean; Folded: boolean;
} }
export interface FireMode { export interface IUpdFireMode {
FireMode: string; FireMode: string;
} }
export interface FoodDrink { export interface IUpdFoodDrink {
HpPercent: number; HpPercent: number;
} }
export interface Key { export interface IUpdKey {
NumberOfUsages: number; NumberOfUsages: number;
} }
export interface Resource { export interface IUpdResource {
Value: number; Value: number;
UnitsConsumed: number; UnitsConsumed: number;
} }
export interface Light { export interface IUpdLight {
IsActive: boolean; IsActive: boolean;
SelectedMode: number; SelectedMode: number;
} }
export interface Dogtag { export interface IUpdDogtag {
AccountId: string; AccountId: string;
ProfileId: string; ProfileId: string;
Nickname: string; Nickname: string;
@ -125,23 +134,14 @@ export interface Dogtag {
WeaponName: string; WeaponName: string;
} }
export interface Location { export interface IUpdSideEffect {
x: number;
y: number;
r: string | number;
isSearched?: boolean;
/** SPT property? */
rotation?: string | boolean;
}
export interface SideEffect {
Value: number; Value: number;
} }
export interface RepairKit { export interface IUpdRepairKit {
Resource: number; Resource: number;
} }
export interface ICultistAmulet { export interface IUpdCultistAmulet {
NumberOfUsages: number; NumberOfUsages: number;
} }

View File

@ -6,10 +6,10 @@ export interface ILocationServices {
} }
export interface ITraderServerSettings { export interface ITraderServerSettings {
TraderServices: TraderServices; TraderServices: ITraderServices;
} }
export interface TraderServices { export interface ITraderServices {
ExUsecLoyalty: ITraderService; ExUsecLoyalty: ITraderService;
ZryachiyAid: ITraderService; ZryachiyAid: ITraderService;
CultistsAid: ITraderService; CultistsAid: ITraderService;

View File

@ -1,11 +1,11 @@
export interface ILocationsBase { export interface ILocationsBase {
locations: Locations; locations: ILocations;
paths: Path[]; paths: IPath[];
} }
export type Locations = {}; export type ILocations = {};
export interface Path { export interface IPath {
Source: string; Source: string;
Destination: string; Destination: string;
} }

View File

@ -1,8 +1,8 @@
export interface IMatch { export interface IMatch {
metrics: Metrics; metrics: IMetrics;
} }
export interface Metrics { export interface IMetrics {
Keys: number[]; Keys: number[];
NetProcessingBins: number[]; NetProcessingBins: number[];
RenderBins: number[]; RenderBins: number[];

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { QuestRewardType } from "@spt/models/enums/QuestRewardType"; import { QuestRewardType } from "@spt/models/enums/QuestRewardType";
import { QuestStatus } from "@spt/models/enums/QuestStatus"; import { QuestStatus } from "@spt/models/enums/QuestStatus";
import { QuestTypeEnum } from "@spt/models/enums/QuestTypeEnum"; import { QuestTypeEnum } from "@spt/models/enums/QuestTypeEnum";
@ -53,7 +53,7 @@ export interface IQuestCondition {
index?: number; index?: number;
compareMethod?: string; compareMethod?: string;
dynamicLocale: boolean; dynamicLocale: boolean;
visibilityConditions?: VisibilityCondition[]; visibilityConditions?: IVisibilityCondition[];
globalQuestCounterId?: string; globalQuestCounterId?: string;
parentId?: string; parentId?: string;
target: string[] | string; target: string[] | string;
@ -133,7 +133,7 @@ export interface IDaytimeCounter {
to: number; to: number;
} }
export interface VisibilityCondition { export interface IVisibilityCondition {
id: string; id: string;
target: string; target: string;
value?: number; value?: number;
@ -158,7 +158,7 @@ export interface IQuestReward {
type: QuestRewardType; type: QuestRewardType;
index: number; index: number;
target?: string; target?: string;
items?: Item[]; items?: IItem[];
loyaltyLevel?: number; loyaltyLevel?: number;
/** Hideout area id */ /** Hideout area id */
traderId?: string; traderId?: string;

View File

@ -52,16 +52,16 @@ export interface IOptions {
} }
export interface ICompletionFilter { export interface ICompletionFilter {
itemsBlacklist: ItemsBlacklist[]; itemsBlacklist: IItemsBlacklist[];
itemsWhitelist: ItemsWhitelist[]; itemsWhitelist: IItemsWhitelist[];
} }
export interface ItemsBlacklist { export interface IItemsBlacklist {
minPlayerLevel: number; minPlayerLevel: number;
itemIds: string[]; itemIds: string[];
} }
export interface ItemsWhitelist { export interface IItemsWhitelist {
minPlayerLevel: number; minPlayerLevel: number;
itemIds: string[]; itemIds: string[];
} }

View File

@ -27,8 +27,8 @@ export interface Props {
SpawnChance?: number; SpawnChance?: number;
CreditsPrice?: number; CreditsPrice?: number;
ItemSound?: string; ItemSound?: string;
Prefab?: Prefab; Prefab?: IPrefab;
UsePrefab?: Prefab; UsePrefab?: IPrefab;
StackObjectsCount?: number; StackObjectsCount?: number;
NotShownInSlot?: boolean; NotShownInSlot?: boolean;
ExaminedByDefault?: boolean; ExaminedByDefault?: boolean;
@ -72,8 +72,8 @@ export interface Props {
MaxResource?: number; MaxResource?: number;
Resource?: number; Resource?: number;
DogTagQualities?: boolean; DogTagQualities?: boolean;
Grids?: Grid[]; Grids?: IGrid[];
Slots?: Slot[]; Slots?: ISlot[];
CanPutIntoDuringTheRaid?: boolean; CanPutIntoDuringTheRaid?: boolean;
CantRemoveFromSlotsDuringRaid?: string[]; CantRemoveFromSlotsDuringRaid?: string[];
KeyIds?: string[]; KeyIds?: string[];
@ -140,7 +140,7 @@ export interface Props {
PixelationBlockCount?: number; PixelationBlockCount?: number;
ShiftsAimCamera?: number; ShiftsAimCamera?: number;
magAnimationIndex?: number; magAnimationIndex?: number;
Cartridges?: Slot[]; Cartridges?: ISlot[];
CanFast?: boolean; CanFast?: boolean;
CanHit?: boolean; CanHit?: boolean;
CanAdmin?: boolean; CanAdmin?: boolean;
@ -218,7 +218,7 @@ export interface Props {
defAmmo?: string; defAmmo?: string;
AdjustCollimatorsToTrajectory?: boolean; AdjustCollimatorsToTrajectory?: boolean;
shotgunDispersion?: number; shotgunDispersion?: number;
Chambers?: Slot[]; Chambers?: ISlot[];
CameraSnap?: number; CameraSnap?: number;
CameraToWeaponAngleSpeedRange?: Ixyz; CameraToWeaponAngleSpeedRange?: Ixyz;
CameraToWeaponAngleStep?: number; CameraToWeaponAngleStep?: number;
@ -403,7 +403,7 @@ export interface Props {
LightAndSoundShotSelfContusionStrength?: number; LightAndSoundShotSelfContusionStrength?: number;
MalfMisfireChance?: number; MalfMisfireChance?: number;
MalfFeedChance?: number; MalfFeedChance?: number;
StackSlots?: StackSlot[]; StackSlots?: IStackSlot[];
type?: string; type?: string;
eqMin?: number; eqMin?: number;
eqMax?: number; eqMax?: number;
@ -429,7 +429,7 @@ export interface Props {
RepairStrategyTypes?: string[]; RepairStrategyTypes?: string[];
IsEncoded?: boolean; IsEncoded?: boolean;
LayoutName?: string; LayoutName?: string;
Lower75Prefab?: Prefab; Lower75Prefab?: IPrefab;
MaxUsages?: number; MaxUsages?: number;
ScavKillExpPenalty?: number; ScavKillExpPenalty?: number;
ScavKillExpPenaltyPVE?: number; ScavKillExpPenaltyPVE?: number;
@ -444,21 +444,21 @@ export interface IHealthEffect {
value: number; value: number;
} }
export interface Prefab { export interface IPrefab {
path: string; path: string;
rcid: string; rcid: string;
} }
export interface Grid { export interface IGrid {
_name: string; _name: string;
_id: string; _id: string;
_parent: string; _parent: string;
_props: GridProps; _props: IGridProps;
_proto: string; _proto: string;
} }
export interface GridProps { export interface IGridProps {
filters: GridFilter[]; filters: IGridFilter[];
cellsH: number; cellsH: number;
cellsV: number; cellsV: number;
minCount: number; minCount: number;
@ -467,29 +467,29 @@ export interface GridProps {
isSortingTable: boolean; isSortingTable: boolean;
} }
export interface GridFilter { export interface IGridFilter {
Filter: string[]; Filter: string[];
ExcludedFilter: string[]; ExcludedFilter: string[];
locked?: boolean; locked?: boolean;
} }
export interface Slot { export interface ISlot {
_name: string; _name: string;
_id: string; _id: string;
_parent: string; _parent: string;
_props: SlotProps; _props: ISlotProps;
_max_count?: number; _max_count?: number;
_required?: boolean; _required?: boolean;
_mergeSlotWithChildren?: boolean; _mergeSlotWithChildren?: boolean;
_proto: string; _proto: string;
} }
export interface SlotProps { export interface ISlotProps {
filters: SlotFilter[]; filters: ISlotFilter[];
MaxStackCount?: number; MaxStackCount?: number;
} }
export interface SlotFilter { export interface ISlotFilter {
Shift?: number; Shift?: number;
locked?: boolean; locked?: boolean;
Plate?: string; Plate?: string;
@ -499,18 +499,18 @@ export interface SlotFilter {
AnimationIndex?: number; AnimationIndex?: number;
} }
export interface StackSlot { export interface IStackSlot {
_name?: string; _name?: string;
_id: string; _id: string;
_parent: string; _parent: string;
_max_count: number; _max_count: number;
_props: StackSlotProps; _props: IStackSlotProps;
_proto: string; _proto: string;
upd?: any; upd?: any;
} }
export interface StackSlotProps { export interface IStackSlotProps {
filters: SlotFilter[]; filters: ISlotFilter[];
} }
export interface IRandomLootSettings { export interface IRandomLootSettings {
@ -530,16 +530,16 @@ export interface IRandomLootExcluded {
templates: any[]; templates: any[];
} }
export interface EffectsHealth { export interface IEffectsHealth {
Energy: EffectsHealthProps; Energy: IEffectsHealthProps;
Hydration: EffectsHealthProps; Hydration: IEffectsHealthProps;
} }
export interface EffectsHealthProps { export interface IEffectsHealthProps {
value: number; value: number;
} }
export interface EffectsDamage { export interface IEffectsDamage {
Pain: IEffectDamageProps; Pain: IEffectDamageProps;
LightBleeding: IEffectDamageProps; LightBleeding: IEffectDamageProps;
HeavyBleeding: IEffectDamageProps; HeavyBleeding: IEffectDamageProps;

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { DogtagExchangeSide } from "@spt/models/enums/DogtagExchangeSide"; import { DogtagExchangeSide } from "@spt/models/enums/DogtagExchangeSide";
import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel"; import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel";
@ -81,7 +81,7 @@ export interface ITraderRepair {
export interface ITraderAssort { export interface ITraderAssort {
nextResupply: number; nextResupply: number;
items: Item[]; items: IItem[];
barter_scheme: Record<string, IBarterScheme[][]>; barter_scheme: Record<string, IBarterScheme[][]>;
loyal_level_items: Record<string, number>; loyal_level_items: Record<string, number>;
} }

View File

@ -5,7 +5,7 @@ export interface IGameConfigResponse {
ndaFree: boolean; ndaFree: boolean;
taxonomy: number; taxonomy: number;
activeProfileId: string; activeProfileId: string;
backend: Backend; backend: IBackend;
useProtobuf: boolean; useProtobuf: boolean;
utc_time: number; utc_time: number;
/** Total in game time */ /** Total in game time */
@ -14,7 +14,7 @@ export interface IGameConfigResponse {
twitchEventMember: boolean; twitchEventMember: boolean;
} }
export interface Backend { export interface IBackend {
Lobby: string; Lobby: string;
Trading: string; Trading: string;
Messaging: string; Messaging: string;

View File

@ -1,35 +1,35 @@
export interface IHealthTreatmentRequestData { export interface IHealthTreatmentRequestData {
Action: "RestoreHealth"; Action: "RestoreHealth";
trader: string; trader: string;
items: Cost[]; items: IItemCost[];
difference: Difference; difference: IDifference;
timestamp: number; timestamp: number;
} }
export interface Cost { export interface IItemCost {
/** Id of stack to take money from */ /** Id of stack to take money from */
id: string; id: string;
/** Amount of money to take off player for treatment */ /** Amount of money to take off player for treatment */
count: number; count: number;
} }
export interface Difference { export interface IDifference {
BodyParts: BodyParts; BodyParts: IBodyParts;
Energy: number; Energy: number;
Hydration: number; Hydration: number;
} }
export interface BodyParts { export interface IBodyParts {
Head: BodyPart; Head: IBodyPart;
Chest: BodyPart; Chest: IBodyPart;
Stomach: BodyPart; Stomach: IBodyPart;
LeftArm: BodyPart; LeftArm: IBodyPart;
RightArm: BodyPart; RightArm: IBodyPart;
LeftLeg: BodyPart; LeftLeg: IBodyPart;
RightLeg: BodyPart; RightLeg: IBodyPart;
} }
export interface BodyPart { export interface IBodyPart {
Health: number; Health: number;
/** Effects in array are to be removed */ /** Effects in array are to be removed */
Effects: string[]; Effects: string[];

View File

@ -1,22 +1,22 @@
export interface ISyncHealthRequestData { export interface ISyncHealthRequestData {
Health: Health; Health: IBodyPartCollection;
IsAlive: boolean; IsAlive: boolean;
Hydration?: number; Hydration?: number;
Energy?: number; Energy?: number;
Temperature?: number; Temperature?: number;
} }
export interface Health { export interface IBodyPartCollection {
Head?: BodyPartHealth; Head?: IBodyPartHealth;
Chest?: BodyPartHealth; Chest?: IBodyPartHealth;
Stomach?: BodyPartHealth; Stomach?: IBodyPartHealth;
LeftArm?: BodyPartHealth; LeftArm?: IBodyPartHealth;
RightArm?: BodyPartHealth; RightArm?: IBodyPartHealth;
LeftLeg?: BodyPartHealth; LeftLeg?: IBodyPartHealth;
RightLeg?: BodyPartHealth; RightLeg?: IBodyPartHealth;
} }
export interface BodyPartHealth { export interface IBodyPartHealth {
Maximum: number; Maximum: number;
Current: number; Current: number;
Effects: Record<string, number>; Effects: Record<string, number>;

View File

@ -1,12 +1,12 @@
export interface IHideoutSingleProductionStartRequestData { export interface IHideoutSingleProductionStartRequestData {
Action: "HideoutSingleProductionStart"; Action: "HideoutSingleProductionStart";
recipeId: string; recipeId: string;
items: Item[]; items: IHandoverItem[];
tools: Item[]; tools: IHandoverItem[];
timestamp: number; timestamp: number;
} }
export interface Item { export interface IHandoverItem {
id: string; id: string;
count: number; count: number;
} }

View File

@ -1,6 +1,6 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IItemDeliveryRequestData { export interface IItemDeliveryRequestData {
items: Item[]; items: IItem[];
traderId: string; traderId: string;
} }

View File

@ -1,8 +1,8 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IAddItemDirectRequest { export interface IAddItemDirectRequest {
/** Item and child mods to add to player inventory */ /** Item and child mods to add to player inventory */
itemWithModsToAdd: Item[]; itemWithModsToAdd: IItem[];
foundInRaid: boolean; foundInRaid: boolean;
callback: (buyCount: number) => void; callback: (buyCount: number) => void;
useSortingTable: boolean; useSortingTable: boolean;

View File

@ -1,10 +1,10 @@
export interface IAddItemRequestData { export interface IAddItemRequestData {
/** Trader id */ /** Trader id */
tid: string; tid: string;
items: AddItem[]; items: IItemToAdd[];
} }
export interface AddItem { export interface IItemToAdd {
count: number; count: number;
sptIsPreset?: boolean; sptIsPreset?: boolean;
item_id: string; item_id: string;

View File

@ -1,10 +1,10 @@
import { Item, Location } from "@spt/models/eft/common/tables/IItem"; import { IItem, IItemLocation } from "@spt/models/eft/common/tables/IItem";
export interface IAddItemTempObject { export interface IAddItemTempObject {
itemRef: Item; itemRef: IItem;
count: number; count: number;
isPreset: boolean; isPreset: boolean;
location?: Location; location?: IItemLocation;
// Container item will be placed in - stash or sorting table // Container item will be placed in - stash or sorting table
containerId?: string; containerId?: string;
} }

View File

@ -1,8 +1,8 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IAddItemsDirectRequest { export interface IAddItemsDirectRequest {
/** Item and child mods to add to player inventory */ /** Item and child mods to add to player inventory */
itemsWithModsToAdd: Item[][]; itemsWithModsToAdd: IItem[][];
foundInRaid: boolean; foundInRaid: boolean;
/** Runs after EACH item with children is added */ /** Runs after EACH item with children is added */
callback?: (buyCount: number) => void; callback?: (buyCount: number) => void;

View File

@ -1,22 +1,15 @@
import { IBaseInteractionRequestData } from "@spt/models/eft/common/request/IBaseInteractionRequestData"; import { IBaseInteractionRequestData } from "@spt/models/eft/common/request/IBaseInteractionRequestData";
import { IItemLocation } from "@spt/models/eft/common/tables/IItem";
export interface IInventoryBaseActionRequestData extends IBaseInteractionRequestData {} export interface IInventoryBaseActionRequestData extends IBaseInteractionRequestData {}
export interface To { export interface To {
id: string; id: string;
container: string; container: string;
location?: ToLocation | number; // Hack location?: IItemLocation | number; // Hack
isSearched?: boolean; isSearched?: boolean;
} }
export interface ToLocation {
x: number;
y: number;
r: string;
rotation?: string;
isSearched: boolean;
}
export interface Container { export interface Container {
id: string; id: string;
container: string; container: string;

View File

@ -1,23 +1,7 @@
import { Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpd } from "@spt/models/eft/common/tables/IItem";
import { IInventoryBaseActionRequestData } from "@spt/models/eft/inventory/IInventoryBaseActionRequestData"; import { IInventoryBaseActionRequestData } from "@spt/models/eft/inventory/IInventoryBaseActionRequestData";
export interface IInventorySortRequestData extends IInventoryBaseActionRequestData { export interface IInventorySortRequestData extends IInventoryBaseActionRequestData {
Action: "ApplyInventoryChanges"; Action: "ApplyInventoryChanges";
changedItems: ChangedItem[]; changedItems: IItem[];
}
export interface ChangedItem {
_id: string;
_tpl: string;
parentId: string;
slotId: string;
location: Location;
upd: Upd;
}
export interface Location {
x: number;
y: number;
r: string;
isSearched: boolean;
} }

View File

@ -1,11 +1,12 @@
import { import {
IHealth, IHealth,
IHideoutImprovement,
IMoneyTransferLimits, IMoneyTransferLimits,
IProductive, IProductive,
IQuestStatus, IQuestStatus,
ISkills, ISkills,
} from "@spt/models/eft/common/tables/IBotBase"; } from "@spt/models/eft/common/tables/IBotBase";
import { Item, Upd } from "@spt/models/eft/common/tables/IItem"; import { IItem, IItemLocation, IUpd } from "@spt/models/eft/common/tables/IItem";
import { IQuest } from "@spt/models/eft/common/tables/IQuest"; import { IQuest } from "@spt/models/eft/common/tables/IQuest";
import { IPmcDataRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests"; import { IPmcDataRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
@ -16,7 +17,7 @@ export interface IItemEventRouterBase {
profileChanges: TProfileChanges | ""; profileChanges: TProfileChanges | "";
} }
export type TProfileChanges = Record<string, ProfileChange>; export type TProfileChanges = Record<string, IProfileChange>;
export interface Warning { export interface Warning {
index: number; index: number;
@ -25,17 +26,17 @@ export interface Warning {
data?: any; data?: any;
} }
export interface ProfileChange { export interface IProfileChange {
_id: string; _id: string;
experience: number; experience: number;
quests: IQuest[]; quests: IQuest[];
ragFairOffers: IRagfairOffer[]; ragFairOffers: IRagfairOffer[];
weaponBuilds: IWeaponBuildChange[]; weaponBuilds: IWeaponBuildChange[];
equipmentBuilds: IEquipmentBuildChange[]; equipmentBuilds: IEquipmentBuildChange[];
items: ItemChanges; items: IItemChanges;
production: Record<string, IProductive>; production: Record<string, IProductive>;
/** Hideout area improvement id */ /** Hideout area improvement id */
improvements: Record<string, Improvement>; improvements: Record<string, IHideoutImprovement>;
skills: ISkills; skills: ISkills;
health: IHealth; health: IHealth;
traderRelations: Record<string, TraderData>; traderRelations: Record<string, TraderData>;
@ -55,28 +56,23 @@ export interface IWeaponBuildChange {
id: string; id: string;
name: string; name: string;
root: string; root: string;
items: Item[]; items: IItem[];
} }
export interface IEquipmentBuildChange { export interface IEquipmentBuildChange {
id: string; id: string;
name: string; name: string;
root: string; root: string;
items: Item[]; items: IItem[];
type: string; type: string;
fastpanel: any[]; fastpanel: any[];
buildType: EquipmentBuildType; buildType: EquipmentBuildType;
} }
export interface ItemChanges { export interface IItemChanges {
new: Product[]; new: IProduct[];
change: Product[]; change: IProduct[];
del: Product[]; // Only needs _id property del: IProduct[]; // Only needs _id property
}
export interface Improvement {
completed: boolean;
improveCompleteTimestamp: number;
} }
/** Related to TraderInfo */ /** Related to TraderInfo */
@ -88,18 +84,11 @@ export interface TraderData {
disabled: boolean; disabled: boolean;
} }
export interface Product { export interface IProduct {
_id: string; _id: string;
_tpl?: string; _tpl?: string;
parentId?: string; parentId?: string;
slotId?: string; slotId?: string;
location?: ItemChangeLocation; location?: IItemLocation;
upd?: Upd; upd?: IUpd;
}
export interface ItemChangeLocation {
x: number;
y: number;
r: number;
isSearched?: boolean;
} }

View File

@ -1,8 +1,8 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { AirdropTypeEnum } from "@spt/models/enums/AirdropType"; import { AirdropTypeEnum } from "@spt/models/enums/AirdropType";
export interface IGetAirdropLootResponse { export interface IGetAirdropLootResponse {
// The type of airdrop // The type of airdrop
icon: AirdropTypeEnum; icon: AirdropTypeEnum;
container: Item[]; container: IItem[];
} }

View File

@ -1,15 +1,15 @@
import { ExitStatus } from "@spt/models/enums/ExitStatis"; import { ExitStatus } from "@spt/models/enums/ExitStatis";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { Item } from "../common/tables/IItem"; import { IItem } from "../common/tables/IItem";
export interface IEndLocalRaidRequestData { export interface IEndLocalRaidRequestData {
/** ID of server player just left */ /** ID of server player just left */
serverId: string; serverId: string;
results: IEndRaidResult; results: IEndRaidResult;
/** Insured items left in raid by player */ /** Insured items left in raid by player */
lostInsuredItems: Item[]; lostInsuredItems: IItem[];
/** Items sent via traders to player, keyed to service e.g. BTRTransferStash */ /** Items sent via traders to player, keyed to service e.g. BTRTransferStash */
transferItems: Record<string, Item[]>; transferItems: Record<string, IItem[]>;
} }
export interface IEndRaidResult { export interface IEndRaidResult {

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { MemberCategory } from "@spt/models/enums/MemberCategory"; import { MemberCategory } from "@spt/models/enums/MemberCategory";
export interface IGroupCharacter { export interface IGroupCharacter {
@ -30,7 +30,7 @@ export interface IGroupCharacter {
}; };
Equipment: { Equipment: {
Id: string; Id: string;
Items: Item[]; Items: IItem[];
}; };
}; };
isLeader: boolean; isLeader: boolean;

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IPresetBuildActionRequestData { export interface IPresetBuildActionRequestData {
Action: string; Action: string;
@ -6,5 +6,5 @@ export interface IPresetBuildActionRequestData {
/** name of preset given by player */ /** name of preset given by player */
Name: string; Name: string;
Root: string; Root: string;
Items: Item[]; Items: IItem[];
} }

View File

@ -1,9 +1,9 @@
export interface GetProfileStatusResponseData { export interface IGetProfileStatusResponseData {
maxPveCountExceeded: false; maxPveCountExceeded: false;
profiles: ProfileData[]; profiles: IProfileStatusData[];
} }
export interface ProfileData { export interface IProfileStatusData {
profileid: string; profileid: string;
profileToken: string; profileToken: string;
status: string; status: string;

View File

@ -1,5 +1,5 @@
import { IOverallCounters, ISkills } from "@spt/models/eft/common/tables/IBotBase"; import { IOverallCounters, ISkills } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IGetOtherProfileResponse { export interface IGetOtherProfileResponse {
id: string; id: string;
@ -9,7 +9,7 @@ export interface IGetOtherProfileResponse {
skills: ISkills; skills: ISkills;
equipment: IOtherProfileEquipment; equipment: IOtherProfileEquipment;
achievements: Record<string, number>; achievements: Record<string, number>;
favoriteItems: Item[]; favoriteItems: IItem[];
pmcStats: IOtherProfileStats; pmcStats: IOtherProfileStats;
scavStats: IOtherProfileStats; scavStats: IOtherProfileStats;
} }
@ -33,7 +33,7 @@ export interface IOtherProfileCustomization {
export interface IOtherProfileEquipment { export interface IOtherProfileEquipment {
Id: string; Id: string;
Items: Item[]; Items: IItem[];
} }
export interface IOtherProfileStats { export interface IOtherProfileStats {

View File

@ -1,5 +1,5 @@
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { EquipmentBuildType } from "@spt/models/enums/EquipmentBuildType"; import { EquipmentBuildType } from "@spt/models/enums/EquipmentBuildType";
import { MemberCategory } from "@spt/models/enums/MemberCategory"; import { MemberCategory } from "@spt/models/enums/MemberCategory";
import { MessageType } from "@spt/models/enums/MessageType"; import { MessageType } from "@spt/models/enums/MessageType";
@ -57,12 +57,12 @@ export interface IUserBuild {
export interface IWeaponBuild extends IUserBuild { export interface IWeaponBuild extends IUserBuild {
Root: string; Root: string;
Items: Item[]; // Same as PMC inventory items Items: IItem[]; // Same as PMC inventory items
} }
export interface IEquipmentBuild extends IUserBuild { export interface IEquipmentBuild extends IUserBuild {
Root: string; Root: string;
Items: Item[]; // Same as PMC inventory items Items: IItem[]; // Same as PMC inventory items
BuildType: EquipmentBuildType; BuildType: EquipmentBuildType;
} }
@ -80,7 +80,7 @@ export interface IMagazineTemplateAmmoItem {
/** Used by defaultEquipmentPresets.json */ /** Used by defaultEquipmentPresets.json */
export interface IDefaultEquipmentPreset extends IUserBuild { export interface IDefaultEquipmentPreset extends IUserBuild {
Items: Item[]; Items: IItem[];
Root: string; Root: string;
BuildType: EquipmentBuildType; BuildType: EquipmentBuildType;
type: string; type: string;
@ -158,7 +158,7 @@ export interface MessagePreview {
export interface MessageItems { export interface MessageItems {
stash?: string; stash?: string;
data?: Item[]; data?: IItem[];
} }
export interface ISystemData { export interface ISystemData {
@ -275,7 +275,7 @@ export interface Insurance {
systemData: ISystemData; systemData: ISystemData;
messageType: MessageType; messageType: MessageType;
messageTemplateId: string; messageTemplateId: string;
items: Item[]; items: IItem[];
} }
export interface MessageContentRagfair { export interface MessageContentRagfair {

View File

@ -2,10 +2,10 @@ export interface IHandoverQuestRequestData {
Action: "QuestHandover"; Action: "QuestHandover";
qid: string; qid: string;
conditionId: string; conditionId: string;
items: Item[]; items: IHandoverItem[];
} }
export interface Item { export interface IHandoverItem {
id: string; id: string;
count: number; count: number;
} }

View File

@ -1,11 +1,11 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { DogtagExchangeSide } from "@spt/models/enums/DogtagExchangeSide"; import { DogtagExchangeSide } from "@spt/models/enums/DogtagExchangeSide";
import { MemberCategory } from "@spt/models/enums/MemberCategory"; import { MemberCategory } from "@spt/models/enums/MemberCategory";
export interface IRagfairOffer { export interface IRagfairOffer {
sellResult?: SellResult[]; sellResult?: ISellResult[];
_id: string; _id: string;
items: Item[]; items: IItem[];
requirements: OfferRequirement[]; requirements: OfferRequirement[];
root: string; root: string;
intId: number; intId: number;
@ -47,7 +47,7 @@ export interface IRagfairOfferUser {
aid?: number; aid?: number;
} }
export interface SellResult { export interface ISellResult {
sellTime: number; sellTime: number;
amount: number; amount: number;
} }

View File

@ -1,11 +1,11 @@
import { Mods } from "@spt/models/eft/common/tables/IBotType"; import { IMods } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
export class GenerateWeaponResult { export class GenerateWeaponResult {
weapon: Item[]; weapon: IItem[];
chosenAmmoTpl: string; chosenAmmoTpl: string;
chosenUbglAmmoTpl: string; chosenUbglAmmoTpl: string;
weaponMods: Mods; weaponMods: IMods;
weaponTemplate: ITemplateItem; weaponTemplate: ITemplateItem;
} }

View File

@ -1,5 +1,5 @@
import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
import { Chances, Mods } from "@spt/models/eft/common/tables/IBotType"; import { IChances, IMods } from "@spt/models/eft/common/tables/IBotType";
import { EquipmentFilters, RandomisationDetails } from "@spt/models/spt/config/IBotConfig"; import { EquipmentFilters, RandomisationDetails } from "@spt/models/spt/config/IBotConfig";
export interface IGenerateEquipmentProperties { export interface IGenerateEquipmentProperties {
@ -7,9 +7,9 @@ export interface IGenerateEquipmentProperties {
rootEquipmentSlot: string; rootEquipmentSlot: string;
/** Equipment pool for root slot being generated */ /** Equipment pool for root slot being generated */
rootEquipmentPool: Record<string, number>; rootEquipmentPool: Record<string, number>;
modPool: Mods; modPool: IMods;
/** Dictionary of mod items and their chance to spawn for this bot type */ /** Dictionary of mod items and their chance to spawn for this bot type */
spawnChances: Chances; spawnChances: IChances;
/** Role being generated for */ /** Role being generated for */
botRole: string; botRole: string;
/** Level of bot being generated */ /** Level of bot being generated */

View File

@ -1,19 +1,19 @@
import { Mods, ModsChances } from "@spt/models/eft/common/tables/IBotType"; import { IMods, IModsChances } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BotModLimits } from "@spt/services/BotWeaponModLimitService"; import { BotModLimits } from "@spt/services/BotWeaponModLimitService";
export interface IGenerateWeaponRequest { export interface IGenerateWeaponRequest {
/** Weapon to add mods to / result that is returned */ /** Weapon to add mods to / result that is returned */
weapon: Item[]; weapon: IItem[];
/** Pool of compatible mods to attach to weapon */ /** Pool of compatible mods to attach to weapon */
modPool: Mods; modPool: IMods;
/** ParentId of weapon */ /** ParentId of weapon */
weaponId: string; weaponId: string;
/** Weapon which mods will be generated on */ /** Weapon which mods will be generated on */
parentTemplate: ITemplateItem; parentTemplate: ITemplateItem;
/** Chance values mod will be added */ /** Chance values mod will be added */
modSpawnChances: ModsChances; modSpawnChances: IModsChances;
/** Ammo tpl to use when generating magazines/cartridges */ /** Ammo tpl to use when generating magazines/cartridges */
ammoTpl: string; ammoTpl: string;
/** Bot-specific properties */ /** Bot-specific properties */

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { ModSpawn } from "@spt/models/enums/ModSpawn"; import { ModSpawn } from "@spt/models/enums/ModSpawn";
import { IBotData, IWeaponStats } from "@spt/models/spt/bots/IGenerateWeaponRequest"; import { IBotData, IWeaponStats } from "@spt/models/spt/bots/IGenerateWeaponRequest";
@ -16,7 +16,7 @@ export interface IModToSpawnRequest {
/** Pool of items to pick from */ /** Pool of items to pick from */
itemModPool: Record<string, string[]>; itemModPool: Record<string, string[]>;
/** Array with only weapon tpl in it, ready for mods to be added */ /** Array with only weapon tpl in it, ready for mods to be added */
weapon: Item[]; weapon: IItem[];
/** Ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) */ /** Ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) */
ammoTpl: string; ammoTpl: string;
/** Parent item the mod will go into */ /** Parent item the mod will go into */

View File

@ -6,11 +6,11 @@ export interface IAirdropConfig extends IBaseConfig {
kind: "spt-airdrop"; kind: "spt-airdrop";
airdropTypeWeightings: Record<AirdropTypeEnum, number>; airdropTypeWeightings: Record<AirdropTypeEnum, number>;
/** What rewards will the loot crate contain, keyed by drop type e.g. mixed/weaponArmor/foodMedical/barter */ /** What rewards will the loot crate contain, keyed by drop type e.g. mixed/weaponArmor/foodMedical/barter */
loot: Record<string, AirdropLoot>; loot: Record<string, IAirdropLoot>;
} }
/** Chance map will have an airdrop occur out of 100 - locations not included count as 0% */ /** Chance map will have an airdrop occur out of 100 - locations not included count as 0% */
export interface AirdropChancePercent { export interface IAirdropChancePercent {
bigmap: number; bigmap: number;
woods: number; woods: number;
lighthouse: number; lighthouse: number;
@ -22,7 +22,7 @@ export interface AirdropChancePercent {
} }
/** Loot inside crate */ /** Loot inside crate */
export interface AirdropLoot { export interface IAirdropLoot {
/** Min/max of weapons inside crate */ /** Min/max of weapons inside crate */
weaponPresetCount?: MinMax; weaponPresetCount?: MinMax;
/** Min/max of armors (head/chest/rig) inside crate */ /** Min/max of armors (head/chest/rig) inside crate */

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt/models/common/MinMax"; import { MinMax } from "@spt/models/common/MinMax";
import { GenerationData } from "@spt/models/eft/common/tables/IBotType"; import { IGenerationData } from "@spt/models/eft/common/tables/IBotType";
import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig"; import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig";
import { IBotDurability } from "@spt/models/spt/config/IBotDurability"; import { IBotDurability } from "@spt/models/spt/config/IBotDurability";
@ -151,7 +151,7 @@ export interface ModLimits {
export interface RandomisationDetails { export interface RandomisationDetails {
/** Between what levels do these randomisation setting apply to */ /** Between what levels do these randomisation setting apply to */
levelRange: MinMax; levelRange: MinMax;
generation?: Record<string, GenerationData>; generation?: Record<string, IGenerationData>;
/** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */ /** Mod slots that should be fully randomised -ignores mods from bottype.json and instaed creates a pool using items.json */
randomisedWeaponModSlots?: string[]; randomisedWeaponModSlots?: string[];
/** Armor slots that should be randomised e.g. 'Headwear, Armband' */ /** Armor slots that should be randomised e.g. 'Headwear, Armband' */

View File

@ -1,51 +1,51 @@
export interface IBotDurability { export interface IBotDurability {
default: DefaultDurability; default: IDefaultDurability;
pmc: PmcDurability; pmc: PmcDurability;
boss: BotDurability; boss: IBotDurability;
follower: BotDurability; follower: IBotDurability;
assault: BotDurability; assault: IBotDurability;
cursedassault: BotDurability; cursedassault: IBotDurability;
marksman: BotDurability; marksman: IBotDurability;
pmcbot: BotDurability; pmcbot: IBotDurability;
arenafighterevent: BotDurability; arenafighterevent: IBotDurability;
arenafighter: BotDurability; arenafighter: IBotDurability;
crazyassaultevent: BotDurability; crazyassaultevent: IBotDurability;
exusec: BotDurability; exusec: IBotDurability;
gifter: BotDurability; gifter: IBotDurability;
sectantpriest: BotDurability; sectantpriest: IBotDurability;
sectantwarrior: BotDurability; sectantwarrior: IBotDurability;
} }
/** Durability values to be used when a more specific bot type cant be found */ /** Durability values to be used when a more specific bot type cant be found */
export interface DefaultDurability { export interface IDefaultDurability {
armor: ArmorDurability; armor: IArmorDurability;
weapon: WeaponDurability; weapon: IWeaponDurability;
} }
export interface PmcDurability { export interface PmcDurability {
armor: PmcDurabilityArmor; armor: IPmcDurabilityArmor;
weapon: WeaponDurability; weapon: IWeaponDurability;
} }
export interface PmcDurabilityArmor { export interface IPmcDurabilityArmor {
lowestMaxPercent: number; lowestMaxPercent: number;
highestMaxPercent: number; highestMaxPercent: number;
maxDelta: number; maxDelta: number;
minDelta: number; minDelta: number;
} }
export interface BotDurability { export interface IBotDurability {
armor: ArmorDurability; armor: IArmorDurability;
weapon: WeaponDurability; weapon: IWeaponDurability;
} }
export interface ArmorDurability { export interface IArmorDurability {
maxDelta: number; maxDelta: number;
minDelta: number; minDelta: number;
minLimitPercent: number; minLimitPercent: number;
} }
export interface WeaponDurability { export interface IWeaponDurability {
lowestMax: number; lowestMax: number;
highestMax: number; highestMax: number;
maxDelta: number; maxDelta: number;

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile"; import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile";
import { GiftSenderType } from "@spt/models/enums/GiftSenderType"; import { GiftSenderType } from "@spt/models/enums/GiftSenderType";
import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType"; import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
@ -8,12 +8,12 @@ import { IProfileChangeEvent } from "@spt/models/spt/dialog/ISendMessageDetails"
export interface IGiftsConfig extends IBaseConfig { export interface IGiftsConfig extends IBaseConfig {
kind: "spt-gifts"; kind: "spt-gifts";
gifts: Record<string, Gift>; gifts: Record<string, IGift>;
} }
export interface Gift { export interface IGift {
/** Items to send to player */ /** Items to send to player */
items: Item[]; items: IItem[];
/** Who is sending the gift to player */ /** Who is sending the gift to player */
sender: GiftSenderType; sender: GiftSenderType;
/** Optinal - supply a users id to send from, not necessary when sending from SYSTEM or TRADER */ /** Optinal - supply a users id to send from, not necessary when sending from SYSTEM or TRADER */

View File

@ -3,14 +3,14 @@ import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig";
export interface ILostOnDeathConfig extends IBaseConfig { export interface ILostOnDeathConfig extends IBaseConfig {
kind: "spt-lostondeath"; kind: "spt-lostondeath";
/** What equipment in each slot should be lost on death */ /** What equipment in each slot should be lost on death */
equipment: Equipment; equipment: ILostEquipment;
/** Should special slot items be removed from quest inventory on death e.g. wifi camera/markers */ /** Should special slot items be removed from quest inventory on death e.g. wifi camera/markers */
specialSlotItems: boolean; specialSlotItems: boolean;
/** Should quest items be removed from quest inventory on death */ /** Should quest items be removed from quest inventory on death */
questItems: boolean; questItems: boolean;
} }
export interface Equipment { export interface ILostEquipment {
ArmBand: boolean; ArmBand: boolean;
Headwear: boolean; Headwear: boolean;
Earpiece: boolean; Earpiece: boolean;

View File

@ -1,4 +1,4 @@
import { GenerationData } from "@spt/models/eft/common/tables/IBotType"; import { IGenerationData } from "@spt/models/eft/common/tables/IBotType";
import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig"; import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig";
export interface IPlayerScavConfig extends IBaseConfig { export interface IPlayerScavConfig extends IBaseConfig {
@ -20,10 +20,10 @@ export interface Modifiers {
} }
export interface ItemLimits { export interface ItemLimits {
healing: GenerationData; healing: IGenerationData;
drugs: GenerationData; drugs: IGenerationData;
stims: GenerationData; stims: IGenerationData;
looseLoot: GenerationData; looseLoot: IGenerationData;
magazines: GenerationData; magazines: IGenerationData;
grenades: GenerationData; grenades: IGenerationData;
} }

View File

@ -4,8 +4,8 @@ import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig";
export interface IScavCaseConfig extends IBaseConfig { export interface IScavCaseConfig extends IBaseConfig {
kind: "spt-scavcase"; kind: "spt-scavcase";
rewardItemValueRangeRub: Record<string, MinMax>; rewardItemValueRangeRub: Record<string, MinMax>;
moneyRewards: MoneyRewards; moneyRewards: IMoneyRewards;
ammoRewards: AmmoRewards; ammoRewards: IAmmoRewards;
rewardItemParentBlacklist: string[]; rewardItemParentBlacklist: string[];
rewardItemBlacklist: string[]; rewardItemBlacklist: string[];
allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleMoneyRewardsPerRarity: boolean;
@ -13,21 +13,21 @@ export interface IScavCaseConfig extends IBaseConfig {
allowBossItemsAsRewards: boolean; allowBossItemsAsRewards: boolean;
} }
export interface MoneyRewards { export interface IMoneyRewards {
moneyRewardChancePercent: number; moneyRewardChancePercent: number;
rubCount: MoneyLevels; rubCount: IMoneyLevels;
usdCount: MoneyLevels; usdCount: IMoneyLevels;
eurCount: MoneyLevels; eurCount: IMoneyLevels;
gpCount: MoneyLevels; gpCount: IMoneyLevels;
} }
export interface MoneyLevels { export interface IMoneyLevels {
common: MinMax; common: MinMax;
rare: MinMax; rare: MinMax;
superrare: MinMax; superrare: MinMax;
} }
export interface AmmoRewards { export interface IAmmoRewards {
ammoRewardChancePercent: number; ammoRewardChancePercent: number;
ammoRewardBlacklist: Record<string, string[]>; ammoRewardBlacklist: Record<string, string[]>;
ammoRewardValueRangeRub: Record<string, MinMax>; ammoRewardValueRangeRub: Record<string, MinMax>;

View File

@ -10,7 +10,7 @@ export interface ISeasonalEventConfig extends IBaseConfig {
events: ISeasonalEvent[]; events: ISeasonalEvent[];
eventBotMapping: Record<string, string>; eventBotMapping: Record<string, string>;
eventBossSpawns: Record<string, Record<string, IBossLocationSpawn[]>>; eventBossSpawns: Record<string, Record<string, IBossLocationSpawn[]>>;
gifterSettings: GifterSetting[]; gifterSettings: IGifterSetting[];
} }
export interface ISeasonalEvent { export interface ISeasonalEvent {
@ -22,7 +22,7 @@ export interface ISeasonalEvent {
endMonth: number; endMonth: number;
} }
export interface GifterSetting { export interface IGifterSetting {
map: string; map: string;
zones: string; zones: string;
spawnChance: number; spawnChance: number;

View File

@ -1,11 +1,11 @@
import { IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData"; import { IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData";
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase"; import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
import { IBotCore } from "@spt/models/eft/common/tables/IBotCore"; import { IBotCore } from "@spt/models/eft/common/tables/IBotCore";
import { Difficulty } from "@spt/models/eft/common/tables/IBotType"; import { IDifficultyCategories } from "@spt/models/eft/common/tables/IBotType";
export interface IBotController { export interface IBotController {
getBotLimit(type: string): number; getBotLimit(type: string): number;
getBotDifficulty(type: string, difficulty: string): IBotCore | Difficulty; getBotDifficulty(type: string, difficulty: string): IBotCore | IDifficultyCategories;
isBotPmc(botRole: string): boolean; isBotPmc(botRole: string): boolean;
isBotBoss(botRole: string): boolean; isBotBoss(botRole: string): boolean;
isBotFollower(botRole: string): boolean; isBotFollower(botRole: string): boolean;

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ISystemData, IUserDialogInfo, MessageContentRagfair } from "@spt/models/eft/profile/ISptProfile"; import { ISystemData, IUserDialogInfo, MessageContentRagfair } from "@spt/models/eft/profile/ISptProfile";
import { MessageType } from "@spt/models/enums/MessageType"; import { MessageType } from "@spt/models/enums/MessageType";
import { Traders } from "@spt/models/enums/Traders"; import { Traders } from "@spt/models/enums/Traders";
@ -17,7 +17,7 @@ export interface ISendMessageDetails {
/** Optional - used in player/system messages, otherwise templateId is used */ /** Optional - used in player/system messages, otherwise templateId is used */
messageText?: string; messageText?: string;
/** Optinal - Items to send to player */ /** Optinal - Items to send to player */
items?: Item[]; items?: IItem[];
/** Optional - How long items will be stored in mail before expiry */ /** Optional - How long items will be stored in mail before expiry */
itemsMaxStorageLifetimeSeconds?: number; itemsMaxStorageLifetimeSeconds?: number;
/** Optional - Used when sending messages from traders who send text from locale json */ /** Optional - Used when sending messages from traders who send text from locale json */

View File

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

View File

@ -1,11 +1,11 @@
import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase"; import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
import { Chances, Generation, Inventory } from "@spt/models/eft/common/tables/IBotType"; import { IChances, IGeneration, IInventory } from "@spt/models/eft/common/tables/IBotType";
export interface IBotGenerator { export interface IBotGenerator {
generateInventory( generateInventory(
templateInventory: Inventory, templateInventory: IInventory,
equipmentChances: Chances, equipmentChances: IChances,
generation: Generation, generation: IGeneration,
botRole: string, botRole: string,
isPmc: boolean, isPmc: boolean,
): PmcInventory; ): PmcInventory;

View File

@ -1,5 +1,5 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IRagfairAssortGenerator { export interface IRagfairAssortGenerator {
getAssortItems(): Item[]; getAssortItems(): IItem[];
} }

View File

@ -1,4 +1,4 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader"; import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
@ -6,7 +6,7 @@ export interface IRagfairOfferGenerator {
createOffer( createOffer(
userID: string, userID: string,
time: number, time: number,
items: Item[], items: IItem[],
barterScheme: IBarterScheme[], barterScheme: IBarterScheme[],
loyalLevel: number, loyalLevel: number,
price: number, price: number,

View File

@ -1,10 +1,10 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IOwnerInventoryItems { export interface IOwnerInventoryItems {
/** Inventory items from source */ /** Inventory items from source */
from: Item[]; from: IItem[];
/** Inventory items at destination */ /** Inventory items at destination */
to: Item[]; to: IItem[];
sameInventory: boolean; sameInventory: boolean;
isMail: boolean; isMail: boolean;
} }

View File

@ -1,9 +1,9 @@
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
export interface IInsuranceEquipmentPkg { export interface IInsuranceEquipmentPkg {
sessionID: string; sessionID: string;
pmcData: IPmcData; pmcData: IPmcData;
itemToReturnToPlayer: Item; itemToReturnToPlayer: IItem;
traderId: string; traderId: string;
} }

View File

@ -6,7 +6,7 @@ import {
IProductive, IProductive,
ITraderInfo, ITraderInfo,
} from "@spt/models/eft/common/tables/IBotBase"; } from "@spt/models/eft/common/tables/IBotBase";
import { ProfileChange, TraderData } from "@spt/models/eft/itemEvent/IItemEventRouterBase"; import { IProfileChange, TraderData } from "@spt/models/eft/itemEvent/IItemEventRouterBase";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { TimeUtil } from "@spt/utils/TimeUtil"; import { TimeUtil } from "@spt/utils/TimeUtil";
import { ICloner } from "@spt/utils/cloners/ICloner"; import { ICloner } from "@spt/utils/cloners/ICloner";
@ -69,7 +69,7 @@ export class EventOutputHolder {
*/ */
public updateOutputProperties(sessionId: string): void { public updateOutputProperties(sessionId: string): void {
const pmcData: IPmcData = this.profileHelper.getPmcProfile(sessionId); const pmcData: IPmcData = this.profileHelper.getPmcProfile(sessionId);
const profileChanges: ProfileChange = this.outputStore[sessionId].profileChanges[sessionId]; const profileChanges: IProfileChange = this.outputStore[sessionId].profileChanges[sessionId];
profileChanges.experience = pmcData.Info.Experience; profileChanges.experience = pmcData.Info.Experience;
profileChanges.health = this.cloner.clone(pmcData.Health); profileChanges.health = this.cloner.clone(pmcData.Health);

View File

@ -1,6 +1,6 @@
import { BotCallbacks } from "@spt/callbacks/BotCallbacks"; import { BotCallbacks } from "@spt/callbacks/BotCallbacks";
import { DynamicRouter, RouteAction } from "@spt/di/Router"; import { DynamicRouter, RouteAction } from "@spt/di/Router";
import { Difficulties } from "@spt/models/eft/common/tables/IBotType"; import { IDifficulties } from "@spt/models/eft/common/tables/IBotType";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
@injectable() @injectable()
@ -26,7 +26,7 @@ export class BotDynamicRouter extends DynamicRouter {
info: any, info: any,
sessionID: string, sessionID: string,
output: string, output: string,
): Promise<Record<string, Difficulties>> => { ): Promise<Record<string, IDifficulties>> => {
return this.botCallbacks.getAllBotDifficulties(url, info, sessionID); return this.botCallbacks.getAllBotDifficulties(url, info, sessionID);
}, },
), ),

View File

@ -3,7 +3,7 @@ import { RouteAction, StaticRouter } from "@spt/di/Router";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData"; import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
import { GetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData"; import { IGetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData";
import { ICreateProfileResponse } from "@spt/models/eft/profile/ICreateProfileResponse"; import { ICreateProfileResponse } from "@spt/models/eft/profile/ICreateProfileResponse";
import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse"; import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse"; import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
@ -92,7 +92,7 @@ export class ProfileStaticRouter extends StaticRouter {
info: any, info: any,
sessionID: string, sessionID: string,
output: string, output: string,
): Promise<IGetBodyResponseData<GetProfileStatusResponseData>> => { ): Promise<IGetBodyResponseData<IGetProfileStatusResponseData>> => {
return this.profileCallbacks.getProfileStatus(url, info, sessionID); return this.profileCallbacks.getProfileStatus(url, info, sessionID);
}, },
), ),

View File

@ -1,12 +1,12 @@
import { LootGenerator } from "@spt/generators/LootGenerator"; import { LootGenerator } from "@spt/generators/LootGenerator";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IGetAirdropLootResponse } from "@spt/models/eft/location/IGetAirdropLootResponse"; import { IGetAirdropLootResponse } from "@spt/models/eft/location/IGetAirdropLootResponse";
import { AirdropTypeEnum } from "@spt/models/enums/AirdropType"; import { AirdropTypeEnum } from "@spt/models/enums/AirdropType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ItemTpl } from "@spt/models/enums/ItemTpl"; import { ItemTpl } from "@spt/models/enums/ItemTpl";
import { AirdropLoot, IAirdropConfig } from "@spt/models/spt/config/IAirdropConfig"; import { IAirdropConfig, IAirdropLoot } from "@spt/models/spt/config/IAirdropConfig";
import { LootRequest } from "@spt/models/spt/services/LootRequest"; import { LootRequest } from "@spt/models/spt/services/LootRequest";
import { ILogger } from "@spt/models/spt/utils/ILogger"; import { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer"; import { ConfigServer } from "@spt/servers/ConfigServer";
@ -80,7 +80,7 @@ export class AirdropService {
* @param airdropType What tpye of container: weapon/common etc * @param airdropType What tpye of container: weapon/common etc
* @returns Item * @returns Item
*/ */
protected getAirdropCrateItem(airdropType: AirdropTypeEnum): Item { protected getAirdropCrateItem(airdropType: AirdropTypeEnum): IItem {
const airdropContainer = { const airdropContainer = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: "", // picked later _tpl: "", // picked later
@ -125,7 +125,7 @@ export class AirdropService {
* @returns LootRequest * @returns LootRequest
*/ */
protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest { protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest {
let lootSettingsByType: AirdropLoot = this.airdropConfig.loot[airdropType]; let lootSettingsByType: IAirdropLoot = this.airdropConfig.loot[airdropType];
if (!lootSettingsByType) { if (!lootSettingsByType) {
this.logger.error( this.logger.error(
this.localisationService.getText("location-unable_to_find_airdrop_drop_config_of_type", airdropType), this.localisationService.getText("location-unable_to_find_airdrop_drop_config_of_type", airdropType),

View File

@ -2,10 +2,10 @@ import { BotHelper } from "@spt/helpers/BotHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { import {
EquipmentChances, EquipmentChances,
Generation,
GenerationData,
IBotType, IBotType,
ModsChances, IGeneration,
IGenerationData,
IModsChances,
} from "@spt/models/eft/common/tables/IBotType"; } from "@spt/models/eft/common/tables/IBotType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
@ -94,7 +94,7 @@ export class BotEquipmentFilterService {
*/ */
protected adjustChances( protected adjustChances(
equipmentChanges: Record<string, number>, equipmentChanges: Record<string, number>,
baseValues: EquipmentChances | ModsChances, baseValues: EquipmentChances | IModsChances,
): void { ): void {
if (!equipmentChanges) { if (!equipmentChanges) {
return; return;
@ -111,8 +111,8 @@ export class BotEquipmentFilterService {
* @param baseBotGeneration dictionary to update * @param baseBotGeneration dictionary to update
*/ */
protected adjustGenerationChances( protected adjustGenerationChances(
generationChanges: Record<string, GenerationData>, generationChanges: Record<string, IGenerationData>,
baseBotGeneration: Generation, baseBotGeneration: IGeneration,
): void { ): void {
if (!generationChanges) { if (!generationChanges) {
return; return;

View File

@ -1,5 +1,5 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { Mods } from "@spt/models/eft/common/tables/IBotType"; import { IMods } from "@spt/models/eft/common/tables/IBotType";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -15,8 +15,8 @@ import { inject, injectable } from "tsyringe";
@injectable() @injectable()
export class BotEquipmentModPoolService { export class BotEquipmentModPoolService {
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
protected weaponModPool: Mods = {}; protected weaponModPool: IMods = {};
protected gearModPool: Mods = {}; protected gearModPool: IMods = {};
protected weaponPoolGenerated = false; protected weaponPoolGenerated = false;
protected armorPoolGenerated = false; protected armorPoolGenerated = false;

View File

@ -1,5 +1,5 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -77,7 +77,7 @@ export class BotWeaponModLimitService {
modTemplate: ITemplateItem, modTemplate: ITemplateItem,
modLimits: BotModLimits, modLimits: BotModLimits,
modsParent: ITemplateItem, modsParent: ITemplateItem,
weapon: Item[], weapon: IItem[],
): boolean { ): boolean {
// If mod or mods parent is the NcSTAR MPR45 Backup mount, allow it as it looks cool // If mod or mods parent is the NcSTAR MPR45 Backup mount, allow it as it looks cool
if ( if (

View File

@ -5,7 +5,7 @@ import { PresetHelper } from "@spt/helpers/PresetHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IBotHideoutArea } from "@spt/models/eft/common/tables/IBotBase"; import { IBotHideoutArea } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IStageRequirement } from "@spt/models/eft/hideout/IHideoutArea"; import { IStageRequirement } from "@spt/models/eft/hideout/IHideoutArea";
import { IHideoutCircleOfCultistProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutCircleOfCultistProductionStartRequestData"; import { IHideoutCircleOfCultistProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutCircleOfCultistProductionStartRequestData";
import { import {
@ -76,7 +76,7 @@ export class CircleOfCultistService {
// Sparse, just has id // Sparse, just has id
const cultistCraftData = this.databaseService.getHideout().production.cultistRecipes[0]; const cultistCraftData = this.databaseService.getHideout().production.cultistRecipes[0];
const sacrificedItems: Item[] = this.getSacrificedItems(pmcData); const sacrificedItems: IItem[] = this.getSacrificedItems(pmcData);
const sacrificedItemCostRoubles = sacrificedItems.reduce( const sacrificedItemCostRoubles = sacrificedItems.reduce(
(sum, curr) => sum + (this.itemHelper.getItemPrice(curr._tpl) ?? 0), (sum, curr) => sum + (this.itemHelper.getItemPrice(curr._tpl) ?? 0),
0, 0,
@ -120,7 +120,7 @@ export class CircleOfCultistService {
} }
} }
let rewards: Item[][]; let rewards: IItem[][];
if (hasSacrificedSingleItemFlaggedInConfig) { if (hasSacrificedSingleItemFlaggedInConfig) {
rewards = this.getExplicitRewards(directRewardSettings, cultistCircleStashId); rewards = this.getExplicitRewards(directRewardSettings, cultistCircleStashId);
} else { } else {
@ -173,7 +173,7 @@ export class CircleOfCultistService {
sessionId: string, sessionId: string,
pmcData: IPmcData, pmcData: IPmcData,
recipeId: string, recipeId: string,
sacrificedItems: Item[], sacrificedItems: IItem[],
rewardAmountRoubles: number, rewardAmountRoubles: number,
directRewardSettings?: DirectRewardSettings, directRewardSettings?: DirectRewardSettings,
): void { ): void {
@ -230,14 +230,14 @@ export class CircleOfCultistService {
* @param pmcData Player profile * @param pmcData Player profile
* @returns Array of its from player inventory * @returns Array of its from player inventory
*/ */
protected getSacrificedItems(pmcData: IPmcData): Item[] { protected getSacrificedItems(pmcData: IPmcData): IItem[] {
// Get root items that are in the cultist sacrifice window // Get root items that are in the cultist sacrifice window
const inventoryRootItemsInCultistGrid = pmcData.Inventory.items.filter( const inventoryRootItemsInCultistGrid = pmcData.Inventory.items.filter(
(item) => item.slotId === CircleOfCultistService.circleOfCultistSlotId, (item) => item.slotId === CircleOfCultistService.circleOfCultistSlotId,
); );
// Get rootitem + its children // Get rootitem + its children
const sacrificedItems: Item[] = []; const sacrificedItems: IItem[] = [];
for (const rootItem of inventoryRootItemsInCultistGrid) { for (const rootItem of inventoryRootItemsInCultistGrid) {
const rootItemWithChildren = this.itemHelper.findAndReturnChildrenAsItems( const rootItemWithChildren = this.itemHelper.findAndReturnChildrenAsItems(
pmcData.Inventory.items, pmcData.Inventory.items,
@ -260,9 +260,9 @@ export class CircleOfCultistService {
rewardItemTplPool: string[], rewardItemTplPool: string[],
rewardBudget: number, rewardBudget: number,
cultistCircleStashId: string, cultistCircleStashId: string,
): Item[][] { ): IItem[][] {
// Prep rewards array (reward can be item with children, hence array of arrays) // Prep rewards array (reward can be item with children, hence array of arrays)
const rewards: Item[][] = []; const rewards: IItem[][] = [];
// Pick random rewards until we have exhausted the sacrificed items budget // Pick random rewards until we have exhausted the sacrificed items budget
let totalRewardCost = 0; let totalRewardCost = 0;
@ -296,7 +296,7 @@ export class CircleOfCultistService {
} }
// Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
@ -314,7 +314,7 @@ export class CircleOfCultistService {
); );
// Not a weapon/armor, standard single item // Not a weapon/armor, standard single item
const rewardItem: Item = { const rewardItem: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: randomItemTplFromPool, _tpl: randomItemTplFromPool,
parentId: cultistCircleStashId, parentId: cultistCircleStashId,
@ -343,9 +343,12 @@ export class CircleOfCultistService {
* @param cultistCircleStashId Id of stash item * @param cultistCircleStashId Id of stash item
* @returns Array of item arrays * @returns Array of item arrays
*/ */
protected getExplicitRewards(explicitRewardSettings: DirectRewardSettings, cultistCircleStashId: string): Item[][] { protected getExplicitRewards(
explicitRewardSettings: DirectRewardSettings,
cultistCircleStashId: string,
): IItem[][] {
// Prep rewards array (reward can be item with children, hence array of arrays) // Prep rewards array (reward can be item with children, hence array of arrays)
const rewards: Item[][] = []; const rewards: IItem[][] = [];
for (const rewardTpl of explicitRewardSettings.rewardTpls) { for (const rewardTpl of explicitRewardSettings.rewardTpls) {
if ( if (
this.itemHelper.armorItemHasRemovableOrSoftInsertSlots(rewardTpl) || this.itemHelper.armorItemHasRemovableOrSoftInsertSlots(rewardTpl) ||
@ -359,7 +362,7 @@ export class CircleOfCultistService {
} }
// Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items); const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods); this.itemHelper.remapRootItemId(presetAndMods);
@ -372,7 +375,7 @@ export class CircleOfCultistService {
const stackSize = this.getExplicitRewardBaseTypeStackSize(rewardTpl); const stackSize = this.getExplicitRewardBaseTypeStackSize(rewardTpl);
// Not a weapon/armor, standard single item // Not a weapon/armor, standard single item
const rewardItem: Item = { const rewardItem: IItem = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: rewardTpl, _tpl: rewardTpl,
parentId: cultistCircleStashId, parentId: cultistCircleStashId,

View File

@ -3,8 +3,8 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper"; import { PresetHelper } from "@spt/helpers/PresetHelper";
import { IFenceLevel } from "@spt/models/eft/common/IGlobals"; import { IFenceLevel } from "@spt/models/eft/common/IGlobals";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item, Repairable } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpdRepairable } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem, Slot } from "@spt/models/eft/common/tables/ITemplateItem"; import { ISlot, ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IBarterScheme, ITraderAssort } from "@spt/models/eft/common/tables/ITrader"; import { IBarterScheme, ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -149,7 +149,7 @@ export class FenceService {
* @param items the items to add with all its childrens * @param items the items to add with all its childrens
* @param mainItem the most parent item of the array * @param mainItem the most parent item of the array
*/ */
public addItemsToFenceAssort(items: Item[], mainItem: Item): void { public addItemsToFenceAssort(items: IItem[], mainItem: IItem): void {
// HUGE THANKS TO LACYWAY AND LEAVES FOR PROVIDING THIS SOLUTION FOR SPT TO IMPLEMENT!! // HUGE THANKS TO LACYWAY AND LEAVES FOR PROVIDING THIS SOLUTION FOR SPT TO IMPLEMENT!!
// Copy the item and its children // Copy the item and its children
let clonedItems = this.cloner.clone(this.itemHelper.findAndReturnChildrenAsItems(items, mainItem._id)); let clonedItems = this.cloner.clone(this.itemHelper.findAndReturnChildrenAsItems(items, mainItem._id));
@ -181,7 +181,7 @@ export class FenceService {
* @param items the items (with its children) to calculate fence price for * @param items the items (with its children) to calculate fence price for
* @returns the fence price of the item * @returns the fence price of the item
*/ */
public getItemPrice(itemTpl: string, items: Item[]): number { public getItemPrice(itemTpl: string, items: IItem[]): number {
return this.itemHelper.isOfBaseclass(itemTpl, BaseClasses.AMMO_BOX) return this.itemHelper.isOfBaseclass(itemTpl, BaseClasses.AMMO_BOX)
? this.getAmmoBoxPrice(items) * this.traderConfig.fence.itemPriceMult ? this.getAmmoBoxPrice(items) * this.traderConfig.fence.itemPriceMult
: this.handbookHelper.getTemplatePrice(itemTpl) * this.traderConfig.fence.itemPriceMult; : this.handbookHelper.getTemplatePrice(itemTpl) * this.traderConfig.fence.itemPriceMult;
@ -193,7 +193,7 @@ export class FenceService {
* @param items the ammo box (and all its children ammo items) * @param items the ammo box (and all its children ammo items)
* @returns the price of the ammo box * @returns the price of the ammo box
*/ */
protected getAmmoBoxPrice(items: Item[]): number { protected getAmmoBoxPrice(items: IItem[]): number {
let total = 0; let total = 0;
for (const item of items) { for (const item of items) {
if (this.itemHelper.isOfBaseclass(item._tpl, BaseClasses.AMMO)) { if (this.itemHelper.isOfBaseclass(item._tpl, BaseClasses.AMMO)) {
@ -255,7 +255,7 @@ export class FenceService {
* @param presetModifier value to multiply preset price by * @param presetModifier value to multiply preset price by
*/ */
protected adjustItemPriceByModifier( protected adjustItemPriceByModifier(
item: Item, item: IItem,
assort: ITraderAssort, assort: ITraderAssort,
modifier: number, modifier: number,
presetModifier: number, presetModifier: number,
@ -424,7 +424,7 @@ export class FenceService {
* @returns IGenerationAssortValues object with adjustments needed to reach desired state * @returns IGenerationAssortValues object with adjustments needed to reach desired state
*/ */
protected getItemCountsToGenerate( protected getItemCountsToGenerate(
assortItems: Item[], assortItems: IItem[],
generationValues: IGenerationAssortValues, generationValues: IGenerationAssortValues,
): IGenerationAssortValues { ): IGenerationAssortValues {
const allRootItems = assortItems.filter((item) => item.slotId === "hideout"); const allRootItems = assortItems.filter((item) => item.slotId === "hideout");
@ -474,7 +474,7 @@ export class FenceService {
* @param assort Trader assort to remove item from * @param assort Trader assort to remove item from
* @param rootItems Pool of root items to pick from to remove * @param rootItems Pool of root items to pick from to remove
*/ */
protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void { protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: IItem[]): void {
const rootItemToAdjust = this.randomUtil.getArrayValue(rootItems); const rootItemToAdjust = this.randomUtil.getArrayValue(rootItems);
// Items added by mods may not have a upd object, assume item stack size is 1 // Items added by mods may not have a upd object, assume item stack size is 1
@ -771,10 +771,10 @@ export class FenceService {
* @returns Matching assort item * @returns Matching assort item
*/ */
protected getMatchingItem( protected getMatchingItem(
rootItemBeingAdded: Item, rootItemBeingAdded: IItem,
itemDbDetails: ITemplateItem, itemDbDetails: ITemplateItem,
itemsWithChildren: Item[][], itemsWithChildren: IItem[][],
): Item | undefined { ): IItem | undefined {
// Get matching root items // Get matching root items
const matchingItems = itemsWithChildren const matchingItems = itemsWithChildren
.filter((itemWithChildren) => .filter((itemWithChildren) =>
@ -828,7 +828,7 @@ export class FenceService {
* @param itemDbDetails Item we want to add db details * @param itemDbDetails Item we want to add db details
* @returns True item should be force stacked * @returns True item should be force stacked
*/ */
protected itemShouldBeForceStacked(existingItem: Item, itemDbDetails: ITemplateItem): boolean { protected itemShouldBeForceStacked(existingItem: IItem, itemDbDetails: ITemplateItem): boolean {
// No existing item in assort // No existing item in assort
if (!existingItem) { if (!existingItem) {
return false; return false;
@ -855,7 +855,7 @@ export class FenceService {
*/ */
protected adjustItemPriceByQuality( protected adjustItemPriceByQuality(
barterSchemes: Record<string, IBarterScheme[][]>, barterSchemes: Record<string, IBarterScheme[][]>,
itemRoot: Item, itemRoot: IItem,
itemTemplate: ITemplateItem, itemTemplate: ITemplateItem,
): void { ): void {
// Healing items // Healing items
@ -1033,7 +1033,7 @@ export class FenceService {
* @param armor Armor item array to add mods into * @param armor Armor item array to add mods into
* @param itemDbDetails Armor items db template * @param itemDbDetails Armor items db template
*/ */
protected randomiseArmorModDurability(armor: Item[], itemDbDetails: ITemplateItem): void { protected randomiseArmorModDurability(armor: IItem[], itemDbDetails: ITemplateItem): void {
// Armor has no mods, nothing to randomise // Armor has no mods, nothing to randomise
const hasMods = Boolean(itemDbDetails._props.Slots); const hasMods = Boolean(itemDbDetails._props.Slots);
if (!hasMods) { if (!hasMods) {
@ -1060,7 +1060,7 @@ export class FenceService {
* @param softInsertSlots Slots of items to randomise * @param softInsertSlots Slots of items to randomise
* @param armorItemAndMods Array of armor + inserts to get items from * @param armorItemAndMods Array of armor + inserts to get items from
*/ */
protected randomiseArmorSoftInsertDurabilities(softInsertSlots: Slot[], armorItemAndMods: Item[]): void { protected randomiseArmorSoftInsertDurabilities(softInsertSlots: ISlot[], armorItemAndMods: IItem[]): void {
for (const requiredSlot of softInsertSlots) { for (const requiredSlot of softInsertSlots) {
const modItemDbDetails = this.itemHelper.getItem(requiredSlot._props.filters[0].Plate)[1]; const modItemDbDetails = this.itemHelper.getItem(requiredSlot._props.filters[0].Plate)[1];
const durabilityValues = this.getRandomisedArmorDurabilityValues( const durabilityValues = this.getRandomisedArmorDurabilityValues(
@ -1108,7 +1108,7 @@ export class FenceService {
* @param plateSlots Slots of items to randomise * @param plateSlots Slots of items to randomise
* @param armorItemAndMods Array of armor + inserts to get items from * @param armorItemAndMods Array of armor + inserts to get items from
*/ */
protected randomiseArmorInsertsDurabilities(plateSlots: Slot[], armorItemAndMods: Item[]): void { protected randomiseArmorInsertsDurabilities(plateSlots: ISlot[], armorItemAndMods: IItem[]): void {
for (const plateSlot of plateSlots) { for (const plateSlot of plateSlots) {
const plateTpl = plateSlot._props.filters[0].Plate; const plateTpl = plateSlot._props.filters[0].Plate;
if (!plateTpl) { if (!plateTpl) {
@ -1198,7 +1198,7 @@ export class FenceService {
* Remove parts of a weapon prior to being listed on flea * Remove parts of a weapon prior to being listed on flea
* @param itemAndMods Weapon to remove parts from * @param itemAndMods Weapon to remove parts from
*/ */
protected removeRandomModsOfItem(itemAndMods: Item[]): void { protected removeRandomModsOfItem(itemAndMods: IItem[]): void {
// Items to be removed from inventory // Items to be removed from inventory
const toDelete: string[] = []; const toDelete: string[] = [];
@ -1230,7 +1230,7 @@ export class FenceService {
* @param itemsBeingDeleted Current list of items on weapon being deleted * @param itemsBeingDeleted Current list of items on weapon being deleted
* @returns True if item will be removed * @returns True if item will be removed
*/ */
protected presetModItemWillBeRemoved(weaponMod: Item, itemsBeingDeleted: string[]): boolean { protected presetModItemWillBeRemoved(weaponMod: IItem, itemsBeingDeleted: string[]): boolean {
const slotIdsThatCanFail = this.traderConfig.fence.presetSlotsToRemoveChancePercent; const slotIdsThatCanFail = this.traderConfig.fence.presetSlotsToRemoveChancePercent;
const removalChance = slotIdsThatCanFail[weaponMod.slotId]; const removalChance = slotIdsThatCanFail[weaponMod.slotId];
if (!removalChance) { if (!removalChance) {
@ -1248,7 +1248,7 @@ export class FenceService {
* @param itemDetails Item being randomised * @param itemDetails Item being randomised
* @param itemToAdjust Item being edited * @param itemToAdjust Item being edited
*/ */
protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void { protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: IItem): void {
if (!itemDetails._props) { if (!itemDetails._props) {
this.logger.error( this.logger.error(
`Item ${itemDetails._name} lacks a _props field, unable to randomise item: ${itemToAdjust._id}`, `Item ${itemDetails._name} lacks a _props field, unable to randomise item: ${itemToAdjust._id}`,
@ -1335,7 +1335,7 @@ export class FenceService {
protected getRandomisedArmorDurabilityValues( protected getRandomisedArmorDurabilityValues(
itemDetails: ITemplateItem, itemDetails: ITemplateItem,
equipmentDurabilityLimits: IItemDurabilityCurrentMax, equipmentDurabilityLimits: IItemDurabilityCurrentMax,
): Repairable { ): IUpdRepairable {
const maxDuraMin = (equipmentDurabilityLimits.max.min / 100) * itemDetails._props.MaxDurability; const maxDuraMin = (equipmentDurabilityLimits.max.min / 100) * itemDetails._props.MaxDurability;
const maxDuraMax = (equipmentDurabilityLimits.max.max / 100) * itemDetails._props.MaxDurability; const maxDuraMax = (equipmentDurabilityLimits.max.max / 100) * itemDetails._props.MaxDurability;
const chosenMaxDurability = this.randomUtil.getInt(maxDuraMin, maxDuraMax); const chosenMaxDurability = this.randomUtil.getInt(maxDuraMin, maxDuraMax);
@ -1444,7 +1444,7 @@ export class FenceService {
fenceAssortItem.upd.StackObjectsCount -= buyCount; fenceAssortItem.upd.StackObjectsCount -= buyCount;
} }
protected deleteOffer(assortId: string, assorts: Item[]): void { protected deleteOffer(assortId: string, assorts: IItem[]): void {
// Assort could have child items, remove those too // Assort could have child items, remove those too
const itemWithChildrenToRemove = this.itemHelper.findAndReturnChildrenAsItems(assorts, assortId); const itemWithChildrenToRemove = this.itemHelper.findAndReturnChildrenAsItems(assorts, assortId);
for (const itemToRemove of itemWithChildrenToRemove) { for (const itemToRemove of itemWithChildrenToRemove) {

View File

@ -4,7 +4,7 @@ import { GiftSenderType } from "@spt/models/enums/GiftSenderType";
import { GiftSentResult } from "@spt/models/enums/GiftSentResult"; import { GiftSentResult } from "@spt/models/enums/GiftSentResult";
import { MessageType } from "@spt/models/enums/MessageType"; import { MessageType } from "@spt/models/enums/MessageType";
import { Traders } from "@spt/models/enums/Traders"; import { Traders } from "@spt/models/enums/Traders";
import { Gift, IGiftsConfig } from "@spt/models/spt/config/IGiftsConfig"; import { IGift, IGiftsConfig } from "@spt/models/spt/config/IGiftsConfig";
import { ISendMessageDetails } from "@spt/models/spt/dialog/ISendMessageDetails"; import { ISendMessageDetails } from "@spt/models/spt/dialog/ISendMessageDetails";
import { ILogger } from "@spt/models/spt/utils/ILogger"; import { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer"; import { ConfigServer } from "@spt/servers/ConfigServer";
@ -39,7 +39,7 @@ export class GiftService {
return !!this.giftConfig.gifts[giftId]; return !!this.giftConfig.gifts[giftId];
} }
public getGiftById(giftId: string): Gift { public getGiftById(giftId: string): IGift {
return this.giftConfig.gifts[giftId]; return this.giftConfig.gifts[giftId];
} }
@ -47,7 +47,7 @@ export class GiftService {
* Get dictionary of all gifts * Get dictionary of all gifts
* @returns Dict keyed by gift id * @returns Dict keyed by gift id
*/ */
public getGifts(): Record<string, Gift> { public getGifts(): Record<string, IGift> {
return this.giftConfig.gifts; return this.giftConfig.gifts;
} }
@ -164,7 +164,7 @@ export class GiftService {
* @param giftData Gift to send player * @param giftData Gift to send player
* @returns trader/user/system id * @returns trader/user/system id
*/ */
protected getSenderId(giftData: Gift): string | undefined { protected getSenderId(giftData: IGift): string | undefined {
if (giftData.sender === GiftSenderType.TRADER) { if (giftData.sender === GiftSenderType.TRADER) {
return Traders[giftData.trader]; return Traders[giftData.trader];
} }
@ -179,7 +179,7 @@ export class GiftService {
* @param giftData Gift to send player * @param giftData Gift to send player
* @returns MessageType enum value * @returns MessageType enum value
*/ */
protected getMessageType(giftData: Gift): MessageType | undefined { protected getMessageType(giftData: IGift): MessageType | undefined {
switch (giftData.sender) { switch (giftData.sender) {
case GiftSenderType.SYSTEM: case GiftSenderType.SYSTEM:
return MessageType.SYSTEM_MESSAGE; return MessageType.SYSTEM_MESSAGE;

View File

@ -2,7 +2,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITraderBase } from "@spt/models/eft/common/tables/ITrader"; import { ITraderBase } from "@spt/models/eft/common/tables/ITrader";
import { BonusType } from "@spt/models/enums/BonusType"; import { BonusType } from "@spt/models/enums/BonusType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -24,7 +24,7 @@ import { inject, injectable } from "tsyringe";
@injectable() @injectable()
export class InsuranceService { export class InsuranceService {
protected insured: Record<string, Record<string, Item[]>> = {}; protected insured: Record<string, Record<string, IItem[]>> = {};
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor( constructor(
@ -59,7 +59,7 @@ export class InsuranceService {
* @param sessionId Profile id (session id) * @param sessionId Profile id (session id)
* @returns Item array * @returns Item array
*/ */
public getInsurance(sessionId: string): Record<string, Item[]> { public getInsurance(sessionId: string): Record<string, IItem[]> {
return this.insured[sessionId]; return this.insured[sessionId];
} }
@ -214,7 +214,7 @@ export class InsuranceService {
*/ */
public mapInsuredItemsToTrader( public mapInsuredItemsToTrader(
sessionId: string, sessionId: string,
lostInsuredItems: Item[], lostInsuredItems: IItem[],
pmcProfile: IPmcData, pmcProfile: IPmcData,
): IInsuranceEquipmentPkg[] { ): IInsuranceEquipmentPkg[] {
const result: IInsuranceEquipmentPkg[] = []; const result: IInsuranceEquipmentPkg[] = [];
@ -251,7 +251,7 @@ export class InsuranceService {
* @param inventoryItems Player inventory * @param inventoryItems Player inventory
* @returns True if item * @returns True if item
*/ */
protected itemCannotBeLostOnDeath(lostItem: Item, inventoryItems: Item[]): boolean { protected itemCannotBeLostOnDeath(lostItem: IItem, inventoryItems: IItem[]): boolean {
if (lostItem.slotId?.toLowerCase().startsWith("specialslot")) { if (lostItem.slotId?.toLowerCase().startsWith("specialslot")) {
return true; return true;
} }
@ -320,7 +320,7 @@ export class InsuranceService {
* @param traderId Trader item insured with * @param traderId Trader item insured with
* @param itemToAdd Insured item (with children) * @param itemToAdd Insured item (with children)
*/ */
public addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void { public addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: IItem): void {
this.insured[sessionId][traderId].push(itemToAdd); this.insured[sessionId][traderId].push(itemToAdd);
} }
@ -331,7 +331,7 @@ export class InsuranceService {
* @param traderId Trader item is insured with * @param traderId Trader item is insured with
* @returns price in roubles * @returns price in roubles
*/ */
public getRoublePriceToInsureItemWithTrader(pmcData: IPmcData, inventoryItem: Item, traderId: string): number { public getRoublePriceToInsureItemWithTrader(pmcData: IPmcData, inventoryItem: IItem, traderId: string): number {
const price = const price =
this.itemHelper.getStaticItemPrice(inventoryItem._tpl) * this.itemHelper.getStaticItemPrice(inventoryItem._tpl) *
(this.traderHelper.getLoyaltyLevel(traderId, pmcData).insurance_price_coef / 100); (this.traderHelper.getLoyaltyLevel(traderId, pmcData).insurance_price_coef / 100);

View File

@ -7,7 +7,7 @@ import { InRaidHelper } from "@spt/helpers/InRaidHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IEndOfflineRaidRequestData } from "@spt/models/eft/match/IEndOfflineRaidRequestData"; import { IEndOfflineRaidRequestData } from "@spt/models/eft/match/IEndOfflineRaidRequestData";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { MessageType } from "@spt/models/enums/MessageType"; import { MessageType } from "@spt/models/enums/MessageType";
@ -237,7 +237,7 @@ export class LegacyLocationLifecycleService {
protected sendCoopTakenFenceMessage(sessionId: string): void { protected sendCoopTakenFenceMessage(sessionId: string): void {
// Generate reward for taking coop extract // Generate reward for taking coop extract
const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift); const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift);
const mailableLoot: Item[] = []; const mailableLoot: IItem[] = [];
const parentId = this.hashUtil.generate(); const parentId = this.hashUtil.generate();
for (const item of loot) { for (const item of loot) {

View File

@ -10,7 +10,7 @@ import { TraderHelper } from "@spt/helpers/TraderHelper";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase"; import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Common, IQuestStatus, ITraderInfo } from "@spt/models/eft/common/tables/IBotBase"; import { Common, IQuestStatus, ITraderInfo } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IEndLocalRaidRequestData, IEndRaidResult } from "@spt/models/eft/match/IEndLocalRaidRequestData"; import { IEndLocalRaidRequestData, IEndRaidResult } from "@spt/models/eft/match/IEndLocalRaidRequestData";
import { IStartLocalRaidRequestData } from "@spt/models/eft/match/IStartLocalRaidRequestData"; import { IStartLocalRaidRequestData } from "@spt/models/eft/match/IStartLocalRaidRequestData";
import { IStartLocalRaidResponseData } from "@spt/models/eft/match/IStartLocalRaidResponseData"; import { IStartLocalRaidResponseData } from "@spt/models/eft/match/IStartLocalRaidResponseData";
@ -456,7 +456,7 @@ export class LocationLifecycleService {
protected sendCoopTakenFenceMessage(sessionId: string): void { protected sendCoopTakenFenceMessage(sessionId: string): void {
// Generate reward for taking coop extract // Generate reward for taking coop extract
const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift); const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift);
const mailableLoot: Item[] = []; const mailableLoot: IItem[] = [];
const parentId = this.hashUtil.generate(); const parentId = this.hashUtil.generate();
for (const item of loot) { for (const item of loot) {
@ -694,7 +694,7 @@ export class LocationLifecycleService {
this.btrItemDelivery(sessionId, Traders.BTR, itemsToSend); this.btrItemDelivery(sessionId, Traders.BTR, itemsToSend);
} }
protected btrItemDelivery(sessionId: string, traderId: string, items: Item[]): void { protected btrItemDelivery(sessionId: string, traderId: string, items: IItem[]): void {
const serverProfile = this.saveServer.getProfile(sessionId); const serverProfile = this.saveServer.getProfile(sessionId);
const pmcData = serverProfile.characters.pmc; const pmcData = serverProfile.characters.pmc;
@ -756,7 +756,7 @@ export class LocationLifecycleService {
* @param items Players inventory to search through * @param items Players inventory to search through
* @returns an array of equipped items * @returns an array of equipped items
*/ */
protected getEquippedGear(items: Item[]): Item[] { protected getEquippedGear(items: IItem[]): IItem[] {
// Player Slots we care about // Player Slots we care about
const inventorySlots = [ const inventorySlots = [
"FirstPrimaryWeapon", "FirstPrimaryWeapon",
@ -781,7 +781,7 @@ export class LocationLifecycleService {
"SpecialSlot3", "SpecialSlot3",
]; ];
let inventoryItems: Item[] = []; let inventoryItems: IItem[] = [];
// Get an array of root player items // Get an array of root player items
for (const item of items) { for (const item of items) {

View File

@ -3,7 +3,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper"; import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper";
import { NotifierHelper } from "@spt/helpers/NotifierHelper"; import { NotifierHelper } from "@spt/helpers/NotifierHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { import {
Dialogue, Dialogue,
ISystemData, ISystemData,
@ -56,7 +56,7 @@ export class MailSendService {
trader: Traders, trader: Traders,
messageType: MessageType, messageType: MessageType,
message: string, message: string,
items: Item[] = [], items: IItem[] = [],
maxStorageTimeSeconds?: number, maxStorageTimeSeconds?: number,
systemData?: ISystemData, systemData?: ISystemData,
ragfair?: MessageContentRagfair, ragfair?: MessageContentRagfair,
@ -111,7 +111,7 @@ export class MailSendService {
trader: Traders, trader: Traders,
messageType: MessageType, messageType: MessageType,
messageLocaleId: string, messageLocaleId: string,
items: Item[] = [], items: IItem[] = [],
maxStorageTimeSeconds?: number, maxStorageTimeSeconds?: number,
systemData?: ISystemData, systemData?: ISystemData,
ragfair?: MessageContentRagfair, ragfair?: MessageContentRagfair,
@ -162,7 +162,7 @@ export class MailSendService {
public sendSystemMessageToPlayer( public sendSystemMessageToPlayer(
sessionId: string, sessionId: string,
message: string, message: string,
items: Item[] = [], items: IItem[] = [],
maxStorageTimeSeconds?: number, maxStorageTimeSeconds?: number,
profileChangeEvents?: IProfileChangeEvent[], profileChangeEvents?: IProfileChangeEvent[],
): void { ): void {
@ -195,7 +195,7 @@ export class MailSendService {
public sendLocalisedSystemMessageToPlayer( public sendLocalisedSystemMessageToPlayer(
sessionId: string, sessionId: string,
messageLocaleId: string, messageLocaleId: string,
items: Item[] = [], items: IItem[] = [],
profileChangeEvents?: IProfileChangeEvent[], profileChangeEvents?: IProfileChangeEvent[],
maxStorageTimeSeconds?: number, maxStorageTimeSeconds?: number,
): void { ): void {
@ -230,7 +230,7 @@ export class MailSendService {
sessionId: string, sessionId: string,
senderDetails: IUserDialogInfo, senderDetails: IUserDialogInfo,
message: string, message: string,
items: Item[] = [], items: IItem[] = [],
maxStorageTimeSeconds?: number, maxStorageTimeSeconds?: number,
): void { ): void {
const details: ISendMessageDetails = { const details: ISendMessageDetails = {
@ -440,7 +440,7 @@ export class MailSendService {
// Boxes can contain sub-items // Boxes can contain sub-items
if (this.itemHelper.isOfBaseclass(itemTemplate._id, BaseClasses.AMMO_BOX)) { if (this.itemHelper.isOfBaseclass(itemTemplate._id, BaseClasses.AMMO_BOX)) {
const boxAndCartridges: Item[] = [reward]; const boxAndCartridges: IItem[] = [reward];
this.itemHelper.addCartridgesToAmmoBox(boxAndCartridges, itemTemplate); this.itemHelper.addCartridgesToAmmoBox(boxAndCartridges, itemTemplate);
// Push box + cartridge children into array // Push box + cartridge children into array
@ -471,7 +471,7 @@ export class MailSendService {
* @param items Possible items to choose from * @param items Possible items to choose from
* @returns Chosen 'primary' item * @returns Chosen 'primary' item
*/ */
protected getBaseItemFromRewards(items: Item[]): Item { protected getBaseItemFromRewards(items: IItem[]): IItem {
// Only one item in reward, return it // Only one item in reward, return it
if (items?.length === 1) { if (items?.length === 1) {
return items[0]; return items[0];

View File

@ -1,5 +1,5 @@
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData"; import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData";
import { IInventoryDeleteMarkerRequestData } from "@spt/models/eft/inventory/IInventoryDeleteMarkerRequestData"; import { IInventoryDeleteMarkerRequestData } from "@spt/models/eft/inventory/IInventoryDeleteMarkerRequestData";
import { IInventoryEditMarkerRequestData } from "@spt/models/eft/inventory/IInventoryEditMarkerRequestData"; import { IInventoryEditMarkerRequestData } from "@spt/models/eft/inventory/IInventoryEditMarkerRequestData";
@ -16,7 +16,7 @@ export class MapMarkerService {
* @param request Add marker request * @param request Add marker request
* @returns Item * @returns Item
*/ */
public createMarkerOnMap(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData): Item { public createMarkerOnMap(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData): IItem {
// Get map from inventory // Get map from inventory
const mapItem = pmcData.Inventory.items.find((i) => i._id === request.item); const mapItem = pmcData.Inventory.items.find((i) => i._id === request.item);
@ -36,7 +36,7 @@ export class MapMarkerService {
* @param request Delete marker request * @param request Delete marker request
* @returns Item * @returns Item
*/ */
public deleteMarkerFromMap(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData): Item { public deleteMarkerFromMap(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData): IItem {
// Get map from inventory // Get map from inventory
const mapItem = pmcData.Inventory.items.find((item) => item._id === request.item); const mapItem = pmcData.Inventory.items.find((item) => item._id === request.item);
@ -55,7 +55,7 @@ export class MapMarkerService {
* @param request Edit marker request * @param request Edit marker request
* @returns Item * @returns Item
*/ */
public editMarkerOnMap(pmcData: IPmcData, request: IInventoryEditMarkerRequestData): Item { public editMarkerOnMap(pmcData: IPmcData, request: IInventoryEditMarkerRequestData): IItem {
// Get map from inventory // Get map from inventory
const mapItem = pmcData.Inventory.items.find((item) => item._id === request.item); const mapItem = pmcData.Inventory.items.find((item) => item._id === request.item);

View File

@ -4,7 +4,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PaymentHelper } from "@spt/helpers/PaymentHelper"; import { PaymentHelper } from "@spt/helpers/PaymentHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper"; import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest"; import { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
@ -303,7 +303,7 @@ export class PaymentService {
* @param playerStashId Players stash id * @param playerStashId Players stash id
* @returns Sorting money items * @returns Sorting money items
*/ */
protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[] { protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): IItem[] {
const moneyItemsInInventory = this.itemHelper.findBarterItems("tpl", pmcData.Inventory.items, currencyTpl); const moneyItemsInInventory = this.itemHelper.findBarterItems("tpl", pmcData.Inventory.items, currencyTpl);
if (moneyItemsInInventory?.length === 0) { if (moneyItemsInInventory?.length === 0) {
this.logger.debug(`No ${currencyTpl} money items found in inventory`); this.logger.debug(`No ${currencyTpl} money items found in inventory`);
@ -324,7 +324,7 @@ export class PaymentService {
* @param playerStashId Players stash id * @param playerStashId Players stash id
* @returns sort order * @returns sort order
*/ */
protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number { protected prioritiseStashSort(a: IItem, b: IItem, inventoryItems: IItem[], playerStashId: string): number {
// a in stash, prioritise // a in stash, prioritise
if (a.slotId === "hideout" && b.slotId !== "hideout") { if (a.slotId === "hideout" && b.slotId !== "hideout") {
return -1; return -1;
@ -363,7 +363,7 @@ export class PaymentService {
* @param playerStashId Players stash id * @param playerStashId Players stash id
* @returns true if its in inventory * @returns true if its in inventory
*/ */
protected isInStash(itemId: string | undefined, inventoryItems: Item[], playerStashId: string): boolean { protected isInStash(itemId: string | undefined, inventoryItems: IItem[], playerStashId: string): boolean {
const itemParent = inventoryItems.find((x) => x._id === itemId); const itemParent = inventoryItems.find((x) => x._id === itemId);
if (itemParent) { if (itemParent) {

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper"; import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
@ -86,8 +86,8 @@ export class RagfairOfferService {
* Get an array of arrays of expired offer items + children * Get an array of arrays of expired offer items + children
* @returns Expired offer assorts * @returns Expired offer assorts
*/ */
public getExpiredOfferAssorts(): Item[][] { public getExpiredOfferAssorts(): IItem[][] {
const expiredItems: Item[][] = []; const expiredItems: IItem[][] = [];
for (const expiredOfferId in this.expiredOffers) { for (const expiredOfferId in this.expiredOffers) {
const expiredOffer = this.expiredOffers[expiredOfferId]; const expiredOffer = this.expiredOffers[expiredOfferId];
@ -277,8 +277,8 @@ export class RagfairOfferService {
* @param items Offer items to unstack * @param items Offer items to unstack
* @returns Unstacked array of items * @returns Unstacked array of items
*/ */
protected unstackOfferItems(items: Item[]): Item[] { protected unstackOfferItems(items: IItem[]): IItem[] {
const result: Item[] = []; const result: IItem[] = [];
const rootItem = items[0]; const rootItem = items[0];
const itemDetails = this.itemHelper.getItem(rootItem._tpl); const itemDetails = this.itemHelper.getItem(rootItem._tpl);
const itemMaxStackSize = itemDetails[1]._props.StackMaxSize ?? 1; const itemMaxStackSize = itemDetails[1]._props.StackMaxSize ?? 1;

View File

@ -6,7 +6,7 @@ import { TraderHelper } from "@spt/helpers/TraderHelper";
import { MinMax } from "@spt/models/common/MinMax"; import { MinMax } from "@spt/models/common/MinMax";
import { IPreset } from "@spt/models/eft/common/IGlobals"; import { IPreset } from "@spt/models/eft/common/IGlobals";
import { IHandbookItem } from "@spt/models/eft/common/tables/IHandbookBase"; import { IHandbookItem } from "@spt/models/eft/common/tables/IHandbookBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader"; import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -103,7 +103,7 @@ export class RagfairPriceService implements OnLoad {
* @param offerItems offer item + children to process * @param offerItems offer item + children to process
* @returns Rouble price * @returns Rouble price
*/ */
public getFleaPriceForOfferItems(offerItems: Item[]): number { public getFleaPriceForOfferItems(offerItems: IItem[]): number {
// Preset weapons take the direct prices.json value, otherwise they're massivly inflated // Preset weapons take the direct prices.json value, otherwise they're massivly inflated
if (this.itemHelper.isOfBaseclass(offerItems[0]._tpl, BaseClasses.WEAPON)) { if (this.itemHelper.isOfBaseclass(offerItems[0]._tpl, BaseClasses.WEAPON)) {
return this.getFleaPriceForItem(offerItems[0]._tpl); return this.getFleaPriceForItem(offerItems[0]._tpl);
@ -203,7 +203,7 @@ export class RagfairPriceService implements OnLoad {
* @param isPackOffer Price is for a pack type offer * @param isPackOffer Price is for a pack type offer
* @returns cost of item in desired currency * @returns cost of item in desired currency
*/ */
public getDynamicOfferPriceForOffer(offerItems: Item[], desiredCurrency: string, isPackOffer: boolean): number { public getDynamicOfferPriceForOffer(offerItems: IItem[], desiredCurrency: string, isPackOffer: boolean): number {
// Price to return. // Price to return.
let price = 0; let price = 0;
@ -242,8 +242,8 @@ export class RagfairPriceService implements OnLoad {
public getDynamicItemPrice( public getDynamicItemPrice(
itemTemplateId: string, itemTemplateId: string,
desiredCurrency: string, desiredCurrency: string,
item?: Item, item?: IItem,
offerItems?: Item[], offerItems?: IItem[],
isPackOffer?: boolean, isPackOffer?: boolean,
): number { ): number {
let isPreset = false; let isPreset = false;
@ -416,7 +416,7 @@ export class RagfairPriceService implements OnLoad {
* @param existingPrice price of existing base weapon * @param existingPrice price of existing base weapon
* @returns price of weapon in roubles * @returns price of weapon in roubles
*/ */
protected getWeaponPresetPrice(weaponRootItem: Item, weaponWithChildren: Item[], existingPrice: number): number { protected getWeaponPresetPrice(weaponRootItem: IItem, weaponWithChildren: IItem[], existingPrice: number): number {
// Get the default preset for this weapon // Get the default preset for this weapon
const presetResult = this.getWeaponPreset(weaponRootItem); const presetResult = this.getWeaponPreset(weaponRootItem);
if (presetResult.isDefault) { if (presetResult.isDefault) {
@ -477,7 +477,7 @@ export class RagfairPriceService implements OnLoad {
* @param presets weapon presets to choose from * @param presets weapon presets to choose from
* @returns Default preset object * @returns Default preset object
*/ */
protected getWeaponPreset(weapon: Item): { isDefault: boolean; preset: IPreset } { protected getWeaponPreset(weapon: IItem): { isDefault: boolean; preset: IPreset } {
const defaultPreset = this.presetHelper.getDefaultPreset(weapon._tpl); const defaultPreset = this.presetHelper.getDefaultPreset(weapon._tpl);
if (defaultPreset) { if (defaultPreset) {
return { isDefault: true, preset: defaultPreset }; return { isDefault: true, preset: defaultPreset };

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IStorePlayerOfferTaxAmountRequestData } from "@spt/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; import { IStorePlayerOfferTaxAmountRequestData } from "@spt/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData";
import { BonusType } from "@spt/models/enums/BonusType"; import { BonusType } from "@spt/models/enums/BonusType";
@ -47,7 +47,7 @@ export class RagfairTaxService {
* @returns Tax in roubles * @returns Tax in roubles
*/ */
public calculateTax( public calculateTax(
item: Item, item: IItem,
pmcData: IPmcData, pmcData: IPmcData,
requirementsValue: number, requirementsValue: number,
offerItemCount: number, offerItemCount: number,
@ -110,7 +110,7 @@ export class RagfairTaxService {
// This method is trying to replicate the item worth calculation method found in the client code. // This method is trying to replicate the item worth calculation method found in the client code.
// Any inefficiencies or style issues are intentional and should not be fixed, to preserve the client-side code mirroring. // Any inefficiencies or style issues are intentional and should not be fixed, to preserve the client-side code mirroring.
protected calculateItemWorth( protected calculateItemWorth(
item: Item, item: IItem,
itemTemplate: ITemplateItem, itemTemplate: ITemplateItem,
itemCount: number, itemCount: number,
pmcData: IPmcData, pmcData: IPmcData,

View File

@ -5,7 +5,7 @@ import { TraderHelper } from "@spt/helpers/TraderHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IArmorType } from "@spt/models/eft/common/IGlobals"; import { IArmorType } from "@spt/models/eft/common/IGlobals";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { RepairKitsInfo } from "@spt/models/eft/repair/IRepairActionDataRequest"; import { RepairKitsInfo } from "@spt/models/eft/repair/IRepairActionDataRequest";
@ -424,7 +424,7 @@ export class RepairService {
* @param repairKitDetails Repair kit details from db * @param repairKitDetails Repair kit details from db
* @param repairKitInInventory Repair kit to update * @param repairKitInInventory Repair kit to update
*/ */
protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void { protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: IItem): void {
const maxRepairAmount = repairKitDetails._props.MaxRepairResource; const maxRepairAmount = repairKitDetails._props.MaxRepairResource;
if (!repairKitInInventory.upd) { if (!repairKitInInventory.upd) {
this.logger.debug(`Repair kit: ${repairKitInInventory._id} in inventory lacks upd object, adding`); this.logger.debug(`Repair kit: ${repairKitInInventory._id} in inventory lacks upd object, adding`);
@ -470,7 +470,7 @@ export class RepairService {
* @param itemConfig weapon/armor config * @param itemConfig weapon/armor config
* @param repairDetails Details for item to repair * @param repairDetails Details for item to repair
*/ */
public addBuff(itemConfig: BonusSettings, item: Item): void { public addBuff(itemConfig: BonusSettings, item: IItem): void {
const bonusRarity = this.weightedRandomHelper.getWeightedValue<string>(itemConfig.rarityWeight); const bonusRarity = this.weightedRandomHelper.getWeightedValue<string>(itemConfig.rarityWeight);
const bonusType = this.weightedRandomHelper.getWeightedValue<string>(itemConfig.bonusTypeWeight); const bonusType = this.weightedRandomHelper.getWeightedValue<string>(itemConfig.bonusTypeWeight);
@ -612,7 +612,7 @@ export class RepairService {
export class RepairDetails { export class RepairDetails {
repairCost?: number; repairCost?: number;
repairPoints?: number; repairPoints?: number;
repairedItem: Item; repairedItem: IItem;
repairedItemIsArmor: boolean; repairedItemIsArmor: boolean;
repairAmount: number; repairAmount: number;
repairedByKit: boolean; repairedByKit: boolean;

View File

@ -3,7 +3,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IConfig } from "@spt/models/eft/common/IGlobals"; import { IConfig } from "@spt/models/eft/common/IGlobals";
import { ILocation } from "@spt/models/eft/common/ILocation"; import { ILocation } from "@spt/models/eft/common/ILocation";
import { IBossLocationSpawn } from "@spt/models/eft/common/ILocationBase"; import { IBossLocationSpawn } from "@spt/models/eft/common/ILocationBase";
import { Inventory } from "@spt/models/eft/common/tables/IBotType"; import { IInventory } from "@spt/models/eft/common/tables/IBotType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ItemTpl } from "@spt/models/enums/ItemTpl"; import { ItemTpl } from "@spt/models/enums/ItemTpl";
import { Season } from "@spt/models/enums/Season"; import { Season } from "@spt/models/enums/Season";
@ -258,7 +258,7 @@ export class SeasonalEventService {
* @param botInventory Bots inventory to iterate over * @param botInventory Bots inventory to iterate over
* @param botRole the role of the bot being processed * @param botRole the role of the bot being processed
*/ */
public removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void { public removeChristmasItemsFromBotInventory(botInventory: IInventory, botRole: string): void {
const christmasItems = this.getChristmasEventItems(); const christmasItems = this.getChristmasEventItems();
const equipmentSlotsToFilter = ["FaceCover", "Headwear", "Backpack", "TacticalVest"]; const equipmentSlotsToFilter = ["FaceCover", "Headwear", "Backpack", "TacticalVest"];
const lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"]; const lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"];

View File

@ -1,7 +1,7 @@
import "reflect-metadata"; import "reflect-metadata";
import { InsuranceController } from "@spt/controllers/InsuranceController"; import { InsuranceController } from "@spt/controllers/InsuranceController";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { Insurance } from "@spt/models/eft/profile/ISptProfile"; import { Insurance } from "@spt/models/eft/profile/ISptProfile";
import { MessageType } from "@spt/models/enums/MessageType"; import { MessageType } from "@spt/models/enums/MessageType";
import { ProfileInsuranceFactory } from "@tests/__factories__/ProfileInsurance.factory"; import { ProfileInsuranceFactory } from "@tests/__factories__/ProfileInsurance.factory";
@ -434,7 +434,7 @@ describe("InsuranceController", () => {
// Since no parent attachments exist, the map should be empty. // Since no parent attachments exist, the map should be empty.
const mockPopulateParentAttachmentsMap = vi.fn(() => { const mockPopulateParentAttachmentsMap = vi.fn(() => {
return new Map<string, Item[]>(); return new Map<string, IItem[]>();
}); });
vi.spyOn(insuranceController, "populateParentAttachmentsMap").mockImplementation( vi.spyOn(insuranceController, "populateParentAttachmentsMap").mockImplementation(
mockPopulateParentAttachmentsMap, mockPopulateParentAttachmentsMap,

View File

@ -1,7 +1,7 @@
import "reflect-metadata"; import "reflect-metadata";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { Item, Repairable } from "@spt/models/eft/common/tables/IItem"; import { IItem, IUpdRepairable } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { DatabaseServer } from "@spt/servers/DatabaseServer"; import { DatabaseServer } from "@spt/servers/DatabaseServer";
import { HashUtil } from "@spt/utils/HashUtil"; import { HashUtil } from "@spt/utils/HashUtil";
@ -216,7 +216,7 @@ describe("ItemHelper", () => {
describe("fixItemStackCount", () => { describe("fixItemStackCount", () => {
it("should set upd.StackObjectsCount to 1 if upd is undefined", () => { it("should set upd.StackObjectsCount to 1 if upd is undefined", () => {
const initialItem: Item = { _id: "", _tpl: "" }; const initialItem: IItem = { _id: "", _tpl: "" };
const fixedItem = itemHelper.fixItemStackCount(initialItem); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
@ -224,7 +224,7 @@ describe("ItemHelper", () => {
}); });
it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () => { it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () => {
const initialItem: Item = { _id: "", _tpl: "", upd: {} }; const initialItem: IItem = { _id: "", _tpl: "", upd: {} };
const fixedItem = itemHelper.fixItemStackCount(initialItem); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
@ -232,7 +232,7 @@ describe("ItemHelper", () => {
}); });
it("should not change upd.StackObjectsCount if it is already defined", () => { it("should not change upd.StackObjectsCount if it is already defined", () => {
const initialItem: Item = { _id: "", _tpl: "", upd: { StackObjectsCount: 5 } }; const initialItem: IItem = { _id: "", _tpl: "", upd: { StackObjectsCount: 5 } };
const fixedItem = itemHelper.fixItemStackCount(initialItem); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
@ -319,7 +319,7 @@ describe("ItemHelper", () => {
describe("getItemQualityModifier", () => { describe("getItemQualityModifier", () => {
it("should return 1 for an item with no upd", () => { it("should return 1 for an item with no upd", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "590c657e86f77412b013051d", // "Grizzly medical kit" _tpl: "590c657e86f77412b013051d", // "Grizzly medical kit"
}; };
@ -331,7 +331,7 @@ describe("ItemHelper", () => {
it("should return 1 for an item with upd but no relevant fields", () => { it("should return 1 for an item with upd but no relevant fields", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "590c657e86f77412b013051d", // "Grizzly medical kit" _tpl: "590c657e86f77412b013051d", // "Grizzly medical kit"
upd: {}, upd: {},
@ -344,7 +344,7 @@ describe("ItemHelper", () => {
it("should return correct value for a medkit", () => { it("should return correct value for a medkit", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "590c657e86f77412b013051d", // "Grizzly medical kit" _tpl: "590c657e86f77412b013051d", // "Grizzly medical kit"
upd: { upd: {
@ -361,7 +361,7 @@ describe("ItemHelper", () => {
it("should return correct value for a repairable helmet", () => { it("should return correct value for a repairable helmet", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "5b40e1525acfc4771e1c6611", _tpl: "5b40e1525acfc4771e1c6611",
upd: { Repairable: { Durability: 19, MaxDurability: 38 } }, upd: { Repairable: { Durability: 19, MaxDurability: 38 } },
@ -379,7 +379,7 @@ describe("ItemHelper", () => {
it("should return correct value for a reparable weapon", () => { it("should return correct value for a reparable weapon", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "5a38e6bac4a2826c6e06d79b", // "TOZ-106 20ga bolt-action shotgun" _tpl: "5a38e6bac4a2826c6e06d79b", // "TOZ-106 20ga bolt-action shotgun"
upd: { Repairable: { Durability: 20, MaxDurability: 100 } }, upd: { Repairable: { Durability: 20, MaxDurability: 100 } },
@ -392,7 +392,7 @@ describe("ItemHelper", () => {
it("should return correct value for a food or drink item", () => { it("should return correct value for a food or drink item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "5448fee04bdc2dbc018b4567", // "Bottle of water (0.6L)" _tpl: "5448fee04bdc2dbc018b4567", // "Bottle of water (0.6L)"
upd: { upd: {
@ -409,7 +409,7 @@ describe("ItemHelper", () => {
it("should return correct value for a key item", () => { it("should return correct value for a key item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key" _tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key"
upd: { Key: { NumberOfUsages: 5 } }, upd: { Key: { NumberOfUsages: 5 } },
@ -422,7 +422,7 @@ describe("ItemHelper", () => {
it("should return correct value for a resource item", () => { it("should return correct value for a resource item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "5d1b36a186f7742523398433", // "Metal fuel tank" _tpl: "5d1b36a186f7742523398433", // "Metal fuel tank"
upd: { upd: {
@ -440,7 +440,7 @@ describe("ItemHelper", () => {
it("should return correct value for a repair kit item", () => { it("should return correct value for a repair kit item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: { RepairKit: { Resource: 600 } }, upd: { RepairKit: { Resource: 600 } },
@ -453,7 +453,7 @@ describe("ItemHelper", () => {
it("should return 0.01 for an item with upd but all relevant fields are 0", () => { it("should return 0.01 for an item with upd but all relevant fields are 0", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: { RepairKit: { Resource: 0 } }, upd: { RepairKit: { Resource: 0 } },
@ -468,8 +468,8 @@ describe("ItemHelper", () => {
describe("getRepairableItemQualityValue", () => { describe("getRepairableItemQualityValue", () => {
it("should return the correct quality value", () => { it("should return the correct quality value", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
const repairable: Repairable = { Durability: 50, MaxDurability: 100 }; const repairable: IUpdRepairable = { Durability: 50, MaxDurability: 100 };
const item: Item = { _id: "", _tpl: "" }; const item: IItem = { _id: "", _tpl: "" };
// Cast the method to any to allow access to private/protected method. // Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -480,11 +480,11 @@ describe("ItemHelper", () => {
it("should fall back to using Repairable MaxDurability", () => { it("should fall back to using Repairable MaxDurability", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property. weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = { const repairable: IUpdRepairable = {
Durability: 50, Durability: 50,
MaxDurability: 200, // This should be used now. MaxDurability: 200, // This should be used now.
}; };
const item: Item = { _id: "", _tpl: "" }; const item: IItem = { _id: "", _tpl: "" };
// Cast the method to any to allow access to private/protected method. // Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -495,11 +495,11 @@ describe("ItemHelper", () => {
it("should return 1 if durability value is invalid", () => { it("should return 1 if durability value is invalid", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property. weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = { const repairable: IUpdRepairable = {
Durability: 50, Durability: 50,
MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type. MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type.
}; };
const item: Item = { _id: "", _tpl: "" }; const item: IItem = { _id: "", _tpl: "" };
// Mock the logger's error method to prevent it from being actually called. // Mock the logger's error method to prevent it from being actually called.
const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() => {}); const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() => {});
@ -514,11 +514,11 @@ describe("ItemHelper", () => {
it("should not divide by zero", () => { it("should not divide by zero", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property. weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = { const repairable: IUpdRepairable = {
Durability: 50, Durability: 50,
MaxDurability: 0, // This is a problem. MaxDurability: 0, // This is a problem.
}; };
const item: Item = { _id: "", _tpl: "" }; const item: IItem = { _id: "", _tpl: "" };
// Cast the method to any to allow access to private/protected method. // Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -529,11 +529,11 @@ describe("ItemHelper", () => {
it("should log an error if durability is invalid", () => { it("should log an error if durability is invalid", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property. weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = { const repairable: IUpdRepairable = {
Durability: 50, Durability: 50,
MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type. MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type.
}; };
const item: Item = { _id: "", _tpl: "" }; const item: IItem = { _id: "", _tpl: "" };
const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error"); const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error");
@ -546,7 +546,7 @@ describe("ItemHelper", () => {
describe("findAndReturnChildrenByItems", () => { describe("findAndReturnChildrenByItems", () => {
it("should return an array containing only the parent ID when no children are found", () => { it("should return an array containing only the parent ID when no children are found", () => {
const items: Item[] = [ const items: IItem[] = [
{ _id: "1", _tpl: "", parentId: null }, { _id: "1", _tpl: "", parentId: null },
{ _id: "2", _tpl: "", parentId: null }, { _id: "2", _tpl: "", parentId: null },
{ {
@ -560,7 +560,7 @@ describe("ItemHelper", () => {
}); });
it("should return array of child IDs when single-level children are found", () => { it("should return array of child IDs when single-level children are found", () => {
const items: Item[] = [ const items: IItem[] = [
{ _id: "1", _tpl: "", parentId: null }, { _id: "1", _tpl: "", parentId: null },
{ _id: "2", _tpl: "", parentId: "1" }, { _id: "2", _tpl: "", parentId: "1" },
{ {
@ -574,7 +574,7 @@ describe("ItemHelper", () => {
}); });
it("should return array of child IDs when multi-level children are found", () => { it("should return array of child IDs when multi-level children are found", () => {
const items: Item[] = [ const items: IItem[] = [
{ _id: "1", _tpl: "", parentId: null }, { _id: "1", _tpl: "", parentId: null },
{ _id: "2", _tpl: "", parentId: "1" }, { _id: "2", _tpl: "", parentId: "1" },
{ {
@ -589,7 +589,7 @@ describe("ItemHelper", () => {
}); });
it("should return an array containing only the parent ID when parent ID does not exist in items", () => { it("should return an array containing only the parent ID when parent ID does not exist in items", () => {
const items: Item[] = [ const items: IItem[] = [
{ _id: "1", _tpl: "", parentId: null }, { _id: "1", _tpl: "", parentId: null },
{ _id: "2", _tpl: "", parentId: "1" }, { _id: "2", _tpl: "", parentId: "1" },
]; ];
@ -601,7 +601,7 @@ describe("ItemHelper", () => {
describe("getItemStackSize", () => { describe("getItemStackSize", () => {
it("should return 1 when item has no existing stack size", () => { it("should return 1 when item has no existing stack size", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {}, upd: {},
@ -612,7 +612,7 @@ describe("ItemHelper", () => {
it("should return 1 when item has no upd property", () => { it("should return 1 when item has no upd property", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
}; };
@ -622,7 +622,7 @@ describe("ItemHelper", () => {
it("should return 5 when item has existing stack size of 5", () => { it("should return 5 when item has existing stack size of 5", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: { StackObjectsCount: 5 }, upd: { StackObjectsCount: 5 },
@ -635,7 +635,7 @@ describe("ItemHelper", () => {
describe("hasBuyRestrictions", () => { describe("hasBuyRestrictions", () => {
it("should return true when item has buy restriction current and max properties", () => { it("should return true when item has buy restriction current and max properties", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: { BuyRestrictionCurrent: 0, BuyRestrictionMax: 1 }, upd: { BuyRestrictionCurrent: 0, BuyRestrictionMax: 1 },
@ -646,7 +646,7 @@ describe("ItemHelper", () => {
it("should return false when item has no buy restriction current or max properties but does have upd property", () => { it("should return false when item has no buy restriction current or max properties but does have upd property", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {}, upd: {},
@ -657,7 +657,7 @@ describe("ItemHelper", () => {
it("should return false when item has no buy restriction current, max or upd properties", () => { it("should return false when item has no buy restriction current, max or upd properties", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: IItem = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
}; };
@ -686,7 +686,7 @@ describe("ItemHelper", () => {
describe("addCartridgesToAmmoBox", () => { describe("addCartridgesToAmmoBox", () => {
it("should return an array with 1x ammoBox and 1x cartridge item", () => { it("should return an array with 1x ammoBox and 1x cartridge item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [ const ammoBox: IItem[] = [
{ {
_id: itemId, _id: itemId,
_tpl: "5c12619186f7743f871c8a32", // "9x39mm SPP gs ammo pack (8 pcs)" _tpl: "5c12619186f7743f871c8a32", // "9x39mm SPP gs ammo pack (8 pcs)"
@ -703,7 +703,7 @@ describe("ItemHelper", () => {
it("should return an array with 1x ammoBox and 2x cartridge items", () => { it("should return an array with 1x ammoBox and 2x cartridge items", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [ const ammoBox: IItem[] = [
{ {
_id: itemId, _id: itemId,
_tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)"" _tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)""
@ -721,7 +721,7 @@ describe("ItemHelper", () => {
it("should keep original ammo box provided", () => { it("should keep original ammo box provided", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [ const ammoBox: IItem[] = [
{ {
_id: itemId, _id: itemId,
_tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)"" _tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)""
@ -737,7 +737,7 @@ describe("ItemHelper", () => {
it("should return specific cartridge type for the given ammo box provided", () => { it("should return specific cartridge type for the given ammo box provided", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [ const ammoBox: IItem[] = [
{ {
_id: itemId, _id: itemId,
_tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)"" _tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)""
@ -886,7 +886,7 @@ describe("ItemHelper", () => {
describe("splitStack", () => { describe("splitStack", () => {
it("should return array of two items when provided item over its natural stack size limit", () => { it("should return array of two items when provided item over its natural stack size limit", () => {
const stackableItem: Item = { const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(), _id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995 _tpl: "59e690b686f7746c9f75e848", // m995
upd: { upd: {
@ -899,7 +899,7 @@ describe("ItemHelper", () => {
}); });
it("should return same count of items passed in when provided is natural stack size limit", () => { it("should return same count of items passed in when provided is natural stack size limit", () => {
const stackableItem: Item = { const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(), _id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995 _tpl: "59e690b686f7746c9f75e848", // m995
upd: { upd: {
@ -912,7 +912,7 @@ describe("ItemHelper", () => {
}); });
it("should return same item if below max stack size", () => { it("should return same item if below max stack size", () => {
const stackableItem: Item = { const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(), _id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995 _tpl: "59e690b686f7746c9f75e848", // m995
upd: { upd: {
@ -926,7 +926,7 @@ describe("ItemHelper", () => {
}); });
it("should return same item if item has no StackObjectsCount property", () => { it("should return same item if item has no StackObjectsCount property", () => {
const stackableItem: Item = { const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(), _id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995 _tpl: "59e690b686f7746c9f75e848", // m995
upd: {}, upd: {},
@ -936,7 +936,7 @@ describe("ItemHelper", () => {
}); });
it("should return same item if item has no upd object", () => { it("should return same item if item has no upd object", () => {
const stackableItem: Item = { const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(), _id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995 _tpl: "59e690b686f7746c9f75e848", // m995
}; };

View File

@ -1,7 +1,7 @@
import "reflect-metadata"; import "reflect-metadata";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITraderBase } from "@spt/models/eft/common/tables/ITrader"; import { ITraderBase } from "@spt/models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
@ -39,7 +39,7 @@ describe("PaymentService", () => {
upd: { upd: {
StackObjectsCount: costAmount * 4, // More than enough. StackObjectsCount: costAmount * 4, // More than enough.
}, },
} as Item; } as IItem;
// Object representing the player's PMC inventory. // Object representing the player's PMC inventory.
const pmcData = { const pmcData = {
@ -123,12 +123,12 @@ describe("PaymentService", () => {
describe("isInStash", () => { describe("isInStash", () => {
it("should return true when item is direct parent of stash", () => { it("should return true when item is direct parent of stash", () => {
const hashUtil = container.resolve<HashUtil>("HashUtil"); const hashUtil = container.resolve<HashUtil>("HashUtil");
const stashItem: Item = { const stashItem: IItem = {
_id: "stashid", _id: "stashid",
_tpl: "55d7217a4bdc2d86028b456d", // standard stash id _tpl: "55d7217a4bdc2d86028b456d", // standard stash id
}; };
const inventoryItemToFind: Item = { const inventoryItemToFind: IItem = {
_id: hashUtil.generate(), _id: hashUtil.generate(),
_tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar _tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar
parentId: stashItem._id, parentId: stashItem._id,
@ -143,19 +143,19 @@ describe("PaymentService", () => {
it("should return true when item is indirect parent of inventory", () => { it("should return true when item is indirect parent of inventory", () => {
const hashUtil = container.resolve<HashUtil>("HashUtil"); const hashUtil = container.resolve<HashUtil>("HashUtil");
const stashItem: Item = { const stashItem: IItem = {
_id: "stashId", _id: "stashId",
_tpl: "55d7217a4bdc2d86028b456d", // standard stash id _tpl: "55d7217a4bdc2d86028b456d", // standard stash id
}; };
const foodBagToHoldItemToFind: Item = { const foodBagToHoldItemToFind: IItem = {
_id: hashUtil.generate(), _id: hashUtil.generate(),
_tpl: "5c093db286f7740a1b2617e3", _tpl: "5c093db286f7740a1b2617e3",
parentId: stashItem._id, parentId: stashItem._id,
slotId: "hideout", slotId: "hideout",
}; };
const inventoryItemToFind: Item = { const inventoryItemToFind: IItem = {
_id: hashUtil.generate(), _id: hashUtil.generate(),
_tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar _tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar
parentId: foodBagToHoldItemToFind._id, parentId: foodBagToHoldItemToFind._id,
@ -169,12 +169,12 @@ describe("PaymentService", () => {
it("should return false when desired item is not in inventory", () => { it("should return false when desired item is not in inventory", () => {
const hashUtil = container.resolve<HashUtil>("HashUtil"); const hashUtil = container.resolve<HashUtil>("HashUtil");
const stashItem: Item = { const stashItem: IItem = {
_id: "stashId", _id: "stashId",
_tpl: "55d7217a4bdc2d86028b456d", // standard stash id _tpl: "55d7217a4bdc2d86028b456d", // standard stash id
}; };
const inventoryItemToFind: Item = { const inventoryItemToFind: IItem = {
_id: hashUtil.generate(), _id: hashUtil.generate(),
_tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar _tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar
parentId: stashItem._id, parentId: stashItem._id,
@ -189,12 +189,12 @@ describe("PaymentService", () => {
it("should return false when player inventory array has no inventory item", () => { it("should return false when player inventory array has no inventory item", () => {
const hashUtil = container.resolve<HashUtil>("HashUtil"); const hashUtil = container.resolve<HashUtil>("HashUtil");
const stashItem: Item = { const stashItem: IItem = {
_id: "stashId", _id: "stashId",
_tpl: "55d7217a4bdc2d86028b456d", // standard stash id _tpl: "55d7217a4bdc2d86028b456d", // standard stash id
}; };
const inventoryItemToFind: Item = { const inventoryItemToFind: IItem = {
_id: hashUtil.generate(), _id: hashUtil.generate(),
_tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar _tpl: "544fb6cc4bdc2d34748b456e", // Slickers chocolate bar
parentId: stashItem._id, parentId: stashItem._id,