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 { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
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 { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
@ -56,7 +56,7 @@ export class BotCallbacks {
url: string,
info: IEmptyRequestData,
sessionID: string,
): Record<string, Difficulties> {
): Record<string, IDifficulties> {
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 { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
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 { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
@ -129,7 +129,7 @@ export class ProfileCallbacks {
url: string,
info: IEmptyRequestData,
sessionID: string,
): IGetBodyResponseData<GetProfileStatusResponseData> {
): IGetBodyResponseData<IGetProfileStatusResponseData> {
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 { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
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 { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { SideType } from "@spt/models/enums/SideType";
@ -95,7 +95,7 @@ export class BotController {
diffLevel: string,
raidConfig?: IGetRaidConfigurationRequestData,
ignoreRaidSettings = false,
): Difficulty {
): IDifficultyCategories {
let difficulty = diffLevel.toLowerCase();
if (!(raidConfig || ignoreRaidSettings)) {
@ -237,7 +237,7 @@ export class BotController {
* @returns BotGenerationDetails
*/
protected getBotGenerationDetailsForWave(
condition: Condition,
condition: ICondition,
pmcProfile: IPmcData,
allPmcsHaveSameNameAsPlayer: boolean,
raidSettings: IGetRaidConfigurationRequestData,
@ -277,7 +277,7 @@ export class BotController {
* @returns A promise for the bots to be done generating
*/
protected async generateWithBotDetails(
condition: Condition,
condition: ICondition,
botGenerationDetails: BotGenerationDetails,
sessionId: string,
): Promise<void> {
@ -353,7 +353,7 @@ export class BotController {
const raidSettings = this.getMostRecentRaidSettings();
// Create generation request for when cache is empty
const condition: Condition = {
const condition: ICondition = {
Role: requestedBot.Role,
Limit: 5,
Difficulty: requestedBot.Difficulty,

View File

@ -2,7 +2,7 @@ import { HealthHelper } from "@spt/helpers/HealthHelper";
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
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 { IOffraidHealRequestData } from "@spt/models/eft/health/IOffraidHealRequestData";
import { ISyncHealthRequestData } from "@spt/models/eft/health/ISyncHealthRequestData";
@ -169,7 +169,7 @@ export class HealthController {
for (const bodyPartKey in healthTreatmentRequest.difference.BodyParts) {
// 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];
// 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 { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { IHandleQTEEventRequestData } from "@spt/models/eft/hideout/IHandleQTEEventRequestData";
import { IHideoutArea, Stage } from "@spt/models/eft/hideout/IHideoutArea";
@ -353,7 +353,7 @@ export class HideoutController {
pmcData.Inventory.items.push(mannequinToAdd);
// Add pocket child item
const mannequinPocketItemToAdd: Item = {
const mannequinPocketItemToAdd: IItem = {
_id: this.hashUtil.generate(),
_tpl: pmcData.Inventory.items.find(
(item) => item.slotId === "Pockets" && item.parentId === pmcData.Inventory.equipment,
@ -878,7 +878,7 @@ export class HideoutController {
let hoursCrafting = counterHoursCrafting.value;
/** Array of arrays of item + children */
let itemAndChildrenToSendToPlayer: Item[][] = [];
let itemAndChildrenToSendToPlayer: IItem[][] = [];
// Reward is weapon/armor preset, handle differently compared to 'normal' items
const rewardIsPreset = this.presetHelper.hasPreset(recipe.endProduct);
@ -886,7 +886,7 @@ export class HideoutController {
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
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods);
@ -897,7 +897,7 @@ export class HideoutController {
const rewardIsStackable = this.itemHelper.isItemTplStackable(recipe.endProduct);
if (rewardIsStackable) {
// Create root item
const rewardToAdd: Item = {
const rewardToAdd: IItem = {
_id: this.hashUtil.generate(),
_tpl: recipe.endProduct,
upd: { StackObjectsCount: recipe.count },
@ -918,7 +918,7 @@ export class HideoutController {
// Start index at one so we ignore first item in array
const countOfItemsToReward = recipe.count;
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]);
}
}
@ -933,7 +933,7 @@ export class HideoutController {
}
// 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];
if (production.sptRequiredTools?.length > 0) {
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 { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
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 { IGetInsuranceCostResponseData } from "@spt/models/eft/insurance/IGetInsuranceCostResponseData";
import { IInsureRequestData } from "@spt/models/eft/insurance/IInsureRequestData";
@ -232,9 +232,9 @@ export class InsuranceController {
protected populateParentAttachmentsMap(
rootItemParentID: string,
insured: Insurance,
itemsMap: Map<string, Item>,
): Map<string, Item[]> {
const mainParentToAttachmentsMap = new Map<string, Item[]>();
itemsMap: Map<string, IItem>,
): Map<string, IItem[]> {
const mainParentToAttachmentsMap = new Map<string, IItem[]>();
for (const insuredItem of insured.items) {
// Use the parent ID from the item to get the parent item.
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.
*/
protected removeNonModdableAttachments(
parentAttachmentsMap: Map<string, Item[]>,
itemsMap: Map<string, Item>,
): Map<string, Item[]> {
const updatedMap = new Map<string, Item[]>();
parentAttachmentsMap: Map<string, IItem[]>,
itemsMap: Map<string, IItem>,
): Map<string, IItem[]> {
const updatedMap = new Map<string, IItem[]>();
for (const [parentId, attachmentItems] of parentAttachmentsMap) {
const parentItem = itemsMap.get(parentId);
const moddableAttachments: Item[] = [];
const moddableAttachments: IItem[] = [];
for (const attachment of attachmentItems) {
// By default, assume the parent of the current attachment is the main-parent included in the map.
let attachmentParentItem = parentItem;
@ -350,7 +350,7 @@ export class InsuranceController {
protected processRegularItems(
insured: Insurance,
toDelete: Set<string>,
parentAttachmentsMap: Map<string, Item[]>,
parentAttachmentsMap: Map<string, IItem[]>,
): void {
for (const insuredItem of insured.items) {
// 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.
*/
protected processAttachments(
mainParentToAttachmentsMap: Map<string, Item[]>,
itemsMap: Map<string, Item>,
mainParentToAttachmentsMap: Map<string, IItem[]>,
itemsMap: Map<string, IItem>,
traderId: string,
toDelete: Set<string>,
): void {
@ -426,7 +426,7 @@ export class InsuranceController {
* @param toDelete The array that accumulates the IDs of the items to be deleted.
* @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)
const weightedAttachmentByPrice = this.weightAttachmentsByPrice(attachments);
@ -454,7 +454,7 @@ export class InsuranceController {
protected logAttachmentsBeingRemoved(
attachmentIdsToRemove: string[],
attachments: Item[],
attachments: IItem[],
attachmentPrices: Record<string, number>,
): void {
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> = {};
// 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.
* @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);
if (!trader) {
return undefined;
@ -664,11 +664,11 @@ export class InsuranceController {
* @param pmcData Player profile
* @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 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) {
this.logger.debug(`SoftInsertSlots: ${softInsertSlot.slotId}`);
@ -687,7 +687,7 @@ export class InsuranceController {
public cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData {
const response: IGetInsuranceCostResponseData = {};
const pmcData = this.profileHelper.getPmcProfile(sessionID);
const inventoryItemsHash: Record<string, Item> = {};
const inventoryItemsHash: Record<string, IItem> = {};
for (const item of pmcData.Inventory.items) {
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.
interface EnrichedItem extends Item {
interface EnrichedItem extends IItem {
name: string;
dynamicPrice: number;
}

View File

@ -8,7 +8,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { QuestHelper } from "@spt/helpers/QuestHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper";
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 { IInventoryBindRequestData } from "@spt/models/eft/inventory/IInventoryBindRequestData";
import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData";
@ -803,7 +803,7 @@ export class InventoryController {
const isSealedWeaponBox = containerDetailsDb[1]._name.includes("event_container_airdrop");
let foundInRaid = openedItem.upd?.SpawnedInSession;
const rewards: Item[][] = [];
const rewards: IItem[][] = [];
const unlockedWeaponCrates = [
"665829424de4820934746ce6",
"665732e7ac60f009f270d1ef",
@ -933,14 +933,13 @@ export class InventoryController {
for (const itemId of request.items) {
// 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) {
pmcData.Inventory.favoriteItems.splice(indexOfItemAlreadyFavorited, 1);
} 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;
}

View File

@ -8,7 +8,7 @@ import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { ITemplateSide } from "@spt/models/eft/common/tables/IProfileTemplate";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
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 { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
import { IGetProfileSettingsRequest } from "@spt/models/eft/profile/IGetProfileSettingsRequest";
@ -386,9 +386,9 @@ export class ProfileController {
/**
* Handle client/profile/status
*/
public getProfileStatus(sessionId: string): GetProfileStatusResponseData {
public getProfileStatus(sessionId: string): IGetProfileStatusResponseData {
const account = this.saveServer.getProfile(sessionId).info;
const response: GetProfileStatusResponseData = {
const response: IGetProfileStatusResponseData = {
maxPveCountExceeded: false,
profiles: [
{ 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 { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
@ -594,7 +594,7 @@ export class QuestController {
sessionID: string,
pmcData: IPmcData,
completedQuestId: string,
questRewards: Item[],
questRewards: IItem[],
): void {
const quest = this.questHelper.getQuestFromDb(completedQuestId, pmcData);
@ -855,7 +855,7 @@ export class QuestController {
*/
protected showQuestItemHandoverMatchError(
handoverQuestRequest: IHandoverQuestRequestData,
itemHandedOver: Item,
itemHandedOver: IItem,
handoverRequirements: IQuestCondition,
output: IItemEventRouterResponse,
): IItemEventRouterResponse {

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import { BotHelper } from "@spt/helpers/BotHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
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
*/
protected generateAndAddEquipmentToBot(
templateInventory: Inventory,
wornItemChances: Chances,
templateInventory: IInventory,
wornItemChances: IChances,
botRole: string,
botInventory: PmcInventory,
botLevel: number,
@ -275,7 +275,7 @@ export class BotInventoryGenerator {
* @param templateEquipment Equpiment to filter TacticalVest of
* @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(
(newVestDictionary, [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
*/
protected filterRigsToThoseWithoutProtection(
templateEquipment: Equipment,
templateEquipment: IEquipment,
botRole: string,
allowEmptyResult = true,
): void {
@ -475,13 +475,13 @@ export class BotInventoryGenerator {
* @param botLevel level of bot having weapon generated
*/
protected generateAndAddWeaponsToBot(
templateInventory: Inventory,
equipmentChances: Chances,
templateInventory: IInventory,
equipmentChances: IChances,
sessionId: string,
botInventory: PmcInventory,
botRole: string,
isPmc: boolean,
itemGenerationLimitsMinMax: Generation,
itemGenerationLimitsMinMax: IGeneration,
botLevel: number,
): void {
const weaponSlotsToFill = this.getDesiredWeaponsForBot(equipmentChances);
@ -508,7 +508,7 @@ export class BotInventoryGenerator {
* @param equipmentChances Chances bot has certain equipment
* @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);
return [
{ slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary },
@ -541,12 +541,12 @@ export class BotInventoryGenerator {
protected addWeaponAndMagazinesToInventory(
sessionId: string,
weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean },
templateInventory: Inventory,
templateInventory: IInventory,
botInventory: PmcInventory,
equipmentChances: Chances,
equipmentChances: IChances,
botRole: string,
isPmc: boolean,
itemGenerationWeights: Generation,
itemGenerationWeights: IGeneration,
botLevel: number,
): void {
const generatedWeapon = this.botWeaponGenerator.generateRandomWeapon(

View File

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

View File

@ -7,8 +7,8 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IPreset } from "@spt/models/eft/common/IGlobals";
import { IInventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
import { GenerationData, Inventory, ModsChances } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem";
import { IGenerationData, IInventory, IModsChances } from "@spt/models/eft/common/tables/IBotType";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -71,9 +71,9 @@ export class BotWeaponGenerator {
public generateRandomWeapon(
sessionId: string,
equipmentSlot: string,
botTemplateInventory: Inventory,
botTemplateInventory: IInventory,
weaponParentId: string,
modChances: ModsChances,
modChances: IModsChances,
botRole: string,
isPmc: boolean,
botLevel: number,
@ -98,7 +98,7 @@ export class BotWeaponGenerator {
* @param botTemplateInventory e.g. assault.json
* @returns weapon tpl
*/
public pickWeightedWeaponTplFromPool(equipmentSlot: string, botTemplateInventory: Inventory): string {
public pickWeightedWeaponTplFromPool(equipmentSlot: string, botTemplateInventory: IInventory): string {
const weaponPool = botTemplateInventory.equipment[equipmentSlot];
return this.weightedRandomHelper.getWeightedValue<string>(weaponPool);
}
@ -118,9 +118,9 @@ export class BotWeaponGenerator {
sessionId: string,
weaponTpl: string,
slotName: string,
botTemplateInventory: Inventory,
botTemplateInventory: IInventory,
weaponParentId: string,
modChances: ModsChances,
modChances: IModsChances,
botRole: string,
isPmc: boolean,
botLevel: number,
@ -236,7 +236,7 @@ export class BotWeaponGenerator {
* @param ammoTpl Cartridge to add to weapon
* @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) {
const existingItemWithSlot = weaponWithModsArray.find((x) => x.slotId === slotId);
if (!existingItemWithSlot) {
@ -272,7 +272,7 @@ export class BotWeaponGenerator {
equipmentSlot: string,
weaponItemTemplate: ITemplateItem,
botRole: string,
): Item[] {
): IItem[] {
return [
{
_id: this.hashUtil.generate(),
@ -297,7 +297,7 @@ export class BotWeaponGenerator {
weaponParentId: string,
itemTemplate: ITemplateItem,
botRole: string,
): Item[] {
): IItem[] {
// Invalid weapon generated, fallback to preset
this.logger.warning(
this.localisationService.getText(
@ -340,7 +340,7 @@ export class BotWeaponGenerator {
* @param botRole role of bot weapon is for
* @returns true if valid
*/
protected isWeaponValid(weaponItemArray: Item[], botRole: string): boolean {
protected isWeaponValid(weaponItemArray: IItem[], botRole: string): boolean {
for (const mod of weaponItemArray) {
const modTemplate = this.itemHelper.getItem(mod._tpl)[1];
if (!modTemplate._props.Slots?.length) {
@ -381,7 +381,7 @@ export class BotWeaponGenerator {
*/
public addExtraMagazinesToInventory(
generatedWeaponResult: GenerateWeaponResult,
magWeights: GenerationData,
magWeights: IGenerationData,
inventory: PmcInventory,
botRole: string,
): void {
@ -437,7 +437,7 @@ export class BotWeaponGenerator {
* @param inventory bot inventory to add grenades to
*/
protected addUbglGrenadesToBotInventory(
weaponMods: Item[],
weaponMods: IItem[],
generatedWeaponResult: GenerateWeaponResult,
inventory: PmcInventory,
): void {
@ -446,7 +446,7 @@ export class BotWeaponGenerator {
const ubglDbTemplate = this.itemHelper.getItem(ubglMod._tpl)[1];
// Define min/max of how many grenades bot will have
const ubglMinMax: GenerationData = {
const ubglMinMax: IGenerationData = {
weights: { 1: 1, 2: 1 },
whitelist: {},
};
@ -503,7 +503,7 @@ export class BotWeaponGenerator {
* @returns magazine tpl string
*/
protected getMagazineTplFromWeaponTemplate(
weaponMods: Item[],
weaponMods: IItem[],
weaponTemplate: ITemplateItem,
botRole: string,
): string {
@ -643,7 +643,7 @@ export class BotWeaponGenerator {
* @param magazine Magazine item
* @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];
if (!magazineTemplate) {
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 ubglAmmoTpl Grenade ammo tpl
*/
protected fillUbgl(weaponMods: Item[], ubglMod: Item, ubglAmmoTpl: string): void {
protected fillUbgl(weaponMods: IItem[], ubglMod: IItem, ubglAmmoTpl: string): void {
weaponMods.push({
_id: this.hashUtil.generate(),
_tpl: ubglAmmoTpl,
@ -688,8 +688,8 @@ export class BotWeaponGenerator {
* @param magazineTemplate magazines db template
*/
protected addOrUpdateMagazinesChildWithAmmo(
weaponWithMods: Item[],
magazine: Item,
weaponWithMods: IItem[],
magazine: IItem,
chosenAmmoTpl: string,
magazineTemplate: ITemplateItem,
): void {
@ -717,7 +717,7 @@ export class BotWeaponGenerator {
* @param magazineId magazine id to find and add to
* @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".
// 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

View File

@ -1,7 +1,7 @@
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
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 { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import { BaseClasses } from "@spt/models/enums/BaseClasses";
@ -83,7 +83,7 @@ export class FenceBaseAssortGenerator {
}
// Create item object in array
const itemWithChildrenToAdd: Item[] = [
const itemWithChildrenToAdd: IItem[] = [
{
_id: this.hashUtil.generate(),
_tpl: rootItemDb._id,
@ -139,7 +139,7 @@ export class FenceBaseAssortGenerator {
}
// 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
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 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
const hasMods = itemDbDetails._props.Slots.length > 0;
if (!hasMods) {
@ -249,7 +249,7 @@ export class FenceBaseAssortGenerator {
continue;
}
const mod: Item = {
const mod: IItem = {
_id: this.hashUtil.generate(),
_tpl: plateTpl,
parentId: armor[0]._id,

View File

@ -11,7 +11,7 @@ import {
} from "@spt/models/eft/common/ILocation";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
@ -28,7 +28,7 @@ import { ICloner } from "@spt/utils/cloners/ICloner";
import { inject, injectable } from "tsyringe";
export interface IContainerItem {
items: Item[];
items: IItem[];
width: number;
height: number;
}
@ -835,7 +835,7 @@ export class LocationLootGenerator {
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
// 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
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)) {
// 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);
itemWithMods.push(...ammoBoxItem);
} else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.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)) {
// Add randomised amount of cartridges
@ -896,7 +896,7 @@ export class LocationLootGenerator {
* @param chosenTpl Tpl we want to get item with
* @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)) {
return items.find((v) => v._tpl === chosenTpl && v.parentId === undefined);
}
@ -913,7 +913,7 @@ export class LocationLootGenerator {
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
let width = itemTemplate._props.Width;
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];
// Use passed in parentId as override for new item
@ -935,7 +935,7 @@ export class LocationLootGenerator {
}
// No spawn point, use default template
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.WEAPON)) {
let children: Item[] = [];
let children: IItem[] = [];
const defaultPreset = this.cloner.clone(this.presetHelper.getDefaultPreset(chosenTpl));
if (defaultPreset?._items) {
try {
@ -1039,7 +1039,7 @@ export class LocationLootGenerator {
} else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) {
const defaultPreset = this.presetHelper.getDefaultPreset(chosenTpl);
if (defaultPreset) {
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods);
// 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 { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
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 { BaseClasses } from "@spt/models/enums/BaseClasses";
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
* @returns An array of loot items
*/
public createRandomLoot(options: LootRequest): Item[] {
const result: Item[] = [];
public createRandomLoot(options: LootRequest): IItem[] {
const result: IItem[] = [];
const itemTypeCounts = this.initItemLimitCounter(options.itemLimits);
// Handle sealed weapon containers
@ -233,7 +233,7 @@ export class LootGenerator {
items: [string, ITemplateItem][],
itemTypeCounts: Record<string, { current: number; max: number }>,
options: LootRequest,
result: Item[],
result: IItem[],
): boolean {
const randomItem = this.randomUtil.getArrayValue(items)[1];
@ -247,7 +247,7 @@ export class LootGenerator {
return false;
}
const newLootItem: Item = {
const newLootItem: IItem = {
_id: this.hashUtil.generate(),
_tpl: randomItem._id,
upd: {
@ -303,7 +303,7 @@ export class LootGenerator {
presetPool: IPreset[],
itemTypeCounts: Record<string, { current: number; max: number }>,
itemBlacklist: string[],
result: Item[],
result: IItem[],
): boolean {
// Choose random preset and get details from item db using encyclopedia value (encyclopedia === tplId)
const chosenPreset = this.randomUtil.getArrayValue(presetPool);
@ -346,7 +346,7 @@ export class LootGenerator {
return false;
}
const presetAndMods: Item[] = this.itemHelper.replaceIDs(chosenPreset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(chosenPreset._items);
this.itemHelper.remapRootItemId(presetAndMods);
// Add chosen preset tpl to result array
presetAndMods.forEach((item) => {
@ -367,8 +367,8 @@ export class LootGenerator {
* @param containerSettings sealed weapon container settings
* @returns Array of item with children arrays
*/
public getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][] {
const itemsToReturn: Item[][] = [];
public getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): IItem[][] {
const itemsToReturn: IItem[][] = [];
// Choose a weapon to give to the player (weighted)
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
const presetAndMods: Item[] = this.itemHelper.replaceIDs(chosenWeaponPreset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(chosenWeaponPreset._items);
this.itemHelper.remapRootItemId(presetAndMods);
// Add preset to return object
@ -426,8 +426,8 @@ export class LootGenerator {
protected getSealedContainerNonWeaponModRewards(
containerSettings: ISealedAirdropContainerSettings,
weaponDetailsDb: ITemplateItem,
): Item[][] {
const rewards: Item[][] = [];
): IItem[][] {
const rewards: IItem[][] = [];
for (const rewardTypeId in containerSettings.rewardTypeLimits) {
const settings = containerSettings.rewardTypeLimits[rewardTypeId];
@ -456,7 +456,7 @@ export class LootGenerator {
for (let index = 0; index < rewardCount; index++) {
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);
rewards.push(ammoBoxItem);
}
@ -483,7 +483,7 @@ export class LootGenerator {
for (let index = 0; index < rewardCount; index++) {
// Choose a random item from pool
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);
}
@ -503,8 +503,8 @@ export class LootGenerator {
containerSettings: ISealedAirdropContainerSettings,
linkedItemsToWeapon: ITemplateItem[],
chosenWeaponPreset: IPreset,
): Item[][] {
const modRewards: Item[][] = [];
): IItem[][] {
const modRewards: IItem[][] = [];
for (const rewardTypeId in containerSettings.weaponModRewardLimits) {
const settings = containerSettings.weaponModRewardLimits[rewardTypeId];
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
for (let index = 0; index < rewardCount; index++) {
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);
}
@ -542,8 +542,8 @@ export class LootGenerator {
* @param rewardContainerDetails
* @returns Array of item with children arrays
*/
public getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][] {
const itemsToReturn: Item[][] = [];
public getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): IItem[][] {
const itemsToReturn: IItem[][] = [];
// Get random items and add to newItemRequest
for (let index = 0; index < rewardContainerDetails.rewardCount; index++) {
@ -554,7 +554,7 @@ export class LootGenerator {
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
const presetAndMods: Item[] = this.itemHelper.replaceIDs(preset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(preset._items);
this.itemHelper.remapRootItemId(presetAndMods);
itemsToReturn.push(presetAndMods);
@ -562,7 +562,7 @@ export class LootGenerator {
continue;
}
const rewardItem: Item[] = [{ _id: this.hashUtil.generate(), _tpl: chosenRewardItemTpl }];
const rewardItem: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: chosenRewardItemTpl }];
itemsToReturn.push(rewardItem);
}

View File

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

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper";
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
@ -13,7 +13,7 @@ import { inject, injectable } from "tsyringe";
@injectable()
export class RagfairAssortGenerator {
protected generatedAssortItems: Item[][] = [];
protected generatedAssortItems: IItem[][] = [];
protected ragfairConfig: IRagfairConfig;
protected ragfairItemInvalidBaseTypes: string[] = [
@ -42,7 +42,7 @@ export class RagfairAssortGenerator {
* Each sub array contains item + children (if any)
* @returns array of arrays
*/
public getAssortItems(): Item[][] {
public getAssortItems(): IItem[][] {
if (!this.assortsAreGenerated()) {
this.generatedAssortItems = this.generateRagfairAssortItems();
}
@ -62,8 +62,8 @@ export class RagfairAssortGenerator {
* Generate an array of arrays (item + children) the flea can sell
* @returns array of arrays (item + children)
*/
protected generateRagfairAssortItems(): Item[][] {
const results: Item[][] = [];
protected generateRagfairAssortItems(): IItem[][] {
const results: IItem[][] = [];
/** Get cloned items from db */
const dbItemsClone = this.itemHelper.getItems().filter((item) => item._type !== "Node");
@ -76,7 +76,7 @@ export class RagfairAssortGenerator {
const presets = this.getPresetsToAdd();
for (const preset of presets) {
// Update Ids and clone
const presetAndMods: Item[] = this.itemHelper.replaceIDs(preset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(preset._items);
this.itemHelper.remapRootItemId(presetAndMods);
// 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
* @returns Hydrated Item object
*/
protected createRagfairAssortRootItem(tplId: string, id = this.hashUtil.generate()): Item {
protected createRagfairAssortRootItem(tplId: string, id = this.hashUtil.generate()): IItem {
return {
_id: id,
_tpl: tplId,

View File

@ -6,7 +6,7 @@ import { PaymentHelper } from "@spt/helpers/PaymentHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
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 { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import { IRagfairOffer, IRagfairOfferUser, OfferRequirement } from "@spt/models/eft/ragfair/IRagfairOffer";
@ -80,7 +80,7 @@ export class RagfairOfferGenerator {
public createAndAddFleaOffer(
userID: string,
time: number,
items: Item[],
items: IItem[],
barterScheme: IBarterScheme[],
loyalLevel: number,
sellInOnePiece = false,
@ -104,7 +104,7 @@ export class RagfairOfferGenerator {
protected createOffer(
userID: string,
time: number,
items: Item[],
items: IItem[],
barterScheme: IBarterScheme[],
loyalLevel: number,
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
* @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);
// get assort items from param if they exist, otherwise grab freshly generated assorts
const assortItemsToProcess: Item[][] = replacingExpiredOffers
const assortItemsToProcess: IItem[][] = replacingExpiredOffers
? expiredOffers
: this.ragfairAssortGenerator.getAssortItems();
@ -359,7 +359,7 @@ export class RagfairOfferGenerator {
* @param config Ragfair dynamic config
*/
protected async createOffersFromAssort(
assortItemWithChildren: Item[],
assortItemWithChildren: IItem[],
isExpiredOffer: boolean,
config: Dynamic,
): Promise<void> {
@ -406,7 +406,7 @@ export class RagfairOfferGenerator {
* @returns True if plate removed
*/
protected removeBannedPlatesFromPreset(
presetWithChildren: Item[],
presetWithChildren: IItem[],
plateSettings: IArmorPlateBlacklistSettings,
): boolean {
if (!this.itemHelper.armorItemCanHoldMods(presetWithChildren[0]._tpl)) {
@ -447,7 +447,7 @@ export class RagfairOfferGenerator {
* @returns Item array
*/
protected async createSingleOfferForItem(
itemWithChildren: Item[],
itemWithChildren: IItem[],
isPreset: boolean,
itemDetails: [boolean, ITemplateItem],
): Promise<void> {
@ -562,7 +562,7 @@ export class RagfairOfferGenerator {
}
const isPreset = this.presetHelper.isPreset(item._id);
const items: Item[] = isPreset
const items: IItem[] = isPreset
? this.ragfairServerHelper.getPresetItems(item)
: [...[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 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
this.addMissingConditions(itemWithMods[0]);
@ -638,7 +638,7 @@ export class RagfairOfferGenerator {
*/
protected randomiseItemCondition(
conditionSettingsId: string,
itemWithMods: Item[],
itemWithMods: IItem[],
itemDetails: ITemplateItem,
): void {
const rootItem = itemWithMods[0];
@ -721,7 +721,7 @@ export class RagfairOfferGenerator {
* @param currentMultiplier Value to multiply current durability by
*/
protected randomiseWeaponDurability(
item: Item,
item: IItem,
itemDbDetails: ITemplateItem,
maxMultiplier: number,
currentMultiplier: number,
@ -748,7 +748,7 @@ export class RagfairOfferGenerator {
* @param maxMultiplier Chosen multipler to use for max durability value
*/
protected randomiseArmorDurabilityValues(
armorWithMods: Item[],
armorWithMods: IItem[],
currentMultiplier: number,
maxMultiplier: number,
): void {
@ -782,7 +782,7 @@ export class RagfairOfferGenerator {
* HpResource for medical items
* @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 isRepairable = "Durability" in props;
const isMedkit = "MaxHpResource" in props;
@ -825,7 +825,7 @@ export class RagfairOfferGenerator {
* @param offerItems Items for sale in offer
* @returns Barter scheme
*/
protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[] {
protected createBarterBarterScheme(offerItems: IItem[]): IBarterScheme[] {
// get flea price of item being sold
const priceOfItemOffer = this.ragfairPriceService.getDynamicOfferPriceForOffer(
offerItems,
@ -902,7 +902,7 @@ export class RagfairOfferGenerator {
* @returns Barter scheme for offer
*/
protected createCurrencyBarterScheme(
offerWithChildren: Item[],
offerWithChildren: IItem[],
isPackOffer: boolean,
multipler = 1,
): IBarterScheme[] {

View File

@ -1,7 +1,7 @@
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
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 { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses";
@ -513,7 +513,7 @@ export class RepeatableQuestRewardGenerator {
* @param preset Optional array of preset items
* @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 questRewardItem: IQuestReward = {
target: id,

View File

@ -1,6 +1,6 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
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 { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
import { BaseClasses } from "@spt/models/enums/BaseClasses";
@ -50,7 +50,7 @@ export class ScavCaseRewardGenerator {
* @param recipeId recipe of the scav case craft
* @returns Product array
*/
public generate(recipeId: string): Item[][] {
public generate(recipeId: string): IItem[][] {
this.cacheDbItems();
// Get scavcase details from hideout/scavcase.json
@ -286,11 +286,11 @@ export class ScavCaseRewardGenerator {
* @param rewardItems items to convert
* @returns Product array
*/
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][] {
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): IItem[][] {
/** Each array is an item + children */
const result: Item[][] = [];
const result: IItem[][] = [];
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];
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
const presetAndMods: Item[] = this.itemHelper.replaceIDs(preset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(preset._items);
this.itemHelper.remapRootItemId(presetAndMods);
resultItem = presetAndMods;

View File

@ -1,17 +1,17 @@
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";
export class InventoryMagGen {
constructor(
private magCounts: GenerationData,
private magCounts: IGenerationData,
private magazineTemplate: ITemplateItem,
private weaponTemplate: ITemplateItem,
private ammoTemplate: ITemplateItem,
private pmcInventory: IInventory,
) {}
public getMagCount(): GenerationData {
public getMagCount(): IGenerationData {
return this.magCounts;
}

View File

@ -1,5 +1,5 @@
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 { IBots } from "@spt/models/spt/bots/IBots";
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
@ -34,7 +34,7 @@ export class BotDifficultyHelper {
* @param botDb bots from database
* @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 bot = botDb.types[desiredType];
if (!bot) {
@ -67,7 +67,7 @@ export class BotDifficultyHelper {
* @param difficulty what difficulty to retrieve
* @returns Difficulty object
*/
protected getDifficultySettings(type: string, difficulty: string): Difficulty {
protected getDifficultySettings(type: string, difficulty: string): IDifficultyCategories {
let difficultySetting =
this.pmcConfig.difficulty.toLowerCase() === "asonline"
? difficulty

View File

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

View File

@ -1,5 +1,5 @@
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 { EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt/models/spt/config/IBotConfig";
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
@ -55,7 +55,7 @@ export class BotHelper {
* @param difficultySettings bot settings to alter
* @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";
// Null guard
@ -71,7 +71,7 @@ export class BotHelper {
* @param difficultySettings bot settings to alter
* @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";
// Nothing to add

View File

@ -2,8 +2,8 @@ import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IInventory } from "@spt/models/eft/common/tables/IBotBase";
import { GenerationData } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem";
import { IGenerationData } from "@spt/models/eft/common/tables/IBotType";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BaseClasses } from "@spt/models/enums/BaseClasses";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -34,7 +34,7 @@ export class BotWeaponGeneratorHelper {
* @param magTemplate magazine to generate bullet count for
* @returns bullet count number
*/
public getRandomizedBulletCount(magCounts: GenerationData, magTemplate: ITemplateItem): number {
public getRandomizedBulletCount(magCounts: IGenerationData, magTemplate: ITemplateItem): number {
const randomizedMagazineCount = this.getRandomizedMagazineCount(magCounts);
const parentItem = this.itemHelper.getItem(magTemplate._parent)[1];
let chamberBulletCount = 0;
@ -62,7 +62,7 @@ export class BotWeaponGeneratorHelper {
* @param magCounts min and max value returned value can be between
* @returns numerical value of magazine count
*/
public getRandomizedMagazineCount(magCounts: GenerationData): number {
public getRandomizedMagazineCount(magCounts: IGenerationData): number {
// const range = magCounts.max - magCounts.min;
// 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
* @returns Item array
*/
public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[] {
const magazine: Item[] = [{ _id: this.hashUtil.generate(), _tpl: magazineTpl }];
public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): IItem[] {
const magazine: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: magazineTpl }];
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 { ItemHelper } from "@spt/helpers/ItemHelper";
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 { ISendMessageRequest } from "@spt/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile";
@ -192,7 +192,7 @@ export class GiveSptCommand implements ISptCommand {
return request.dialogId;
}
const itemsToSend: Item[] = [];
const itemsToSend: IItem[] = [];
const preset = this.presetHelper.getDefaultPreset(checkedItem[1]._id);
if (preset && !GiveSptCommand.excludedPresetItems.has(checkedItem[1]._id)) {
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)) {
for (let i = 0; i < quantity; i++) {
const ammoBoxArray: Item[] = [];
const ammoBoxArray: IItem[] = [];
ammoBoxArray.push({ _id: this.hashUtil.generate(), _tpl: checkedItem[1]._id });
// DO NOT generate the ammo box cartridges, the mail service does it for us! :)
// this.itemHelper.addCartridgesToAmmoBox(ammoBoxArray, checkedItem[1]);
@ -218,7 +218,7 @@ export class GiveSptCommand implements ISptCommand {
});
}
} else {
const item: Item = {
const item: IItem = {
_id: this.hashUtil.generate(),
_tpl: checkedItem[1]._id,
upd: this.itemHelper.generateUpdForItem(checkedItem[1]),

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper";
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 { ILogger } from "@spt/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt/servers/DatabaseServer";
@ -56,7 +56,7 @@ export class DialogueHelper {
* @param itemId Item being moved to inventory
* @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;
for (const dialogueId in dialogueData) {
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 { 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 { Money } from "@spt/models/enums/Money";
import { IItemConfig } from "@spt/models/spt/config/IItemConfig";
@ -110,7 +110,7 @@ export class HandbookHelper {
return handbookItem.Price;
}
public getTemplatePriceForItems(items: Item[]): number {
public getTemplatePriceForItems(items: IItem[]): number {
let total = 0;
for (const item of items) {
total += this.getTemplatePrice(item._tpl);

View File

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

View File

@ -2,7 +2,7 @@ import { QuestController } from "@spt/controllers/QuestController";
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
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 { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig";
import { ILostOnDeathConfig } from "@spt/models/spt/config/ILostOnDeathConfig";
@ -177,7 +177,7 @@ export class InRaidHelper {
* @param pmcProfile Profile to get items from
* @returns Array of items lost on death
*/
protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): Item[] {
protected getInventoryItemsLostOnDeath(pmcProfile: IPmcData): IItem[] {
const inventoryItems = pmcProfile.Inventory.items ?? [];
const equipmentRootId = pmcProfile?.Inventory?.equipment;
const questRaidItemContainerId = pmcProfile?.Inventory?.questRaidItems;
@ -208,7 +208,7 @@ export class InRaidHelper {
* @itemToCheck Item to check should be kept
* @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.
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 { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { IAddItemsDirectRequest } from "@spt/models/eft/inventory/IAddItemsDirectRequest";
import { IInventoryMergeRequestData } from "@spt/models/eft/inventory/IInventoryMergeRequestData";
@ -172,7 +172,7 @@ export class InventoryHelper {
* @param itemWithChildren An item
* @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) {
// Ensure item has upd object
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
* @param upd Object to update
*/
protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void {
protected removeTraderRagfairRelatedUpdProperties(upd: IUpd): void {
if (upd.UnlimitedCount !== undefined) {
delete upd.UnlimitedCount;
}
@ -209,7 +209,7 @@ export class InventoryHelper {
* @param itemsWithChildren array of items with children to try and 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 stashFS2D = this.cloner.clone(this.getStashSlotMap(pmcData, sessionId));
@ -233,7 +233,7 @@ export class InventoryHelper {
* @param itemsWithChildren items to try and fit into grid
* @returns True all fit
*/
public canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean {
public canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: IItem[][]): boolean {
for (const itemWithChildren of itemsWithChildren) {
if (!this.canPlaceItemInContainer(containerFS2D, itemWithChildren)) {
return false;
@ -249,7 +249,7 @@ export class InventoryHelper {
* @param itemWithChildren item to check 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
const rootItem = itemWithChildren[0];
const itemSize = this.getItemSize(rootItem._tpl, rootItem._id, itemWithChildren);
@ -291,7 +291,7 @@ export class InventoryHelper {
*/
public placeItemInContainer(
containerFS2D: number[][],
itemWithChildren: Item[],
itemWithChildren: IItem[],
containerId: string,
desiredSlotId = "hideout",
): void {
@ -344,7 +344,7 @@ export class InventoryHelper {
protected placeItemInInventory(
stashFS2D: number[][],
sortingTableFS2D: number[][],
itemWithChildren: Item[],
itemWithChildren: IItem[],
playerInventory: IInventory,
useSortingTable: boolean,
output: IItemEventRouterResponse,
@ -582,7 +582,7 @@ export class InventoryHelper {
* @param inventoryItems
* @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]
return this.getSizeByInventoryItemHash(itemTpl, itemID, this.getInventoryItemHash(inventoryItems));
}
@ -734,7 +734,7 @@ export class InventoryHelper {
* @param containerId Id of the 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
const container2D = this.getBlankContainerMap(containerH, containerV);
@ -751,7 +751,7 @@ export class InventoryHelper {
// Check each item in container
for (const item of containerItemHash) {
const itemLocation = item?.location as Location;
const itemLocation = item?.location as IItemLocation;
if (!itemLocation) {
// item has no location property
this.logger.error(`Unable to find 'location' property on item with id: ${item._id}, skipping`);
@ -787,11 +787,11 @@ export class InventoryHelper {
return container2D;
}
protected isVertical(itemLocation: Location): boolean {
protected isVertical(itemLocation: IItemLocation): boolean {
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: {} };
for (const item of inventoryItem) {
inventoryItemHash.byItemId[item._id] = item;
@ -960,7 +960,7 @@ export class InventoryHelper {
* @param toItems Inventory of the destination
* @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);
// Get all children item has, they need to move with item
@ -1002,7 +1002,7 @@ export class InventoryHelper {
*/
public moveItemInternal(
pmcData: IPmcData,
inventoryItems: Item[],
inventoryItems: IItem[],
moveRequest: IInventoryMoveRequestData,
): { success: boolean; errorMessage?: string } {
this.handleCartridges(inventoryItems, moveRequest);
@ -1057,7 +1057,7 @@ export class InventoryHelper {
* @param pmcData Player profile
* @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
const fastPanelSlot = Object.entries(pmcData.Inventory.fastPanel).find(
([itemId]) => itemId === itemBeingMoved._id,
@ -1084,7 +1084,7 @@ export class InventoryHelper {
/**
* 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
if (request.to.container !== "cartridges") {
return;
@ -1117,7 +1117,7 @@ export class InventoryHelper {
* @param itemToCheck Item to look for
* @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
const isParentInStash = (itemId: string): boolean => {
// Item not found / has no parent
@ -1139,7 +1139,7 @@ export class InventoryHelper {
return isParentInStash(itemToCheck._id);
}
public validateInventoryUsesMonogoIds(itemsToValidate: Item[]) {
public validateInventoryUsesMonogoIds(itemsToValidate: IItem[]) {
for (const item of itemsToValidate) {
if (!this.hashUtil.isValidMongoId(item._id)) {
throw new Error(
@ -1152,7 +1152,7 @@ export class InventoryHelper {
namespace InventoryHelper {
export interface InventoryItemHash {
byItemId: Record<string, Item>;
byParentId: Record<string, Item[]>;
byItemId: Record<string, IItem>;
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 { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { BaseClasses } from "@spt/models/enums/BaseClasses";
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
@ -59,7 +59,7 @@ export class ItemHelper {
* @param slotId OPTIONAL - slotid of desired 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
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
* @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
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
* @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) {
return false;
}
@ -114,7 +114,7 @@ export class ItemHelper {
* @param compareUpdProperties Upd properties to compare between the items
* @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) {
return false;
}
@ -133,8 +133,8 @@ export class ItemHelper {
* @param itemTemplate the item template to generate a Upd for
* @returns A Upd with all the default properties set
*/
public generateUpdForItem(itemTemplate: ITemplateItem): Upd {
const itemProperties: Upd = {};
public generateUpdForItem(itemTemplate: ITemplateItem): IUpd {
const itemProperties: IUpd = {};
// armors, etc
if (itemTemplate._props.MaxDurability) {
@ -402,7 +402,7 @@ export class ItemHelper {
* @param item Item to update
* @returns Fixed item
*/
public fixItemStackCount(item: Item): Item {
public fixItemStackCount(item: IItem): IItem {
if (item.upd === undefined) {
item.upd = { StackObjectsCount: 1 };
}
@ -451,7 +451,7 @@ export class ItemHelper {
* @param skipArmorItemsWithoutDurability Skip over armor items without durability
* @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)) {
return this.getItemQualityModifier(items[0]);
}
@ -483,7 +483,7 @@ export class ItemHelper {
* @param skipArmorItemsWithoutDurability return -1 for armor items that have maxdurability of 0
* @returns Number between 0 and 1
*/
public getItemQualityModifier(item: Item, skipArmorItemsWithoutDurability?: boolean): number {
public getItemQualityModifier(item: IItem, skipArmorItemsWithoutDurability?: boolean): number {
// Default to 100%
let result = 1;
@ -543,7 +543,11 @@ export class ItemHelper {
* @param item Item quality value is for
* @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
if (repairable.Durability > repairable.MaxDurability) {
this.logger.warning(
@ -573,7 +577,7 @@ export class ItemHelper {
* @param baseItemId Parent items id
* @returns an array of strings
*/
public findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[] {
public findAndReturnChildrenByItems(items: IItem[], baseItemId: string): string[] {
const list: string[] = [];
for (const childitem of items) {
@ -594,8 +598,8 @@ export class ItemHelper {
* @param modsOnly Include only mod items, exclude items stored inside root item
* @returns An array of Item objects
*/
public findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly = false): Item[] {
const list: Item[] = [];
public findAndReturnChildrenAsItems(items: IItem[], baseItemId: string, modsOnly = false): IItem[] {
const list: IItem[] = [];
for (const childItem of items) {
// Include itself
if (childItem._id === baseItemId) {
@ -623,8 +627,8 @@ export class ItemHelper {
* @param assort Array of items to check in
* @returns Array of children of requested item
*/
public findAndReturnChildrenByAssort(itemIdToFind: string, assort: Item[]): Item[] {
let list: Item[] = [];
public findAndReturnChildrenByAssort(itemIdToFind: string, assort: IItem[]): IItem[] {
let list: IItem[] = [];
for (const itemFromAssort of assort) {
if (itemFromAssort.parentId === itemIdToFind && !list.some((item) => itemFromAssort._id === item._id)) {
@ -641,7 +645,7 @@ export class ItemHelper {
* @param itemToCheck Item to check
* @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) {
return true;
}
@ -672,12 +676,12 @@ export class ItemHelper {
* @param item
* @returns "slotId OR slotid,locationX,locationY"
*/
public getChildId(item: Item): string {
public getChildId(item: IItem): string {
if (!("location" in item)) {
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
* @returns Array of root item + children
*/
public splitStack(itemToSplit: Item): Item[] {
public splitStack(itemToSplit: IItem): IItem[] {
if (itemToSplit?.upd?.StackObjectsCount === undefined) {
return [itemToSplit];
}
const maxStackSize = this.getItem(itemToSplit._tpl)[1]._props.StackMaxSize;
let remainingCount = itemToSplit.upd.StackObjectsCount;
const rootAndChildren: Item[] = [];
const rootAndChildren: IItem[] = [];
// If the current count is already equal or less than the max
// return the item as is.
@ -734,7 +738,7 @@ export class ItemHelper {
* @param itemToSplit Item to split into smaller stacks
* @returns
*/
public splitStackIntoSeparateItems(itemToSplit: Item): Item[][] {
public splitStackIntoSeparateItems(itemToSplit: IItem): IItem[][] {
const itemTemplate = this.getItem(itemToSplit._tpl)[1];
const itemMaxStackSize = itemTemplate._props.StackMaxSize ?? 1;
@ -744,7 +748,7 @@ export class ItemHelper {
}
// Split items stack into chunks
const result: Item[][] = [];
const result: IItem[][] = [];
let remainingCount = itemToSplit.upd.StackObjectsCount;
while (remainingCount) {
const amount = Math.min(remainingCount, itemMaxStackSize);
@ -762,16 +766,16 @@ export class ItemHelper {
/**
* Find Barter items from array of items
* @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
* @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)
const desiredBarterIds =
typeof desiredBarterItemIds === "string" ? [desiredBarterItemIds] : desiredBarterItemIds;
const matchingItems: Item[] = [];
const matchingItems: IItem[] = [];
for (const barterId of desiredBarterIds) {
const filterResult = itemsToSearch.filter((item) => {
return by === "tpl" ? item._tpl === barterId : item._id === barterId;
@ -793,7 +797,7 @@ export class ItemHelper {
* @param itemWithChildren Item with mods to update
* @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
const oldId = itemWithChildren[0]._id;
@ -819,11 +823,11 @@ export class ItemHelper {
* @returns Item[]
*/
public replaceIDs(
originalItems: Item[],
originalItems: IItem[],
pmcData?: IPmcData,
insuredItems?: IInsuredItem[],
fastPanel?: any,
): Item[] {
): IItem[] {
let items = this.cloner.clone(originalItems); // Deep-clone the items to avoid mutation.
let serialisedInventory = this.jsonUtil.serialize(items);
const hideoutAreaStashes = Object.values(pmcData?.Inventory.hideoutAreaStashes ?? {});
@ -867,7 +871,7 @@ export class ItemHelper {
// fix duplicate id's
const dupes: Record<string, number> = {};
const newParents: Record<string, Item[]> = {};
const newParents: Record<string, IItem[]> = {};
const childrenMapping = {};
const oldToNewIds: Record<string, string[]> = {};
@ -925,7 +929,7 @@ export class ItemHelper {
* Modifies passed in items
* @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) {
if (!item.upd) {
item.upd = {};
@ -995,7 +999,7 @@ export class ItemHelper {
* @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.
*/
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.
if (!item.slotId) {
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.
* @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);
while (currentItem && this.isAttachmentAttached(currentItem)) {
currentItem = itemsMap.get(currentItem.parentId);
@ -1054,7 +1058,7 @@ export class ItemHelper {
* @param item The item to check.
* @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);
return !(
@ -1079,7 +1083,7 @@ export class ItemHelper {
* @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.
*/
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);
const equipmentSlots = Object.values(EquipmentSlots).map((value) => value as string);
@ -1098,7 +1102,7 @@ export class ItemHelper {
* @param rootItemId
* @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 width = rootTemplate._props.Width;
const height = rootTemplate._props.Height;
@ -1159,7 +1163,7 @@ export class ItemHelper {
* @param ammoBox Box to add cartridges to
* @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 cartridgeTpl = ammoBoxDetails._props.StackSlots[0]._props.filters[0].Filter[0];
const cartridgeDetails = this.getItem(cartridgeTpl);
@ -1206,7 +1210,7 @@ export class ItemHelper {
* @param ammoBox Box to add cartridges to
* @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 cartridgeTpl = ammoBoxDetails._props.StackSlots[0]._props.filters[0].Filter[0];
ammoBox.push(
@ -1227,7 +1231,7 @@ export class ItemHelper {
* @param items Inventory with child parent items to check
* @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
const parent = items.find((item) => item._id === itemToCheck.parentId);
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)
*/
public fillMagazineWithRandomCartridge(
magazine: Item[],
magazine: IItem[],
magTemplate: ITemplateItem,
staticAmmoDist: Record<string, IStaticAmmoDetails[]>,
caliber?: string,
@ -1294,7 +1298,7 @@ export class ItemHelper {
* @param minSizeMultiplier % the magazine must be filled to
*/
public fillMagazineWithCartridge(
magazineWithChildCartridges: Item[],
magazineWithChildCartridges: IItem[],
magTemplate: ITemplateItem,
cartridgeTpl: string,
minSizeMultiplier = 0.25,
@ -1450,7 +1454,7 @@ export class ItemHelper {
stackCount: number,
location: number,
foundInRaid = false,
): Item {
): IItem {
return {
_id: this.objectId.generate(),
_tpl: ammoTpl,
@ -1466,7 +1470,7 @@ export class ItemHelper {
* @param item Item to get stack size of
* @returns size of stack
*/
public getItemStackSize(item: Item): number {
public getItemStackSize(item: IItem): number {
if (item.upd?.StackObjectsCount) {
return item.upd.StackObjectsCount;
}
@ -1509,11 +1513,11 @@ export class ItemHelper {
* @returns Item with children
*/
public addChildSlotItems(
itemToAdd: Item[],
itemToAdd: IItem[],
itemToAddTemplate: ITemplateItem,
modSpawnChanceDict?: Record<string, number>,
requiredOnly = false,
): Item[] {
): IItem[] {
const result = itemToAdd;
const incompatibleModTpls: Set<string> = new Set();
for (const slot of itemToAddTemplate._props.Slots) {
@ -1625,7 +1629,7 @@ export class ItemHelper {
* @param itemWithChildren Primary item + children of primary item
* @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 idMappings = {};
@ -1664,7 +1668,7 @@ export class ItemHelper {
* @param newId Optional: new id to use
* @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;
for (const item of itemWithChildren) {
@ -1693,7 +1697,7 @@ export class ItemHelper {
* @param items Array of Items that should be adjusted.
* @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) {
// Check if the item's parent exists.
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.
* @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> {
const itemsMap = new Map<string, Item>();
public generateItemsMap(items: IItem[]): Map<string, IItem> {
const itemsMap = new Map<string, IItem>();
for (const item of items) {
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
* @returns True when upd object was added
*/
public addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean {
public addUpdObjectToItem(item: IItem, warningMessageWhenMissing?: string): boolean {
if (!item.upd) {
item.upd = {};
@ -1769,7 +1773,7 @@ export class ItemHelper {
}
namespace ItemHelper {
export interface ItemSize {
export interface IItemSize {
width: number;
height: number;
}

View File

@ -8,7 +8,7 @@ import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
@ -242,11 +242,11 @@ export class QuestHelper {
* @param questReward Reward item to fix
* @returns Fixed rewards
*/
protected processReward(questReward: IQuestReward): Item[] {
protected processReward(questReward: IQuestReward): IItem[] {
/** item with mods to return */
let rewardItems: Item[] = [];
let targets: Item[] = [];
const mods: Item[] = [];
let rewardItems: IItem[] = [];
let targets: IItem[] = [];
const mods: IItem[] = [];
// Is armor item that may need inserts / plates
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 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
const defaultPreset = this.presetHelper.getDefaultPreset(originalRewardRootItem._tpl);
if (defaultPreset) {
// 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);
questReward.items = presetAndMods;
@ -353,7 +353,7 @@ export class QuestHelper {
* @param status Quest status that holds the items (Started, Success, Fail)
* @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
const questRewards = quest.rewards[QuestStatus[status]].flatMap((reward: IQuestReward) =>
reward.type === "Item" ? this.processReward(reward) : [],
@ -645,7 +645,7 @@ export class QuestHelper {
protected addItemStackSizeChangeIntoEventResponse(
output: IItemEventRouterResponse,
sessionId: string,
item: Item,
item: IItem,
): void {
output.profileChanges[sessionId].items.change.push({
_id: item._id,
@ -862,7 +862,7 @@ export class QuestHelper {
state: QuestStatus,
sessionId: string,
questResponse: IItemEventRouterResponse,
): Item[] {
): IItem[] {
// Repeatable quest base data is always in PMCProfile, `profileData` may be scav profile
// TODO: consider moving repeatable quest data to profile-agnostic location
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 { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper";
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 { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -130,7 +130,7 @@ export class RagfairHelper {
* Iterate over array of identical items and merge stack count
* Ragfair allows abnormally large stacks.
*/
public mergeStackable(items: Item[]): Item[] {
public mergeStackable(items: IItem[]): IItem[] {
const list = [];
let rootItem = undefined;

View File

@ -9,7 +9,7 @@ import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { RagfairSortHelper } from "@spt/helpers/RagfairSortHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper";
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 { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { ISptProfile, ISystemData } from "@spt/models/eft/profile/ISptProfile";
@ -334,7 +334,7 @@ export class RagfairOfferHelper {
* @param itemsInInventoryToList items to sum up
* @returns Total count
*/
public getTotalStackCountSize(itemsInInventoryToList: Item[][]): number {
public getTotalStackCountSize(itemsInInventoryToList: IItem[][]): number {
let total = 0;
for (const itemAndChildren of itemsInInventoryToList) {
// 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 {
const itemTpl = offer.items[0]._tpl;
let paymentItemsToSendToPlayer: Item[] = [];
let paymentItemsToSendToPlayer: IItem[] = [];
const offerStackCount = offer.items[0].upd.StackObjectsCount;
// 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
for (const requirement of offer.requirements) {
// Create an item template item
const requestedItem: Item = {
const requestedItem: IItem = {
_id: this.hashUtil.generate(),
_tpl: requirement._tpl,
upd: { StackObjectsCount: requirement.count * boughtAmount },
@ -598,7 +598,7 @@ export class RagfairOfferHelper {
* @param offer The flea offer
* @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
if (!this.presetHelper.hasPreset(offerRootItem._tpl)) {
return true;
@ -712,7 +712,7 @@ export class RagfairOfferHelper {
* @param item Item to check
* @returns True if has condition
*/
protected isConditionItem(item: Item): boolean {
protected isConditionItem(item: IItem): boolean {
// thanks typescript, undefined assertion is not returnable since it
// tries to return a multitype object
return !!(
@ -732,7 +732,7 @@ export class RagfairOfferHelper {
* @param max Desired maximum quality
* @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);
if (min > 0 && min > itemQualityPercentage) {
// 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 { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
@ -63,7 +63,7 @@ export class RagfairSellHelper {
* @param sellInOneGo All items listed get sold at once
* @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();
// Get a time in future to stop simulating sell chances at
@ -73,7 +73,7 @@ export class RagfairSellHelper {
let sellTime = startTime;
let remainingCount = itemSellCount;
const result: SellResult[] = [];
const result: ISellResult[] = [];
// Value can sometimes be NaN for whatever reason, default to base chance if that happens
const effectiveSellChance = Number.isNaN(sellChancePercent)

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
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 { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -135,7 +135,7 @@ export class RagfairServerHelper {
* @param sessionID Player to send items to
* @param returnedItems Items to send to player
*/
public returnItems(sessionID: string, returnedItems: Item[]): void {
public returnItems(sessionID: string, returnedItems: IItem[]): void {
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
this.traderHelper.getTraderById(Traders.RAGMAN),
@ -207,7 +207,7 @@ export class RagfairServerHelper {
* @param item Preset item
* @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);
return this.itemHelper.reparentItemAndChildren(item, preset);
}
@ -217,7 +217,7 @@ export class RagfairServerHelper {
* @param item Preset item
* @returns
*/
public getPresetItemsByTpl(item: Item): Item[] {
public getPresetItemsByTpl(item: IItem): IItem[] {
const presets = [];
for (const itemId in this.databaseService.getGlobals().ItemPresets) {
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IRepairConfig } from "@spt/models/spt/config/IRepairConfig";
@ -34,7 +34,7 @@ export class RepairHelper {
* @param applyMaxDurabilityDegradation should item have max durability reduced
*/
public updateItemDurability(
itemToRepair: Item,
itemToRepair: IItem,
itemToRepairDetails: ITemplateItem,
isArmor: boolean,
amountToRepair: number,

View File

@ -1,10 +1,10 @@
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";
export interface OwnerInventoryItems {
from: Item[];
to: Item[];
export interface IOwnerInventoryItems {
from: IItem[];
to: IItem[];
sameInventory: boolean;
isMail: boolean;
}
@ -18,7 +18,7 @@ export class SecureContainerHelper {
* @param items Inventory items to look for secure container in
* @returns Array of ids
*/
public getSecureContainerItems(items: Item[]): string[] {
public getSecureContainerItems(items: IItem[]): string[] {
const secureContainer = items.find((x) => x.slotId === "SecuredContainer");
// No container found, drop out

View File

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

View File

@ -4,7 +4,7 @@ import { AssortHelper } from "@spt/helpers/AssortHelper";
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { Traders } from "@spt/models/enums/Traders";
@ -141,7 +141,7 @@ export class TraderAssortHelper {
* @param itemsTplsToRemove Item TPLs the assort should not have
*/
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
if (item.parentId === "hideout" && blacklist.includes(item._tpl)) {
// We want it gone
@ -158,7 +158,7 @@ export class TraderAssortHelper {
* Reset every traders root item `BuyRestrictionCurrent` property to 0
* @param assortItems Items to adjust
*/
protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void {
protected resetBuyRestrictionCurrentValue(assortItems: IItem[]): void {
// iterate over root items
for (const assort of assortItems.filter((item) => item.slotId === "hideout")) {
// no value to adjust
@ -246,7 +246,7 @@ export class TraderAssortHelper {
* @param traderId trader id
* @returns array of Items
*/
protected getPristineTraderAssorts(traderId: string): Item[] {
protected getPristineTraderAssorts(traderId: string): IItem[] {
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 { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { ITraderAssort, ITraderBase, ITraderLoyaltyLevel } from "@spt/models/eft/common/tables/ITrader";
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
@ -90,7 +90,7 @@ export class TraderHelper {
* @param assortId Id of assort to find
* @returns Item object
*/
public getTraderAssortItemByAssortId(traderId: string, assortId: string): Item | undefined {
public getTraderAssortItemByAssortId(traderId: string, assortId: string): IItem | undefined {
const traderAssorts = this.getTraderAssortsByTraderId(traderId);
if (!traderAssorts) {
this.logger.debug(`No assorts on trader: ${traderId} found`);
@ -362,7 +362,7 @@ export class TraderHelper {
public addTraderPurchasesToPlayerProfile(
sessionID: string,
newPurchaseDetails: { items: { itemId: string; count: number }[]; traderId: string },
itemPurchased: Item,
itemPurchased: IItem,
): void {
const profile = this.profileHelper.getFullProfile(sessionID);
const traderId = newPurchaseDetails.traderId;

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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 {
time: number;
@ -539,10 +539,10 @@ export interface IKarmaCalculationSettings {
}
export interface IArenaEftTransferSettings {
ArenaEftTransferSettings: ArenaEftTransferSettings;
ArenaEftTransferSettings: IArenaEftTransferSettings;
}
export interface ArenaEftTransferSettings {
export interface IArenaEftTransferSettings {
ArenaManagerReputationTaxMultiplier: number;
CharismaTaxMultiplier: number;
CreditPriceTaxMultiplier: number;
@ -1847,7 +1847,7 @@ export interface IPreset {
_changeWeaponName: boolean;
_name: string;
_parent: string;
_items: Item[];
_items: IItem[];
/** Default presets have this property */
_encyclopedia?: string;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
export interface IMatch {
metrics: Metrics;
metrics: IMetrics;
}
export interface Metrics {
export interface IMetrics {
Keys: number[];
NetProcessingBins: 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 { QuestStatus } from "@spt/models/enums/QuestStatus";
import { QuestTypeEnum } from "@spt/models/enums/QuestTypeEnum";
@ -53,7 +53,7 @@ export interface IQuestCondition {
index?: number;
compareMethod?: string;
dynamicLocale: boolean;
visibilityConditions?: VisibilityCondition[];
visibilityConditions?: IVisibilityCondition[];
globalQuestCounterId?: string;
parentId?: string;
target: string[] | string;
@ -133,7 +133,7 @@ export interface IDaytimeCounter {
to: number;
}
export interface VisibilityCondition {
export interface IVisibilityCondition {
id: string;
target: string;
value?: number;
@ -158,7 +158,7 @@ export interface IQuestReward {
type: QuestRewardType;
index: number;
target?: string;
items?: Item[];
items?: IItem[];
loyaltyLevel?: number;
/** Hideout area id */
traderId?: string;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,12 @@
export interface IHideoutSingleProductionStartRequestData {
Action: "HideoutSingleProductionStart";
recipeId: string;
items: Item[];
tools: Item[];
items: IHandoverItem[];
tools: IHandoverItem[];
timestamp: number;
}
export interface Item {
export interface IHandoverItem {
id: string;
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 {
items: Item[];
items: IItem[];
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 {
/** Item and child mods to add to player inventory */
itemWithModsToAdd: Item[];
itemWithModsToAdd: IItem[];
foundInRaid: boolean;
callback: (buyCount: number) => void;
useSortingTable: boolean;

View File

@ -1,10 +1,10 @@
export interface IAddItemRequestData {
/** Trader id */
tid: string;
items: AddItem[];
items: IItemToAdd[];
}
export interface AddItem {
export interface IItemToAdd {
count: number;
sptIsPreset?: boolean;
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 {
itemRef: Item;
itemRef: IItem;
count: number;
isPreset: boolean;
location?: Location;
location?: IItemLocation;
// Container item will be placed in - stash or sorting table
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 {
/** Item and child mods to add to player inventory */
itemsWithModsToAdd: Item[][];
itemsWithModsToAdd: IItem[][];
foundInRaid: boolean;
/** Runs after EACH item with children is added */
callback?: (buyCount: number) => void;

View File

@ -1,22 +1,15 @@
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 To {
id: string;
container: string;
location?: ToLocation | number; // Hack
location?: IItemLocation | number; // Hack
isSearched?: boolean;
}
export interface ToLocation {
x: number;
y: number;
r: string;
rotation?: string;
isSearched: boolean;
}
export interface Container {
id: 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";
export interface IInventorySortRequestData extends IInventoryBaseActionRequestData {
Action: "ApplyInventoryChanges";
changedItems: ChangedItem[];
}
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;
changedItems: IItem[];
}

View File

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

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";
export interface IGetAirdropLootResponse {
// The type of airdrop
icon: AirdropTypeEnum;
container: Item[];
container: IItem[];
}

View File

@ -1,15 +1,15 @@
import { ExitStatus } from "@spt/models/enums/ExitStatis";
import { IPmcData } from "../common/IPmcData";
import { Item } from "../common/tables/IItem";
import { IItem } from "../common/tables/IItem";
export interface IEndLocalRaidRequestData {
/** ID of server player just left */
serverId: string;
results: IEndRaidResult;
/** Insured items left in raid by player */
lostInsuredItems: Item[];
lostInsuredItems: IItem[];
/** Items sent via traders to player, keyed to service e.g. BTRTransferStash */
transferItems: Record<string, Item[]>;
transferItems: Record<string, IItem[]>;
}
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";
export interface IGroupCharacter {
@ -30,7 +30,7 @@ export interface IGroupCharacter {
};
Equipment: {
Id: string;
Items: Item[];
Items: IItem[];
};
};
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 {
Action: string;
@ -6,5 +6,5 @@ export interface IPresetBuildActionRequestData {
/** name of preset given by player */
Name: string;
Root: string;
Items: Item[];
Items: IItem[];
}

View File

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

View File

@ -1,5 +1,5 @@
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 {
id: string;
@ -9,7 +9,7 @@ export interface IGetOtherProfileResponse {
skills: ISkills;
equipment: IOtherProfileEquipment;
achievements: Record<string, number>;
favoriteItems: Item[];
favoriteItems: IItem[];
pmcStats: IOtherProfileStats;
scavStats: IOtherProfileStats;
}
@ -33,7 +33,7 @@ export interface IOtherProfileCustomization {
export interface IOtherProfileEquipment {
Id: string;
Items: Item[];
Items: IItem[];
}
export interface IOtherProfileStats {

View File

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

View File

@ -2,10 +2,10 @@ export interface IHandoverQuestRequestData {
Action: "QuestHandover";
qid: string;
conditionId: string;
items: Item[];
items: IHandoverItem[];
}
export interface Item {
export interface IHandoverItem {
id: string;
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 { MemberCategory } from "@spt/models/enums/MemberCategory";
export interface IRagfairOffer {
sellResult?: SellResult[];
sellResult?: ISellResult[];
_id: string;
items: Item[];
items: IItem[];
requirements: OfferRequirement[];
root: string;
intId: number;
@ -47,7 +47,7 @@ export interface IRagfairOfferUser {
aid?: number;
}
export interface SellResult {
export interface ISellResult {
sellTime: number;
amount: number;
}

View File

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

View File

@ -1,5 +1,5 @@
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";
export interface IGenerateEquipmentProperties {
@ -7,9 +7,9 @@ export interface IGenerateEquipmentProperties {
rootEquipmentSlot: string;
/** Equipment pool for root slot being generated */
rootEquipmentPool: Record<string, number>;
modPool: Mods;
modPool: IMods;
/** Dictionary of mod items and their chance to spawn for this bot type */
spawnChances: Chances;
spawnChances: IChances;
/** Role being generated for */
botRole: string;
/** Level of bot being generated */

View File

@ -1,19 +1,19 @@
import { Mods, ModsChances } from "@spt/models/eft/common/tables/IBotType";
import { Item } from "@spt/models/eft/common/tables/IItem";
import { IMods, IModsChances } from "@spt/models/eft/common/tables/IBotType";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { BotModLimits } from "@spt/services/BotWeaponModLimitService";
export interface IGenerateWeaponRequest {
/** Weapon to add mods to / result that is returned */
weapon: Item[];
weapon: IItem[];
/** Pool of compatible mods to attach to weapon */
modPool: Mods;
modPool: IMods;
/** ParentId of weapon */
weaponId: string;
/** Weapon which mods will be generated on */
parentTemplate: ITemplateItem;
/** Chance values mod will be added */
modSpawnChances: ModsChances;
modSpawnChances: IModsChances;
/** Ammo tpl to use when generating magazines/cartridges */
ammoTpl: string;
/** 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 { ModSpawn } from "@spt/models/enums/ModSpawn";
import { IBotData, IWeaponStats } from "@spt/models/spt/bots/IGenerateWeaponRequest";
@ -16,7 +16,7 @@ export interface IModToSpawnRequest {
/** Pool of items to pick from */
itemModPool: Record<string, string[]>;
/** 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) */
ammoTpl: string;
/** Parent item the mod will go into */

View File

@ -6,11 +6,11 @@ export interface IAirdropConfig extends IBaseConfig {
kind: "spt-airdrop";
airdropTypeWeightings: Record<AirdropTypeEnum, number>;
/** 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% */
export interface AirdropChancePercent {
export interface IAirdropChancePercent {
bigmap: number;
woods: number;
lighthouse: number;
@ -22,7 +22,7 @@ export interface AirdropChancePercent {
}
/** Loot inside crate */
export interface AirdropLoot {
export interface IAirdropLoot {
/** Min/max of weapons inside crate */
weaponPresetCount?: MinMax;
/** Min/max of armors (head/chest/rig) inside crate */

View File

@ -1,5 +1,5 @@
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 { IBotDurability } from "@spt/models/spt/config/IBotDurability";
@ -151,7 +151,7 @@ export interface ModLimits {
export interface RandomisationDetails {
/** Between what levels do these randomisation setting apply to */
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 */
randomisedWeaponModSlots?: string[];
/** Armor slots that should be randomised e.g. 'Headwear, Armband' */

View File

@ -1,51 +1,51 @@
export interface IBotDurability {
default: DefaultDurability;
default: IDefaultDurability;
pmc: PmcDurability;
boss: BotDurability;
follower: BotDurability;
assault: BotDurability;
cursedassault: BotDurability;
marksman: BotDurability;
pmcbot: BotDurability;
arenafighterevent: BotDurability;
arenafighter: BotDurability;
crazyassaultevent: BotDurability;
exusec: BotDurability;
gifter: BotDurability;
sectantpriest: BotDurability;
sectantwarrior: BotDurability;
boss: IBotDurability;
follower: IBotDurability;
assault: IBotDurability;
cursedassault: IBotDurability;
marksman: IBotDurability;
pmcbot: IBotDurability;
arenafighterevent: IBotDurability;
arenafighter: IBotDurability;
crazyassaultevent: IBotDurability;
exusec: IBotDurability;
gifter: IBotDurability;
sectantpriest: IBotDurability;
sectantwarrior: IBotDurability;
}
/** Durability values to be used when a more specific bot type cant be found */
export interface DefaultDurability {
armor: ArmorDurability;
weapon: WeaponDurability;
export interface IDefaultDurability {
armor: IArmorDurability;
weapon: IWeaponDurability;
}
export interface PmcDurability {
armor: PmcDurabilityArmor;
weapon: WeaponDurability;
armor: IPmcDurabilityArmor;
weapon: IWeaponDurability;
}
export interface PmcDurabilityArmor {
export interface IPmcDurabilityArmor {
lowestMaxPercent: number;
highestMaxPercent: number;
maxDelta: number;
minDelta: number;
}
export interface BotDurability {
armor: ArmorDurability;
weapon: WeaponDurability;
export interface IBotDurability {
armor: IArmorDurability;
weapon: IWeaponDurability;
}
export interface ArmorDurability {
export interface IArmorDurability {
maxDelta: number;
minDelta: number;
minLimitPercent: number;
}
export interface WeaponDurability {
export interface IWeaponDurability {
lowestMax: number;
highestMax: 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 { GiftSenderType } from "@spt/models/enums/GiftSenderType";
import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
@ -8,12 +8,12 @@ import { IProfileChangeEvent } from "@spt/models/spt/dialog/ISendMessageDetails"
export interface IGiftsConfig extends IBaseConfig {
kind: "spt-gifts";
gifts: Record<string, Gift>;
gifts: Record<string, IGift>;
}
export interface Gift {
export interface IGift {
/** Items to send to player */
items: Item[];
items: IItem[];
/** Who is sending the gift to player */
sender: GiftSenderType;
/** 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 {
kind: "spt-lostondeath";
/** 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 */
specialSlotItems: boolean;
/** Should quest items be removed from quest inventory on death */
questItems: boolean;
}
export interface Equipment {
export interface ILostEquipment {
ArmBand: boolean;
Headwear: 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";
export interface IPlayerScavConfig extends IBaseConfig {
@ -20,10 +20,10 @@ export interface Modifiers {
}
export interface ItemLimits {
healing: GenerationData;
drugs: GenerationData;
stims: GenerationData;
looseLoot: GenerationData;
magazines: GenerationData;
grenades: GenerationData;
healing: IGenerationData;
drugs: IGenerationData;
stims: IGenerationData;
looseLoot: IGenerationData;
magazines: IGenerationData;
grenades: IGenerationData;
}

View File

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

View File

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

View File

@ -1,11 +1,11 @@
import { IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData";
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
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 {
getBotLimit(type: string): number;
getBotDifficulty(type: string, difficulty: string): IBotCore | Difficulty;
getBotDifficulty(type: string, difficulty: string): IBotCore | IDifficultyCategories;
isBotPmc(botRole: string): boolean;
isBotBoss(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 { MessageType } from "@spt/models/enums/MessageType";
import { Traders } from "@spt/models/enums/Traders";
@ -17,7 +17,7 @@ export interface ISendMessageDetails {
/** Optional - used in player/system messages, otherwise templateId is used */
messageText?: string;
/** Optinal - Items to send to player */
items?: Item[];
items?: IItem[];
/** Optional - How long items will be stored in mail before expiry */
itemsMaxStorageLifetimeSeconds?: number;
/** 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";
export interface ICreateFenceAssortsResult {
sptItems: Item[][];
sptItems: IItem[][];
barter_scheme: Record<string, IBarterScheme[][]>;
loyal_level_items: Record<string, number>;
}

View File

@ -1,11 +1,11 @@
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 {
generateInventory(
templateInventory: Inventory,
equipmentChances: Chances,
generation: Generation,
templateInventory: IInventory,
equipmentChances: IChances,
generation: IGeneration,
botRole: string,
isPmc: boolean,
): 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 {
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 { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
@ -6,7 +6,7 @@ export interface IRagfairOfferGenerator {
createOffer(
userID: string,
time: number,
items: Item[],
items: IItem[],
barterScheme: IBarterScheme[],
loyalLevel: 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 {
/** Inventory items from source */
from: Item[];
from: IItem[];
/** Inventory items at destination */
to: Item[];
to: IItem[];
sameInventory: boolean;
isMail: boolean;
}

View File

@ -1,9 +1,9 @@
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 {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
itemToReturnToPlayer: IItem;
traderId: string;
}

View File

@ -6,7 +6,7 @@ import {
IProductive,
ITraderInfo,
} 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 { TimeUtil } from "@spt/utils/TimeUtil";
import { ICloner } from "@spt/utils/cloners/ICloner";
@ -69,7 +69,7 @@ export class EventOutputHolder {
*/
public updateOutputProperties(sessionId: string): void {
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.health = this.cloner.clone(pmcData.Health);

View File

@ -1,6 +1,6 @@
import { BotCallbacks } from "@spt/callbacks/BotCallbacks";
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";
@injectable()
@ -26,7 +26,7 @@ export class BotDynamicRouter extends DynamicRouter {
info: any,
sessionID: string,
output: string,
): Promise<Record<string, Difficulties>> => {
): Promise<Record<string, IDifficulties>> => {
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 { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
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 { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
@ -92,7 +92,7 @@ export class ProfileStaticRouter extends StaticRouter {
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<GetProfileStatusResponseData>> => {
): Promise<IGetBodyResponseData<IGetProfileStatusResponseData>> => {
return this.profileCallbacks.getProfileStatus(url, info, sessionID);
},
),

View File

@ -1,12 +1,12 @@
import { LootGenerator } from "@spt/generators/LootGenerator";
import { ItemHelper } from "@spt/helpers/ItemHelper";
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 { AirdropTypeEnum } from "@spt/models/enums/AirdropType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
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 { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
@ -80,7 +80,7 @@ export class AirdropService {
* @param airdropType What tpye of container: weapon/common etc
* @returns Item
*/
protected getAirdropCrateItem(airdropType: AirdropTypeEnum): Item {
protected getAirdropCrateItem(airdropType: AirdropTypeEnum): IItem {
const airdropContainer = {
_id: this.hashUtil.generate(),
_tpl: "", // picked later
@ -125,7 +125,7 @@ export class AirdropService {
* @returns LootRequest
*/
protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest {
let lootSettingsByType: AirdropLoot = this.airdropConfig.loot[airdropType];
let lootSettingsByType: IAirdropLoot = this.airdropConfig.loot[airdropType];
if (!lootSettingsByType) {
this.logger.error(
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 {
EquipmentChances,
Generation,
GenerationData,
IBotType,
ModsChances,
IGeneration,
IGenerationData,
IModsChances,
} from "@spt/models/eft/common/tables/IBotType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
@ -94,7 +94,7 @@ export class BotEquipmentFilterService {
*/
protected adjustChances(
equipmentChanges: Record<string, number>,
baseValues: EquipmentChances | ModsChances,
baseValues: EquipmentChances | IModsChances,
): void {
if (!equipmentChanges) {
return;
@ -111,8 +111,8 @@ export class BotEquipmentFilterService {
* @param baseBotGeneration dictionary to update
*/
protected adjustGenerationChances(
generationChanges: Record<string, GenerationData>,
baseBotGeneration: Generation,
generationChanges: Record<string, IGenerationData>,
baseBotGeneration: IGeneration,
): void {
if (!generationChanges) {
return;

View File

@ -1,5 +1,5 @@
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 { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -15,8 +15,8 @@ import { inject, injectable } from "tsyringe";
@injectable()
export class BotEquipmentModPoolService {
protected botConfig: IBotConfig;
protected weaponModPool: Mods = {};
protected gearModPool: Mods = {};
protected weaponModPool: IMods = {};
protected gearModPool: IMods = {};
protected weaponPoolGenerated = false;
protected armorPoolGenerated = false;

View File

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

View File

@ -5,7 +5,7 @@ import { PresetHelper } from "@spt/helpers/PresetHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { IHideoutCircleOfCultistProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutCircleOfCultistProductionStartRequestData";
import {
@ -76,7 +76,7 @@ export class CircleOfCultistService {
// Sparse, just has id
const cultistCraftData = this.databaseService.getHideout().production.cultistRecipes[0];
const sacrificedItems: Item[] = this.getSacrificedItems(pmcData);
const sacrificedItems: IItem[] = this.getSacrificedItems(pmcData);
const sacrificedItemCostRoubles = sacrificedItems.reduce(
(sum, curr) => sum + (this.itemHelper.getItemPrice(curr._tpl) ?? 0),
0,
@ -120,7 +120,7 @@ export class CircleOfCultistService {
}
}
let rewards: Item[][];
let rewards: IItem[][];
if (hasSacrificedSingleItemFlaggedInConfig) {
rewards = this.getExplicitRewards(directRewardSettings, cultistCircleStashId);
} else {
@ -173,7 +173,7 @@ export class CircleOfCultistService {
sessionId: string,
pmcData: IPmcData,
recipeId: string,
sacrificedItems: Item[],
sacrificedItems: IItem[],
rewardAmountRoubles: number,
directRewardSettings?: DirectRewardSettings,
): void {
@ -230,14 +230,14 @@ export class CircleOfCultistService {
* @param pmcData Player profile
* @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
const inventoryRootItemsInCultistGrid = pmcData.Inventory.items.filter(
(item) => item.slotId === CircleOfCultistService.circleOfCultistSlotId,
);
// Get rootitem + its children
const sacrificedItems: Item[] = [];
const sacrificedItems: IItem[] = [];
for (const rootItem of inventoryRootItemsInCultistGrid) {
const rootItemWithChildren = this.itemHelper.findAndReturnChildrenAsItems(
pmcData.Inventory.items,
@ -260,9 +260,9 @@ export class CircleOfCultistService {
rewardItemTplPool: string[],
rewardBudget: number,
cultistCircleStashId: string,
): Item[][] {
): IItem[][] {
// 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
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
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods);
@ -314,7 +314,7 @@ export class CircleOfCultistService {
);
// Not a weapon/armor, standard single item
const rewardItem: Item = {
const rewardItem: IItem = {
_id: this.hashUtil.generate(),
_tpl: randomItemTplFromPool,
parentId: cultistCircleStashId,
@ -343,9 +343,12 @@ export class CircleOfCultistService {
* @param cultistCircleStashId Id of stash item
* @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)
const rewards: Item[][] = [];
const rewards: IItem[][] = [];
for (const rewardTpl of explicitRewardSettings.rewardTpls) {
if (
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
const presetAndMods: Item[] = this.itemHelper.replaceIDs(defaultPreset._items);
const presetAndMods: IItem[] = this.itemHelper.replaceIDs(defaultPreset._items);
this.itemHelper.remapRootItemId(presetAndMods);
@ -372,7 +375,7 @@ export class CircleOfCultistService {
const stackSize = this.getExplicitRewardBaseTypeStackSize(rewardTpl);
// Not a weapon/armor, standard single item
const rewardItem: Item = {
const rewardItem: IItem = {
_id: this.hashUtil.generate(),
_tpl: rewardTpl,
parentId: cultistCircleStashId,

View File

@ -3,8 +3,8 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper";
import { IFenceLevel } from "@spt/models/eft/common/IGlobals";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Item, Repairable } from "@spt/models/eft/common/tables/IItem";
import { ITemplateItem, Slot } from "@spt/models/eft/common/tables/ITemplateItem";
import { IItem, IUpdRepairable } from "@spt/models/eft/common/tables/IItem";
import { ISlot, ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { IBarterScheme, ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
import { BaseClasses } from "@spt/models/enums/BaseClasses";
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 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!!
// Copy the item and its children
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
* @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)
? this.getAmmoBoxPrice(items) * 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)
* @returns the price of the ammo box
*/
protected getAmmoBoxPrice(items: Item[]): number {
protected getAmmoBoxPrice(items: IItem[]): number {
let total = 0;
for (const item of items) {
if (this.itemHelper.isOfBaseclass(item._tpl, BaseClasses.AMMO)) {
@ -255,7 +255,7 @@ export class FenceService {
* @param presetModifier value to multiply preset price by
*/
protected adjustItemPriceByModifier(
item: Item,
item: IItem,
assort: ITraderAssort,
modifier: number,
presetModifier: number,
@ -424,7 +424,7 @@ export class FenceService {
* @returns IGenerationAssortValues object with adjustments needed to reach desired state
*/
protected getItemCountsToGenerate(
assortItems: Item[],
assortItems: IItem[],
generationValues: IGenerationAssortValues,
): IGenerationAssortValues {
const allRootItems = assortItems.filter((item) => item.slotId === "hideout");
@ -474,7 +474,7 @@ export class FenceService {
* @param assort Trader assort to remove item from
* @param rootItems Pool of root items to pick from to remove
*/
protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: Item[]): void {
protected removeRandomItemFromAssorts(assort: ITraderAssort, rootItems: IItem[]): void {
const rootItemToAdjust = this.randomUtil.getArrayValue(rootItems);
// 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
*/
protected getMatchingItem(
rootItemBeingAdded: Item,
rootItemBeingAdded: IItem,
itemDbDetails: ITemplateItem,
itemsWithChildren: Item[][],
): Item | undefined {
itemsWithChildren: IItem[][],
): IItem | undefined {
// Get matching root items
const matchingItems = itemsWithChildren
.filter((itemWithChildren) =>
@ -828,7 +828,7 @@ export class FenceService {
* @param itemDbDetails Item we want to add db details
* @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
if (!existingItem) {
return false;
@ -855,7 +855,7 @@ export class FenceService {
*/
protected adjustItemPriceByQuality(
barterSchemes: Record<string, IBarterScheme[][]>,
itemRoot: Item,
itemRoot: IItem,
itemTemplate: ITemplateItem,
): void {
// Healing items
@ -1033,7 +1033,7 @@ export class FenceService {
* @param armor Armor item array to add mods into
* @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
const hasMods = Boolean(itemDbDetails._props.Slots);
if (!hasMods) {
@ -1060,7 +1060,7 @@ export class FenceService {
* @param softInsertSlots Slots of items to randomise
* @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) {
const modItemDbDetails = this.itemHelper.getItem(requiredSlot._props.filters[0].Plate)[1];
const durabilityValues = this.getRandomisedArmorDurabilityValues(
@ -1108,7 +1108,7 @@ export class FenceService {
* @param plateSlots Slots of items to randomise
* @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) {
const plateTpl = plateSlot._props.filters[0].Plate;
if (!plateTpl) {
@ -1198,7 +1198,7 @@ export class FenceService {
* Remove parts of a weapon prior to being listed on flea
* @param itemAndMods Weapon to remove parts from
*/
protected removeRandomModsOfItem(itemAndMods: Item[]): void {
protected removeRandomModsOfItem(itemAndMods: IItem[]): void {
// Items to be removed from inventory
const toDelete: string[] = [];
@ -1230,7 +1230,7 @@ export class FenceService {
* @param itemsBeingDeleted Current list of items on weapon being deleted
* @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 removalChance = slotIdsThatCanFail[weaponMod.slotId];
if (!removalChance) {
@ -1248,7 +1248,7 @@ export class FenceService {
* @param itemDetails Item being randomised
* @param itemToAdjust Item being edited
*/
protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void {
protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: IItem): void {
if (!itemDetails._props) {
this.logger.error(
`Item ${itemDetails._name} lacks a _props field, unable to randomise item: ${itemToAdjust._id}`,
@ -1335,7 +1335,7 @@ export class FenceService {
protected getRandomisedArmorDurabilityValues(
itemDetails: ITemplateItem,
equipmentDurabilityLimits: IItemDurabilityCurrentMax,
): Repairable {
): IUpdRepairable {
const maxDuraMin = (equipmentDurabilityLimits.max.min / 100) * itemDetails._props.MaxDurability;
const maxDuraMax = (equipmentDurabilityLimits.max.max / 100) * itemDetails._props.MaxDurability;
const chosenMaxDurability = this.randomUtil.getInt(maxDuraMin, maxDuraMax);
@ -1444,7 +1444,7 @@ export class FenceService {
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
const itemWithChildrenToRemove = this.itemHelper.findAndReturnChildrenAsItems(assorts, assortId);
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 { MessageType } from "@spt/models/enums/MessageType";
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 { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
@ -39,7 +39,7 @@ export class GiftService {
return !!this.giftConfig.gifts[giftId];
}
public getGiftById(giftId: string): Gift {
public getGiftById(giftId: string): IGift {
return this.giftConfig.gifts[giftId];
}
@ -47,7 +47,7 @@ export class GiftService {
* Get dictionary of all gifts
* @returns Dict keyed by gift id
*/
public getGifts(): Record<string, Gift> {
public getGifts(): Record<string, IGift> {
return this.giftConfig.gifts;
}
@ -164,7 +164,7 @@ export class GiftService {
* @param giftData Gift to send player
* @returns trader/user/system id
*/
protected getSenderId(giftData: Gift): string | undefined {
protected getSenderId(giftData: IGift): string | undefined {
if (giftData.sender === GiftSenderType.TRADER) {
return Traders[giftData.trader];
}
@ -179,7 +179,7 @@ export class GiftService {
* @param giftData Gift to send player
* @returns MessageType enum value
*/
protected getMessageType(giftData: Gift): MessageType | undefined {
protected getMessageType(giftData: IGift): MessageType | undefined {
switch (giftData.sender) {
case GiftSenderType.SYSTEM:
return MessageType.SYSTEM_MESSAGE;

View File

@ -2,7 +2,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { 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 { BonusType } from "@spt/models/enums/BonusType";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -24,7 +24,7 @@ import { inject, injectable } from "tsyringe";
@injectable()
export class InsuranceService {
protected insured: Record<string, Record<string, Item[]>> = {};
protected insured: Record<string, Record<string, IItem[]>> = {};
protected insuranceConfig: IInsuranceConfig;
constructor(
@ -59,7 +59,7 @@ export class InsuranceService {
* @param sessionId Profile id (session id)
* @returns Item array
*/
public getInsurance(sessionId: string): Record<string, Item[]> {
public getInsurance(sessionId: string): Record<string, IItem[]> {
return this.insured[sessionId];
}
@ -214,7 +214,7 @@ export class InsuranceService {
*/
public mapInsuredItemsToTrader(
sessionId: string,
lostInsuredItems: Item[],
lostInsuredItems: IItem[],
pmcProfile: IPmcData,
): IInsuranceEquipmentPkg[] {
const result: IInsuranceEquipmentPkg[] = [];
@ -251,7 +251,7 @@ export class InsuranceService {
* @param inventoryItems Player inventory
* @returns True if item
*/
protected itemCannotBeLostOnDeath(lostItem: Item, inventoryItems: Item[]): boolean {
protected itemCannotBeLostOnDeath(lostItem: IItem, inventoryItems: IItem[]): boolean {
if (lostItem.slotId?.toLowerCase().startsWith("specialslot")) {
return true;
}
@ -320,7 +320,7 @@ export class InsuranceService {
* @param traderId Trader item insured with
* @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);
}
@ -331,7 +331,7 @@ export class InsuranceService {
* @param traderId Trader item is insured with
* @returns price in roubles
*/
public getRoublePriceToInsureItemWithTrader(pmcData: IPmcData, inventoryItem: Item, traderId: string): number {
public getRoublePriceToInsureItemWithTrader(pmcData: IPmcData, inventoryItem: IItem, traderId: string): number {
const price =
this.itemHelper.getStaticItemPrice(inventoryItem._tpl) *
(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 { TraderHelper } from "@spt/helpers/TraderHelper";
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 { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { MessageType } from "@spt/models/enums/MessageType";
@ -237,7 +237,7 @@ export class LegacyLocationLifecycleService {
protected sendCoopTakenFenceMessage(sessionId: string): void {
// Generate reward for taking coop extract
const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift);
const mailableLoot: Item[] = [];
const mailableLoot: IItem[] = [];
const parentId = this.hashUtil.generate();
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 { IPmcData } from "@spt/models/eft/common/IPmcData";
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 { IStartLocalRaidRequestData } from "@spt/models/eft/match/IStartLocalRaidRequestData";
import { IStartLocalRaidResponseData } from "@spt/models/eft/match/IStartLocalRaidResponseData";
@ -456,7 +456,7 @@ export class LocationLifecycleService {
protected sendCoopTakenFenceMessage(sessionId: string): void {
// Generate reward for taking coop extract
const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift);
const mailableLoot: Item[] = [];
const mailableLoot: IItem[] = [];
const parentId = this.hashUtil.generate();
for (const item of loot) {
@ -694,7 +694,7 @@ export class LocationLifecycleService {
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 pmcData = serverProfile.characters.pmc;
@ -756,7 +756,7 @@ export class LocationLifecycleService {
* @param items Players inventory to search through
* @returns an array of equipped items
*/
protected getEquippedGear(items: Item[]): Item[] {
protected getEquippedGear(items: IItem[]): IItem[] {
// Player Slots we care about
const inventorySlots = [
"FirstPrimaryWeapon",
@ -781,7 +781,7 @@ export class LocationLifecycleService {
"SpecialSlot3",
];
let inventoryItems: Item[] = [];
let inventoryItems: IItem[] = [];
// Get an array of root player 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 { NotifierHelper } from "@spt/helpers/NotifierHelper";
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 {
Dialogue,
ISystemData,
@ -56,7 +56,7 @@ export class MailSendService {
trader: Traders,
messageType: MessageType,
message: string,
items: Item[] = [],
items: IItem[] = [],
maxStorageTimeSeconds?: number,
systemData?: ISystemData,
ragfair?: MessageContentRagfair,
@ -111,7 +111,7 @@ export class MailSendService {
trader: Traders,
messageType: MessageType,
messageLocaleId: string,
items: Item[] = [],
items: IItem[] = [],
maxStorageTimeSeconds?: number,
systemData?: ISystemData,
ragfair?: MessageContentRagfair,
@ -162,7 +162,7 @@ export class MailSendService {
public sendSystemMessageToPlayer(
sessionId: string,
message: string,
items: Item[] = [],
items: IItem[] = [],
maxStorageTimeSeconds?: number,
profileChangeEvents?: IProfileChangeEvent[],
): void {
@ -195,7 +195,7 @@ export class MailSendService {
public sendLocalisedSystemMessageToPlayer(
sessionId: string,
messageLocaleId: string,
items: Item[] = [],
items: IItem[] = [],
profileChangeEvents?: IProfileChangeEvent[],
maxStorageTimeSeconds?: number,
): void {
@ -230,7 +230,7 @@ export class MailSendService {
sessionId: string,
senderDetails: IUserDialogInfo,
message: string,
items: Item[] = [],
items: IItem[] = [],
maxStorageTimeSeconds?: number,
): void {
const details: ISendMessageDetails = {
@ -440,7 +440,7 @@ export class MailSendService {
// Boxes can contain sub-items
if (this.itemHelper.isOfBaseclass(itemTemplate._id, BaseClasses.AMMO_BOX)) {
const boxAndCartridges: Item[] = [reward];
const boxAndCartridges: IItem[] = [reward];
this.itemHelper.addCartridgesToAmmoBox(boxAndCartridges, itemTemplate);
// Push box + cartridge children into array
@ -471,7 +471,7 @@ export class MailSendService {
* @param items Possible items to choose from
* @returns Chosen 'primary' item
*/
protected getBaseItemFromRewards(items: Item[]): Item {
protected getBaseItemFromRewards(items: IItem[]): IItem {
// Only one item in reward, return it
if (items?.length === 1) {
return items[0];

View File

@ -1,5 +1,5 @@
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 { IInventoryDeleteMarkerRequestData } from "@spt/models/eft/inventory/IInventoryDeleteMarkerRequestData";
import { IInventoryEditMarkerRequestData } from "@spt/models/eft/inventory/IInventoryEditMarkerRequestData";
@ -16,7 +16,7 @@ export class MapMarkerService {
* @param request Add marker request
* @returns Item
*/
public createMarkerOnMap(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData): Item {
public createMarkerOnMap(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData): IItem {
// Get map from inventory
const mapItem = pmcData.Inventory.items.find((i) => i._id === request.item);
@ -36,7 +36,7 @@ export class MapMarkerService {
* @param request Delete marker request
* @returns Item
*/
public deleteMarkerFromMap(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData): Item {
public deleteMarkerFromMap(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData): IItem {
// Get map from inventory
const mapItem = pmcData.Inventory.items.find((item) => item._id === request.item);
@ -55,7 +55,7 @@ export class MapMarkerService {
* @param request Edit marker request
* @returns Item
*/
public editMarkerOnMap(pmcData: IPmcData, request: IInventoryEditMarkerRequestData): Item {
public editMarkerOnMap(pmcData: IPmcData, request: IInventoryEditMarkerRequestData): IItem {
// Get map from inventory
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 { TraderHelper } from "@spt/helpers/TraderHelper";
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 { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
@ -303,7 +303,7 @@ export class PaymentService {
* @param playerStashId Players stash id
* @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);
if (moneyItemsInInventory?.length === 0) {
this.logger.debug(`No ${currencyTpl} money items found in inventory`);
@ -324,7 +324,7 @@ export class PaymentService {
* @param playerStashId Players stash id
* @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
if (a.slotId === "hideout" && b.slotId !== "hideout") {
return -1;
@ -363,7 +363,7 @@ export class PaymentService {
* @param playerStashId Players stash id
* @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);
if (itemParent) {

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
import { Item } from "@spt/models/eft/common/tables/IItem";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
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
* @returns Expired offer assorts
*/
public getExpiredOfferAssorts(): Item[][] {
const expiredItems: Item[][] = [];
public getExpiredOfferAssorts(): IItem[][] {
const expiredItems: IItem[][] = [];
for (const expiredOfferId in this.expiredOffers) {
const expiredOffer = this.expiredOffers[expiredOfferId];
@ -277,8 +277,8 @@ export class RagfairOfferService {
* @param items Offer items to unstack
* @returns Unstacked array of items
*/
protected unstackOfferItems(items: Item[]): Item[] {
const result: Item[] = [];
protected unstackOfferItems(items: IItem[]): IItem[] {
const result: IItem[] = [];
const rootItem = items[0];
const itemDetails = this.itemHelper.getItem(rootItem._tpl);
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 { IPreset } from "@spt/models/eft/common/IGlobals";
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 { BaseClasses } from "@spt/models/enums/BaseClasses";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
@ -103,7 +103,7 @@ export class RagfairPriceService implements OnLoad {
* @param offerItems offer item + children to process
* @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
if (this.itemHelper.isOfBaseclass(offerItems[0]._tpl, BaseClasses.WEAPON)) {
return this.getFleaPriceForItem(offerItems[0]._tpl);
@ -203,7 +203,7 @@ export class RagfairPriceService implements OnLoad {
* @param isPackOffer Price is for a pack type offer
* @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.
let price = 0;
@ -242,8 +242,8 @@ export class RagfairPriceService implements OnLoad {
public getDynamicItemPrice(
itemTemplateId: string,
desiredCurrency: string,
item?: Item,
offerItems?: Item[],
item?: IItem,
offerItems?: IItem[],
isPackOffer?: boolean,
): number {
let isPreset = false;
@ -416,7 +416,7 @@ export class RagfairPriceService implements OnLoad {
* @param existingPrice price of existing base weapon
* @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
const presetResult = this.getWeaponPreset(weaponRootItem);
if (presetResult.isDefault) {
@ -477,7 +477,7 @@ export class RagfairPriceService implements OnLoad {
* @param presets weapon presets to choose from
* @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);
if (defaultPreset) {
return { isDefault: true, preset: defaultPreset };

View File

@ -1,7 +1,7 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
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 { IStorePlayerOfferTaxAmountRequestData } from "@spt/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData";
import { BonusType } from "@spt/models/enums/BonusType";
@ -47,7 +47,7 @@ export class RagfairTaxService {
* @returns Tax in roubles
*/
public calculateTax(
item: Item,
item: IItem,
pmcData: IPmcData,
requirementsValue: 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.
// Any inefficiencies or style issues are intentional and should not be fixed, to preserve the client-side code mirroring.
protected calculateItemWorth(
item: Item,
item: IItem,
itemTemplate: ITemplateItem,
itemCount: number,
pmcData: IPmcData,

View File

@ -5,7 +5,7 @@ import { TraderHelper } from "@spt/helpers/TraderHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { IArmorType } from "@spt/models/eft/common/IGlobals";
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 { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { RepairKitsInfo } from "@spt/models/eft/repair/IRepairActionDataRequest";
@ -424,7 +424,7 @@ export class RepairService {
* @param repairKitDetails Repair kit details from db
* @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;
if (!repairKitInInventory.upd) {
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 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 bonusType = this.weightedRandomHelper.getWeightedValue<string>(itemConfig.bonusTypeWeight);
@ -612,7 +612,7 @@ export class RepairService {
export class RepairDetails {
repairCost?: number;
repairPoints?: number;
repairedItem: Item;
repairedItem: IItem;
repairedItemIsArmor: boolean;
repairAmount: number;
repairedByKit: boolean;

View File

@ -3,7 +3,7 @@ import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IConfig } from "@spt/models/eft/common/IGlobals";
import { ILocation } from "@spt/models/eft/common/ILocation";
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 { ItemTpl } from "@spt/models/enums/ItemTpl";
import { Season } from "@spt/models/enums/Season";
@ -258,7 +258,7 @@ export class SeasonalEventService {
* @param botInventory Bots inventory to iterate over
* @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 equipmentSlotsToFilter = ["FaceCover", "Headwear", "Backpack", "TacticalVest"];
const lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"];

View File

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

View File

@ -1,7 +1,7 @@
import "reflect-metadata";
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 { DatabaseServer } from "@spt/servers/DatabaseServer";
import { HashUtil } from "@spt/utils/HashUtil";
@ -216,7 +216,7 @@ describe("ItemHelper", () => {
describe("fixItemStackCount", () => {
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);
expect(fixedItem.upd).toBeDefined();
@ -224,7 +224,7 @@ describe("ItemHelper", () => {
});
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);
expect(fixedItem.upd).toBeDefined();
@ -232,7 +232,7 @@ describe("ItemHelper", () => {
});
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);
expect(fixedItem.upd).toBeDefined();
@ -319,7 +319,7 @@ describe("ItemHelper", () => {
describe("getItemQualityModifier", () => {
it("should return 1 for an item with no upd", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "590c657e86f77412b013051d", // "Grizzly medical kit"
};
@ -331,7 +331,7 @@ describe("ItemHelper", () => {
it("should return 1 for an item with upd but no relevant fields", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "590c657e86f77412b013051d", // "Grizzly medical kit"
upd: {},
@ -344,7 +344,7 @@ describe("ItemHelper", () => {
it("should return correct value for a medkit", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "590c657e86f77412b013051d", // "Grizzly medical kit"
upd: {
@ -361,7 +361,7 @@ describe("ItemHelper", () => {
it("should return correct value for a repairable helmet", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "5b40e1525acfc4771e1c6611",
upd: { Repairable: { Durability: 19, MaxDurability: 38 } },
@ -379,7 +379,7 @@ describe("ItemHelper", () => {
it("should return correct value for a reparable weapon", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "5a38e6bac4a2826c6e06d79b", // "TOZ-106 20ga bolt-action shotgun"
upd: { Repairable: { Durability: 20, MaxDurability: 100 } },
@ -392,7 +392,7 @@ describe("ItemHelper", () => {
it("should return correct value for a food or drink item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "5448fee04bdc2dbc018b4567", // "Bottle of water (0.6L)"
upd: {
@ -409,7 +409,7 @@ describe("ItemHelper", () => {
it("should return correct value for a key item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key"
upd: { Key: { NumberOfUsages: 5 } },
@ -422,7 +422,7 @@ describe("ItemHelper", () => {
it("should return correct value for a resource item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "5d1b36a186f7742523398433", // "Metal fuel tank"
upd: {
@ -440,7 +440,7 @@ describe("ItemHelper", () => {
it("should return correct value for a repair kit item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
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", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: { RepairKit: { Resource: 0 } },
@ -468,8 +468,8 @@ describe("ItemHelper", () => {
describe("getRepairableItemQualityValue", () => {
it("should return the correct quality value", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
const repairable: Repairable = { Durability: 50, MaxDurability: 100 };
const item: Item = { _id: "", _tpl: "" };
const repairable: IUpdRepairable = { Durability: 50, MaxDurability: 100 };
const item: IItem = { _id: "", _tpl: "" };
// Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -480,11 +480,11 @@ describe("ItemHelper", () => {
it("should fall back to using Repairable MaxDurability", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = {
const repairable: IUpdRepairable = {
Durability: 50,
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.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -495,11 +495,11 @@ describe("ItemHelper", () => {
it("should return 1 if durability value is invalid", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = {
const repairable: IUpdRepairable = {
Durability: 50,
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.
const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() => {});
@ -514,11 +514,11 @@ describe("ItemHelper", () => {
it("should not divide by zero", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = {
const repairable: IUpdRepairable = {
Durability: 50,
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.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -529,11 +529,11 @@ describe("ItemHelper", () => {
it("should log an error if durability is invalid", () => {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
weapon._props.MaxDurability = undefined; // Remove the MaxDurability property.
const repairable: Repairable = {
const repairable: IUpdRepairable = {
Durability: 50,
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");
@ -546,7 +546,7 @@ describe("ItemHelper", () => {
describe("findAndReturnChildrenByItems", () => {
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: "2", _tpl: "", parentId: null },
{
@ -560,7 +560,7 @@ describe("ItemHelper", () => {
});
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: "2", _tpl: "", parentId: "1" },
{
@ -574,7 +574,7 @@ describe("ItemHelper", () => {
});
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: "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", () => {
const items: Item[] = [
const items: IItem[] = [
{ _id: "1", _tpl: "", parentId: null },
{ _id: "2", _tpl: "", parentId: "1" },
];
@ -601,7 +601,7 @@ describe("ItemHelper", () => {
describe("getItemStackSize", () => {
it("should return 1 when item has no existing stack size", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {},
@ -612,7 +612,7 @@ describe("ItemHelper", () => {
it("should return 1 when item has no upd property", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
};
@ -622,7 +622,7 @@ describe("ItemHelper", () => {
it("should return 5 when item has existing stack size of 5", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: { StackObjectsCount: 5 },
@ -635,7 +635,7 @@ describe("ItemHelper", () => {
describe("hasBuyRestrictions", () => {
it("should return true when item has buy restriction current and max properties", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
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", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {},
@ -657,7 +657,7 @@ describe("ItemHelper", () => {
it("should return false when item has no buy restriction current, max or upd properties", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = {
const item: IItem = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
};
@ -686,7 +686,7 @@ describe("ItemHelper", () => {
describe("addCartridgesToAmmoBox", () => {
it("should return an array with 1x ammoBox and 1x cartridge item", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [
const ammoBox: IItem[] = [
{
_id: itemId,
_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", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [
const ammoBox: IItem[] = [
{
_id: itemId,
_tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)""
@ -721,7 +721,7 @@ describe("ItemHelper", () => {
it("should keep original ammo box provided", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [
const ammoBox: IItem[] = [
{
_id: itemId,
_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", () => {
const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [
const ammoBox: IItem[] = [
{
_id: itemId,
_tpl: "5737292724597765e5728562", // "5.45x39mm BP gs ammo pack (120 pcs)""
@ -886,7 +886,7 @@ describe("ItemHelper", () => {
describe("splitStack", () => {
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(),
_tpl: "59e690b686f7746c9f75e848", // m995
upd: {
@ -899,7 +899,7 @@ describe("ItemHelper", () => {
});
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(),
_tpl: "59e690b686f7746c9f75e848", // m995
upd: {
@ -912,7 +912,7 @@ describe("ItemHelper", () => {
});
it("should return same item if below max stack size", () => {
const stackableItem: Item = {
const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995
upd: {
@ -926,7 +926,7 @@ describe("ItemHelper", () => {
});
it("should return same item if item has no StackObjectsCount property", () => {
const stackableItem: Item = {
const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995
upd: {},
@ -936,7 +936,7 @@ describe("ItemHelper", () => {
});
it("should return same item if item has no upd object", () => {
const stackableItem: Item = {
const stackableItem: IItem = {
_id: container.resolve<HashUtil>("HashUtil").generate(),
_tpl: "59e690b686f7746c9f75e848", // m995
};

View File

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