Update types
This commit is contained in:
parent
432af5cd3f
commit
67249867b0
@ -49,7 +49,6 @@ export declare class GameController {
|
|||||||
protected giftService: GiftService;
|
protected giftService: GiftService;
|
||||||
protected applicationContext: ApplicationContext;
|
protected applicationContext: ApplicationContext;
|
||||||
protected configServer: ConfigServer;
|
protected configServer: ConfigServer;
|
||||||
protected os: any;
|
|
||||||
protected httpConfig: IHttpConfig;
|
protected httpConfig: IHttpConfig;
|
||||||
protected coreConfig: ICoreConfig;
|
protected coreConfig: ICoreConfig;
|
||||||
protected locationConfig: ILocationConfig;
|
protected locationConfig: ILocationConfig;
|
||||||
|
@ -4,7 +4,6 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
|
|||||||
import { TraderHelper } from "../helpers/TraderHelper";
|
import { TraderHelper } from "../helpers/TraderHelper";
|
||||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||||
import { Item } from "../models/eft/common/tables/IItem";
|
import { Item } from "../models/eft/common/tables/IItem";
|
||||||
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
|
|
||||||
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
||||||
@ -75,67 +74,92 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
||||||
/**
|
/**
|
||||||
* Build an array of items to delete from the insured items.
|
* Finds the items that should be deleted based on the given Insurance object.
|
||||||
*
|
*
|
||||||
* This method orchestrates several steps:
|
* @param insured The insurance object containing the items to evaluate for deletion.
|
||||||
* - Filters items based on their presence in the database and their raid moddability.
|
* @returns A Set containing the IDs of items that should be deleted.
|
||||||
* - Sorts base and independent child items to consider for deletion.
|
|
||||||
* - Groups child items by their parent for later evaluation.
|
|
||||||
* - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll.
|
|
||||||
*
|
|
||||||
* @param insured - The insured items to build a removal array from.
|
|
||||||
* @returns An array of IDs representing items that should be deleted.
|
|
||||||
*/
|
*/
|
||||||
protected findItemsToDelete(insured: Insurance): Set<string>;
|
protected findItemsToDelete(insured: Insurance): Set<string>;
|
||||||
/**
|
/**
|
||||||
* Filters an item based on its existence in the database, raid moddability, and slot requirements.
|
* Populate a Map object of items for quick lookup by their ID.
|
||||||
*
|
*
|
||||||
* @param item The item to be filtered.
|
* @param insured The insurance object containing the items to populate the map with.
|
||||||
* @param parentItemDbDetails The database details of the parent item, or null if the item has no parent.
|
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
|
||||||
* @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database,
|
|
||||||
* and the second element is the item details if it does.
|
|
||||||
* @returns true if the item exists in the database and neither of the following conditions are met:
|
|
||||||
* - The item has the RaidModdable property set to false.
|
|
||||||
* - The item is attached to a required slot in its parent item.
|
|
||||||
* Otherwise, returns false.
|
|
||||||
*/
|
*/
|
||||||
protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean;
|
protected populateItemsMap(insured: Insurance): Map<string, Item>;
|
||||||
/**
|
/**
|
||||||
* Determines if an item is either a base item or a child item that is not equipped to its parent.
|
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
|
||||||
|
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
|
||||||
|
* not the backpack that the gun is located in (the gun's parent).
|
||||||
*
|
*
|
||||||
* @param item The item to check.
|
* @param insured - The insurance object containing the items to evaluate.
|
||||||
* @returns true if the item is a base or an independent child item, otherwise false.
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
*/
|
*/
|
||||||
protected isBaseOrIndependentChild(item: Item): boolean;
|
protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
/**
|
/**
|
||||||
* Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added
|
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
|
||||||
* to the `toDelete` array.
|
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
|
||||||
|
* they (and their attached, attachments, if any) are marked for deletion in the toDelete Set.
|
||||||
*
|
*
|
||||||
* @param item The item for which the roll is made.
|
* @param insured The insurance object containing the items to evaluate.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* @param toDelete A Set to keep track of items marked for deletion.
|
||||||
* @param toDelete The array accumulating the IDs of items to be deleted.
|
|
||||||
* @returns true if the item is marked for deletion, otherwise false.
|
|
||||||
*/
|
|
||||||
protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set<string>): boolean;
|
|
||||||
/**
|
|
||||||
* Groups child items by their parent IDs in a Map data structure.
|
|
||||||
*
|
|
||||||
* @param item The child item to be grouped by its parent.
|
|
||||||
* @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs.
|
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map<string, Item[]>): void;
|
protected processRegularItems(insured: Insurance, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to
|
* Process parent items and their attachments, updating the toDelete Set accordingly.
|
||||||
* determine if it should be deleted. The method then deletes the most valuable children based on the number of
|
|
||||||
* successful rolls made.
|
|
||||||
*
|
*
|
||||||
* @param children The array of children items to sort and filter.
|
* This method iterates over a map of parent items to their attachments and performs evaluations on each.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* It marks items for deletion based on certain conditions and updates the toDelete Set accordingly.
|
||||||
|
*
|
||||||
|
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap A Map object for quick item look-up by item ID.
|
||||||
|
* @param traderId The trader ID from the Insurance object.
|
||||||
|
* @param toDelete A Set object to keep track of items marked for deletion.
|
||||||
|
*/
|
||||||
|
protected processAttachments(mainParentToAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>, traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by
|
||||||
|
* their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the
|
||||||
|
* number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most
|
||||||
|
* valuable attachments first.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items to sort, filter, and roll.
|
||||||
|
* @param traderId The ID of the trader to that has ensured these items.
|
||||||
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set<string>): void;
|
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Sorts the attachment items by their max price in descending order.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachments items.
|
||||||
|
* @returns An array of items enriched with their max price and common locale-name.
|
||||||
|
*/
|
||||||
|
protected sortAttachmentsByPrice(attachments: Item[]): EnrichedItem[];
|
||||||
|
/**
|
||||||
|
* Logs the details of each attachment item.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
*/
|
||||||
|
protected logAttachmentsDetails(attachments: EnrichedItem[]): void;
|
||||||
|
/**
|
||||||
|
* Counts the number of successful rolls for the attachment items.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param traderId The ID of the trader that has insured these attachments.
|
||||||
|
* @returns The number of successful rolls.
|
||||||
|
*/
|
||||||
|
protected countSuccessfulRolls(attachments: Item[], traderId: string): number;
|
||||||
|
/**
|
||||||
|
* Marks the most valuable attachments for deletion based on the number of successful rolls made.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param successfulRolls The number of successful rolls.
|
||||||
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
|
*/
|
||||||
|
protected attachmentDeletionByValue(attachments: EnrichedItem[], successfulRolls: number, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Remove items from the insured items that should not be returned to the player.
|
* Remove items from the insured items that should not be returned to the player.
|
||||||
*
|
*
|
||||||
@ -144,6 +168,22 @@ export declare class InsuranceController {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been
|
||||||
|
* deleted from insurance, but any insured items within the parent should remain. This method will remove the
|
||||||
|
* reference from the children to the parent and set item properties to main-level values.
|
||||||
|
*
|
||||||
|
* @param insured Insurance object containing items.
|
||||||
|
*/
|
||||||
|
protected adoptOrphanedItems(insured: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this
|
||||||
|
* method should be a reliable way to fetch it, if it ever does change.
|
||||||
|
*
|
||||||
|
* @param items Array of items to search through.
|
||||||
|
* @returns The parentId of an item with slotId 'hideout'. Empty string if not found.
|
||||||
|
*/
|
||||||
|
protected fetchHideoutItemParent(items: Item[]): string;
|
||||||
/**
|
/**
|
||||||
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
||||||
*
|
*
|
||||||
@ -154,15 +194,14 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
||||||
/**
|
/**
|
||||||
* Determines whether a valid insured item should be removed from the player's inventory based on a random roll and
|
* Determines whether a insured item should be removed from the player's inventory based on a random roll and
|
||||||
* trader-specific return chance.
|
* trader-specific return chance.
|
||||||
*
|
*
|
||||||
* @param insuredItem The insured item being evaluated for removal.
|
|
||||||
* @param traderId The ID of the trader who insured the item.
|
* @param traderId The ID of the trader who insured the item.
|
||||||
* @param itemsBeingDeleted List of items that are already slated for removal.
|
* @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.
|
* @returns true if the insured item should be removed from inventory, false otherwise.
|
||||||
*/
|
*/
|
||||||
protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set<string>): boolean;
|
protected rollForDelete(traderId: string, insuredItem?: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Handle Insure event
|
* Handle Insure event
|
||||||
* Add insurance to an item
|
* Add insurance to an item
|
||||||
@ -183,3 +222,8 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
||||||
}
|
}
|
||||||
|
interface EnrichedItem extends Item {
|
||||||
|
name: string;
|
||||||
|
maxPrice: number;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export declare class Serializer {
|
export declare class Serializer {
|
||||||
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
||||||
canHandle(something: string): boolean;
|
canHandle(something: string): boolean;
|
||||||
|
@ -225,6 +225,48 @@ declare class ItemHelper {
|
|||||||
* @returns true if item is flagged as quest item
|
* @returns true if item is flagged as quest item
|
||||||
*/
|
*/
|
||||||
isQuestItem(tpl: string): boolean;
|
isQuestItem(tpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the
|
||||||
|
* parent items existence in the database, the existence (and value) of the items RaidModdable property, and that
|
||||||
|
* the parents slot-required property exists, matches that of the item, and it's value.
|
||||||
|
*
|
||||||
|
* Note: this function does not preform any checks to see if the item and parent are *actually* related.
|
||||||
|
*
|
||||||
|
* @param item The item to be checked
|
||||||
|
* @param parent The parent of the item to be checked
|
||||||
|
* @returns True if the item is actually moddable, false if it is not, and null if the check cannot be performed.
|
||||||
|
*/
|
||||||
|
isRaidModdable(item: Item, parent: Item): boolean | null;
|
||||||
|
/**
|
||||||
|
* Retrieves the main parent item for a given attachment item.
|
||||||
|
*
|
||||||
|
* This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent
|
||||||
|
* item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it
|
||||||
|
* will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately
|
||||||
|
* attached to, even if that gun is located within multiple containers.
|
||||||
|
*
|
||||||
|
* It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items
|
||||||
|
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
|
||||||
|
* some of the performance concerns, as it allows for quick lookups of items by ID.
|
||||||
|
*
|
||||||
|
* To generate the map:
|
||||||
|
* ```
|
||||||
|
* const itemsMap = new Map<string, Item>();
|
||||||
|
* items.forEach(item => itemsMap.set(item._id, item));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param itemId - The unique identifier of the item for which to find the main parent.
|
||||||
|
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
|
||||||
|
* @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists.
|
||||||
|
*/
|
||||||
|
getAttachmentMainParent(itemId: string, itemsMap: Map<string, Item>): Item | null;
|
||||||
|
/**
|
||||||
|
* Determines if an item is an attachment that is currently attached to it's parent item.
|
||||||
|
*
|
||||||
|
* @param item The item to check.
|
||||||
|
* @returns true if the item is attached attachment, otherwise false.
|
||||||
|
*/
|
||||||
|
isAttachmentAttached(item: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Get the inventory size of an item
|
* Get the inventory size of an item
|
||||||
* @param items Item with children
|
* @param items Item with children
|
||||||
|
@ -66,6 +66,10 @@ export declare class PreAkiModLoader implements IModLoader {
|
|||||||
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
||||||
protected executeMods(container: DependencyContainer): Promise<void>;
|
protected executeMods(container: DependencyContainer): Promise<void>;
|
||||||
sortModsLoadOrder(): string[];
|
sortModsLoadOrder(): string[];
|
||||||
|
/**
|
||||||
|
* Compile mod and add into class property "imported"
|
||||||
|
* @param mod Name of mod to compile/add
|
||||||
|
*/
|
||||||
protected addMod(mod: string): Promise<void>;
|
protected addMod(mod: string): Promise<void>;
|
||||||
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
||||||
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
||||||
/**
|
/**
|
||||||
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
||||||
|
@ -6,6 +6,9 @@ export interface IPackageJsonData {
|
|||||||
author: string;
|
author: string;
|
||||||
version: string;
|
version: string;
|
||||||
akiVersion: string;
|
akiVersion: string;
|
||||||
|
/** We deliberately purge this data */
|
||||||
|
scripts: Record<string, string>;
|
||||||
|
devDependencies: Record<string, string>;
|
||||||
licence: string;
|
licence: string;
|
||||||
main: string;
|
main: string;
|
||||||
isBundleMod: boolean;
|
isBundleMod: boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage } from "http";
|
import { IncomingMessage } from "node:http";
|
||||||
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
||||||
export declare class HttpRouter {
|
export declare class HttpRouter {
|
||||||
protected staticRouters: StaticRouter[];
|
protected staticRouters: StaticRouter[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
||||||
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
||||||
import { VFS } from "../utils/VFS";
|
import { VFS } from "../utils/VFS";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { BundleLoader } from "../../loaders/BundleLoader";
|
import { BundleLoader } from "../../loaders/BundleLoader";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ImageRouter } from "../ImageRouter";
|
import { ImageRouter } from "../ImageRouter";
|
||||||
export declare class ImageSerializer extends Serializer {
|
export declare class ImageSerializer extends Serializer {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { NotifierController } from "../../controllers/NotifierController";
|
import { NotifierController } from "../../controllers/NotifierController";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage, ServerResponse } from "http";
|
import http, { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ApplicationContext } from "../context/ApplicationContext";
|
import { ApplicationContext } from "../context/ApplicationContext";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage } from "http";
|
import http, { IncomingMessage } from "node:http";
|
||||||
import WebSocket from "ws";
|
import WebSocket from "ws";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { INotification } from "../models/eft/notifier/INotifier";
|
import { INotification } from "../models/eft/notifier/INotifier";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
import { HttpRouter } from "../../routers/HttpRouter";
|
import { HttpRouter } from "../../routers/HttpRouter";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export interface IHttpListener {
|
export interface IHttpListener {
|
||||||
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
||||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
||||||
export declare class HttpListenerMod implements IHttpListener {
|
export declare class HttpListenerMod implements IHttpListener {
|
||||||
private canHandleOverride;
|
private canHandleOverride;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
export declare class HttpListenerModService {
|
export declare class HttpListenerModService {
|
||||||
protected container: DependencyContainer;
|
protected container: DependencyContainer;
|
||||||
|
@ -12,7 +12,6 @@ export declare class App {
|
|||||||
protected onLoadComponents: OnLoad[];
|
protected onLoadComponents: OnLoad[];
|
||||||
protected onUpdateComponents: OnUpdate[];
|
protected onUpdateComponents: OnUpdate[];
|
||||||
protected onUpdateLastRun: {};
|
protected onUpdateLastRun: {};
|
||||||
protected os: any;
|
|
||||||
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
||||||
load(): Promise<void>;
|
load(): Promise<void>;
|
||||||
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import crypto from "crypto";
|
import crypto from "node:crypto";
|
||||||
import { TimeUtil } from "./TimeUtil";
|
import { TimeUtil } from "./TimeUtil";
|
||||||
export declare class HashUtil {
|
export declare class HashUtil {
|
||||||
protected timeUtil: TimeUtil;
|
protected timeUtil: TimeUtil;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { ServerResponse } from "http";
|
import { ServerResponse } from "node:http";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
export declare class HttpFileUtil {
|
export declare class HttpFileUtil {
|
||||||
protected httpServerHelper: HttpServerHelper;
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
||||||
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
||||||
|
@ -4,12 +4,10 @@ import { ConfigServer } from "../servers/ConfigServer";
|
|||||||
import { LocalisationService } from "../services/LocalisationService";
|
import { LocalisationService } from "../services/LocalisationService";
|
||||||
export declare class WatermarkLocale {
|
export declare class WatermarkLocale {
|
||||||
protected localisationService: LocalisationService;
|
protected localisationService: LocalisationService;
|
||||||
|
protected description: string[];
|
||||||
|
protected warning: string[];
|
||||||
|
protected modding: string[];
|
||||||
constructor(localisationService: LocalisationService);
|
constructor(localisationService: LocalisationService);
|
||||||
protected watermark: {
|
|
||||||
description: string[];
|
|
||||||
warning: string[];
|
|
||||||
modding: string[];
|
|
||||||
};
|
|
||||||
getDescription(): string[];
|
getDescription(): string[];
|
||||||
getWarning(): string[];
|
getWarning(): string[];
|
||||||
getModding(): string[];
|
getModding(): string[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
||||||
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
||||||
|
@ -49,7 +49,6 @@ export declare class GameController {
|
|||||||
protected giftService: GiftService;
|
protected giftService: GiftService;
|
||||||
protected applicationContext: ApplicationContext;
|
protected applicationContext: ApplicationContext;
|
||||||
protected configServer: ConfigServer;
|
protected configServer: ConfigServer;
|
||||||
protected os: any;
|
|
||||||
protected httpConfig: IHttpConfig;
|
protected httpConfig: IHttpConfig;
|
||||||
protected coreConfig: ICoreConfig;
|
protected coreConfig: ICoreConfig;
|
||||||
protected locationConfig: ILocationConfig;
|
protected locationConfig: ILocationConfig;
|
||||||
|
@ -4,7 +4,6 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
|
|||||||
import { TraderHelper } from "../helpers/TraderHelper";
|
import { TraderHelper } from "../helpers/TraderHelper";
|
||||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||||
import { Item } from "../models/eft/common/tables/IItem";
|
import { Item } from "../models/eft/common/tables/IItem";
|
||||||
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
|
|
||||||
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
||||||
@ -75,67 +74,92 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
||||||
/**
|
/**
|
||||||
* Build an array of items to delete from the insured items.
|
* Finds the items that should be deleted based on the given Insurance object.
|
||||||
*
|
*
|
||||||
* This method orchestrates several steps:
|
* @param insured The insurance object containing the items to evaluate for deletion.
|
||||||
* - Filters items based on their presence in the database and their raid moddability.
|
* @returns A Set containing the IDs of items that should be deleted.
|
||||||
* - Sorts base and independent child items to consider for deletion.
|
|
||||||
* - Groups child items by their parent for later evaluation.
|
|
||||||
* - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll.
|
|
||||||
*
|
|
||||||
* @param insured - The insured items to build a removal array from.
|
|
||||||
* @returns An array of IDs representing items that should be deleted.
|
|
||||||
*/
|
*/
|
||||||
protected findItemsToDelete(insured: Insurance): Set<string>;
|
protected findItemsToDelete(insured: Insurance): Set<string>;
|
||||||
/**
|
/**
|
||||||
* Filters an item based on its existence in the database, raid moddability, and slot requirements.
|
* Populate a Map object of items for quick lookup by their ID.
|
||||||
*
|
*
|
||||||
* @param item The item to be filtered.
|
* @param insured The insurance object containing the items to populate the map with.
|
||||||
* @param parentItemDbDetails The database details of the parent item, or null if the item has no parent.
|
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
|
||||||
* @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database,
|
|
||||||
* and the second element is the item details if it does.
|
|
||||||
* @returns true if the item exists in the database and neither of the following conditions are met:
|
|
||||||
* - The item has the RaidModdable property set to false.
|
|
||||||
* - The item is attached to a required slot in its parent item.
|
|
||||||
* Otherwise, returns false.
|
|
||||||
*/
|
*/
|
||||||
protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean;
|
protected populateItemsMap(insured: Insurance): Map<string, Item>;
|
||||||
/**
|
/**
|
||||||
* Determines if an item is either a base item or a child item that is not equipped to its parent.
|
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
|
||||||
|
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
|
||||||
|
* not the backpack that the gun is located in (the gun's parent).
|
||||||
*
|
*
|
||||||
* @param item The item to check.
|
* @param insured - The insurance object containing the items to evaluate.
|
||||||
* @returns true if the item is a base or an independent child item, otherwise false.
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
*/
|
*/
|
||||||
protected isBaseOrIndependentChild(item: Item): boolean;
|
protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
/**
|
/**
|
||||||
* Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added
|
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
|
||||||
* to the `toDelete` array.
|
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
|
||||||
|
* they (and their attached, attachments, if any) are marked for deletion in the toDelete Set.
|
||||||
*
|
*
|
||||||
* @param item The item for which the roll is made.
|
* @param insured The insurance object containing the items to evaluate.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* @param toDelete A Set to keep track of items marked for deletion.
|
||||||
* @param toDelete The array accumulating the IDs of items to be deleted.
|
|
||||||
* @returns true if the item is marked for deletion, otherwise false.
|
|
||||||
*/
|
|
||||||
protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set<string>): boolean;
|
|
||||||
/**
|
|
||||||
* Groups child items by their parent IDs in a Map data structure.
|
|
||||||
*
|
|
||||||
* @param item The child item to be grouped by its parent.
|
|
||||||
* @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs.
|
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map<string, Item[]>): void;
|
protected processRegularItems(insured: Insurance, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to
|
* Process parent items and their attachments, updating the toDelete Set accordingly.
|
||||||
* determine if it should be deleted. The method then deletes the most valuable children based on the number of
|
|
||||||
* successful rolls made.
|
|
||||||
*
|
*
|
||||||
* @param children The array of children items to sort and filter.
|
* This method iterates over a map of parent items to their attachments and performs evaluations on each.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* It marks items for deletion based on certain conditions and updates the toDelete Set accordingly.
|
||||||
|
*
|
||||||
|
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap A Map object for quick item look-up by item ID.
|
||||||
|
* @param traderId The trader ID from the Insurance object.
|
||||||
|
* @param toDelete A Set object to keep track of items marked for deletion.
|
||||||
|
*/
|
||||||
|
protected processAttachments(mainParentToAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>, traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by
|
||||||
|
* their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the
|
||||||
|
* number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most
|
||||||
|
* valuable attachments first.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items to sort, filter, and roll.
|
||||||
|
* @param traderId The ID of the trader to that has ensured these items.
|
||||||
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set<string>): void;
|
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Sorts the attachment items by their max price in descending order.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachments items.
|
||||||
|
* @returns An array of items enriched with their max price and common locale-name.
|
||||||
|
*/
|
||||||
|
protected sortAttachmentsByPrice(attachments: Item[]): EnrichedItem[];
|
||||||
|
/**
|
||||||
|
* Logs the details of each attachment item.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
*/
|
||||||
|
protected logAttachmentsDetails(attachments: EnrichedItem[]): void;
|
||||||
|
/**
|
||||||
|
* Counts the number of successful rolls for the attachment items.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param traderId The ID of the trader that has insured these attachments.
|
||||||
|
* @returns The number of successful rolls.
|
||||||
|
*/
|
||||||
|
protected countSuccessfulRolls(attachments: Item[], traderId: string): number;
|
||||||
|
/**
|
||||||
|
* Marks the most valuable attachments for deletion based on the number of successful rolls made.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param successfulRolls The number of successful rolls.
|
||||||
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
|
*/
|
||||||
|
protected attachmentDeletionByValue(attachments: EnrichedItem[], successfulRolls: number, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Remove items from the insured items that should not be returned to the player.
|
* Remove items from the insured items that should not be returned to the player.
|
||||||
*
|
*
|
||||||
@ -144,6 +168,22 @@ export declare class InsuranceController {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been
|
||||||
|
* deleted from insurance, but any insured items within the parent should remain. This method will remove the
|
||||||
|
* reference from the children to the parent and set item properties to main-level values.
|
||||||
|
*
|
||||||
|
* @param insured Insurance object containing items.
|
||||||
|
*/
|
||||||
|
protected adoptOrphanedItems(insured: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this
|
||||||
|
* method should be a reliable way to fetch it, if it ever does change.
|
||||||
|
*
|
||||||
|
* @param items Array of items to search through.
|
||||||
|
* @returns The parentId of an item with slotId 'hideout'. Empty string if not found.
|
||||||
|
*/
|
||||||
|
protected fetchHideoutItemParent(items: Item[]): string;
|
||||||
/**
|
/**
|
||||||
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
||||||
*
|
*
|
||||||
@ -154,15 +194,14 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
||||||
/**
|
/**
|
||||||
* Determines whether a valid insured item should be removed from the player's inventory based on a random roll and
|
* Determines whether a insured item should be removed from the player's inventory based on a random roll and
|
||||||
* trader-specific return chance.
|
* trader-specific return chance.
|
||||||
*
|
*
|
||||||
* @param insuredItem The insured item being evaluated for removal.
|
|
||||||
* @param traderId The ID of the trader who insured the item.
|
* @param traderId The ID of the trader who insured the item.
|
||||||
* @param itemsBeingDeleted List of items that are already slated for removal.
|
* @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.
|
* @returns true if the insured item should be removed from inventory, false otherwise.
|
||||||
*/
|
*/
|
||||||
protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set<string>): boolean;
|
protected rollForDelete(traderId: string, insuredItem?: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Handle Insure event
|
* Handle Insure event
|
||||||
* Add insurance to an item
|
* Add insurance to an item
|
||||||
@ -183,3 +222,8 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
||||||
}
|
}
|
||||||
|
interface EnrichedItem extends Item {
|
||||||
|
name: string;
|
||||||
|
maxPrice: number;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export declare class Serializer {
|
export declare class Serializer {
|
||||||
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
||||||
canHandle(something: string): boolean;
|
canHandle(something: string): boolean;
|
||||||
|
@ -225,6 +225,48 @@ declare class ItemHelper {
|
|||||||
* @returns true if item is flagged as quest item
|
* @returns true if item is flagged as quest item
|
||||||
*/
|
*/
|
||||||
isQuestItem(tpl: string): boolean;
|
isQuestItem(tpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the
|
||||||
|
* parent items existence in the database, the existence (and value) of the items RaidModdable property, and that
|
||||||
|
* the parents slot-required property exists, matches that of the item, and it's value.
|
||||||
|
*
|
||||||
|
* Note: this function does not preform any checks to see if the item and parent are *actually* related.
|
||||||
|
*
|
||||||
|
* @param item The item to be checked
|
||||||
|
* @param parent The parent of the item to be checked
|
||||||
|
* @returns True if the item is actually moddable, false if it is not, and null if the check cannot be performed.
|
||||||
|
*/
|
||||||
|
isRaidModdable(item: Item, parent: Item): boolean | null;
|
||||||
|
/**
|
||||||
|
* Retrieves the main parent item for a given attachment item.
|
||||||
|
*
|
||||||
|
* This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent
|
||||||
|
* item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it
|
||||||
|
* will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately
|
||||||
|
* attached to, even if that gun is located within multiple containers.
|
||||||
|
*
|
||||||
|
* It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items
|
||||||
|
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
|
||||||
|
* some of the performance concerns, as it allows for quick lookups of items by ID.
|
||||||
|
*
|
||||||
|
* To generate the map:
|
||||||
|
* ```
|
||||||
|
* const itemsMap = new Map<string, Item>();
|
||||||
|
* items.forEach(item => itemsMap.set(item._id, item));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param itemId - The unique identifier of the item for which to find the main parent.
|
||||||
|
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
|
||||||
|
* @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists.
|
||||||
|
*/
|
||||||
|
getAttachmentMainParent(itemId: string, itemsMap: Map<string, Item>): Item | null;
|
||||||
|
/**
|
||||||
|
* Determines if an item is an attachment that is currently attached to it's parent item.
|
||||||
|
*
|
||||||
|
* @param item The item to check.
|
||||||
|
* @returns true if the item is attached attachment, otherwise false.
|
||||||
|
*/
|
||||||
|
isAttachmentAttached(item: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Get the inventory size of an item
|
* Get the inventory size of an item
|
||||||
* @param items Item with children
|
* @param items Item with children
|
||||||
|
@ -66,6 +66,10 @@ export declare class PreAkiModLoader implements IModLoader {
|
|||||||
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
||||||
protected executeMods(container: DependencyContainer): Promise<void>;
|
protected executeMods(container: DependencyContainer): Promise<void>;
|
||||||
sortModsLoadOrder(): string[];
|
sortModsLoadOrder(): string[];
|
||||||
|
/**
|
||||||
|
* Compile mod and add into class property "imported"
|
||||||
|
* @param mod Name of mod to compile/add
|
||||||
|
*/
|
||||||
protected addMod(mod: string): Promise<void>;
|
protected addMod(mod: string): Promise<void>;
|
||||||
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
||||||
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
||||||
/**
|
/**
|
||||||
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
||||||
|
@ -6,6 +6,9 @@ export interface IPackageJsonData {
|
|||||||
author: string;
|
author: string;
|
||||||
version: string;
|
version: string;
|
||||||
akiVersion: string;
|
akiVersion: string;
|
||||||
|
/** We deliberately purge this data */
|
||||||
|
scripts: Record<string, string>;
|
||||||
|
devDependencies: Record<string, string>;
|
||||||
licence: string;
|
licence: string;
|
||||||
main: string;
|
main: string;
|
||||||
isBundleMod: boolean;
|
isBundleMod: boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage } from "http";
|
import { IncomingMessage } from "node:http";
|
||||||
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
||||||
export declare class HttpRouter {
|
export declare class HttpRouter {
|
||||||
protected staticRouters: StaticRouter[];
|
protected staticRouters: StaticRouter[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
||||||
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
||||||
import { VFS } from "../utils/VFS";
|
import { VFS } from "../utils/VFS";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { BundleLoader } from "../../loaders/BundleLoader";
|
import { BundleLoader } from "../../loaders/BundleLoader";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ImageRouter } from "../ImageRouter";
|
import { ImageRouter } from "../ImageRouter";
|
||||||
export declare class ImageSerializer extends Serializer {
|
export declare class ImageSerializer extends Serializer {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { NotifierController } from "../../controllers/NotifierController";
|
import { NotifierController } from "../../controllers/NotifierController";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage, ServerResponse } from "http";
|
import http, { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ApplicationContext } from "../context/ApplicationContext";
|
import { ApplicationContext } from "../context/ApplicationContext";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage } from "http";
|
import http, { IncomingMessage } from "node:http";
|
||||||
import WebSocket from "ws";
|
import WebSocket from "ws";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { INotification } from "../models/eft/notifier/INotifier";
|
import { INotification } from "../models/eft/notifier/INotifier";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
import { HttpRouter } from "../../routers/HttpRouter";
|
import { HttpRouter } from "../../routers/HttpRouter";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export interface IHttpListener {
|
export interface IHttpListener {
|
||||||
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
||||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
||||||
export declare class HttpListenerMod implements IHttpListener {
|
export declare class HttpListenerMod implements IHttpListener {
|
||||||
private canHandleOverride;
|
private canHandleOverride;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
export declare class HttpListenerModService {
|
export declare class HttpListenerModService {
|
||||||
protected container: DependencyContainer;
|
protected container: DependencyContainer;
|
||||||
|
@ -12,7 +12,6 @@ export declare class App {
|
|||||||
protected onLoadComponents: OnLoad[];
|
protected onLoadComponents: OnLoad[];
|
||||||
protected onUpdateComponents: OnUpdate[];
|
protected onUpdateComponents: OnUpdate[];
|
||||||
protected onUpdateLastRun: {};
|
protected onUpdateLastRun: {};
|
||||||
protected os: any;
|
|
||||||
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
||||||
load(): Promise<void>;
|
load(): Promise<void>;
|
||||||
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import crypto from "crypto";
|
import crypto from "node:crypto";
|
||||||
import { TimeUtil } from "./TimeUtil";
|
import { TimeUtil } from "./TimeUtil";
|
||||||
export declare class HashUtil {
|
export declare class HashUtil {
|
||||||
protected timeUtil: TimeUtil;
|
protected timeUtil: TimeUtil;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { ServerResponse } from "http";
|
import { ServerResponse } from "node:http";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
export declare class HttpFileUtil {
|
export declare class HttpFileUtil {
|
||||||
protected httpServerHelper: HttpServerHelper;
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
||||||
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
||||||
|
@ -4,12 +4,10 @@ import { ConfigServer } from "../servers/ConfigServer";
|
|||||||
import { LocalisationService } from "../services/LocalisationService";
|
import { LocalisationService } from "../services/LocalisationService";
|
||||||
export declare class WatermarkLocale {
|
export declare class WatermarkLocale {
|
||||||
protected localisationService: LocalisationService;
|
protected localisationService: LocalisationService;
|
||||||
|
protected description: string[];
|
||||||
|
protected warning: string[];
|
||||||
|
protected modding: string[];
|
||||||
constructor(localisationService: LocalisationService);
|
constructor(localisationService: LocalisationService);
|
||||||
protected watermark: {
|
|
||||||
description: string[];
|
|
||||||
warning: string[];
|
|
||||||
modding: string[];
|
|
||||||
};
|
|
||||||
getDescription(): string[];
|
getDescription(): string[];
|
||||||
getWarning(): string[];
|
getWarning(): string[];
|
||||||
getModding(): string[];
|
getModding(): string[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
||||||
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
||||||
|
@ -49,7 +49,6 @@ export declare class GameController {
|
|||||||
protected giftService: GiftService;
|
protected giftService: GiftService;
|
||||||
protected applicationContext: ApplicationContext;
|
protected applicationContext: ApplicationContext;
|
||||||
protected configServer: ConfigServer;
|
protected configServer: ConfigServer;
|
||||||
protected os: any;
|
|
||||||
protected httpConfig: IHttpConfig;
|
protected httpConfig: IHttpConfig;
|
||||||
protected coreConfig: ICoreConfig;
|
protected coreConfig: ICoreConfig;
|
||||||
protected locationConfig: ILocationConfig;
|
protected locationConfig: ILocationConfig;
|
||||||
|
@ -4,7 +4,6 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
|
|||||||
import { TraderHelper } from "../helpers/TraderHelper";
|
import { TraderHelper } from "../helpers/TraderHelper";
|
||||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||||
import { Item } from "../models/eft/common/tables/IItem";
|
import { Item } from "../models/eft/common/tables/IItem";
|
||||||
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
|
|
||||||
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
||||||
@ -75,67 +74,92 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
||||||
/**
|
/**
|
||||||
* Build an array of items to delete from the insured items.
|
* Finds the items that should be deleted based on the given Insurance object.
|
||||||
*
|
*
|
||||||
* This method orchestrates several steps:
|
* @param insured The insurance object containing the items to evaluate for deletion.
|
||||||
* - Filters items based on their presence in the database and their raid moddability.
|
* @returns A Set containing the IDs of items that should be deleted.
|
||||||
* - Sorts base and independent child items to consider for deletion.
|
|
||||||
* - Groups child items by their parent for later evaluation.
|
|
||||||
* - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll.
|
|
||||||
*
|
|
||||||
* @param insured - The insured items to build a removal array from.
|
|
||||||
* @returns An array of IDs representing items that should be deleted.
|
|
||||||
*/
|
*/
|
||||||
protected findItemsToDelete(insured: Insurance): Set<string>;
|
protected findItemsToDelete(insured: Insurance): Set<string>;
|
||||||
/**
|
/**
|
||||||
* Filters an item based on its existence in the database, raid moddability, and slot requirements.
|
* Populate a Map object of items for quick lookup by their ID.
|
||||||
*
|
*
|
||||||
* @param item The item to be filtered.
|
* @param insured The insurance object containing the items to populate the map with.
|
||||||
* @param parentItemDbDetails The database details of the parent item, or null if the item has no parent.
|
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
|
||||||
* @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database,
|
|
||||||
* and the second element is the item details if it does.
|
|
||||||
* @returns true if the item exists in the database and neither of the following conditions are met:
|
|
||||||
* - The item has the RaidModdable property set to false.
|
|
||||||
* - The item is attached to a required slot in its parent item.
|
|
||||||
* Otherwise, returns false.
|
|
||||||
*/
|
*/
|
||||||
protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean;
|
protected populateItemsMap(insured: Insurance): Map<string, Item>;
|
||||||
/**
|
/**
|
||||||
* Determines if an item is either a base item or a child item that is not equipped to its parent.
|
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
|
||||||
|
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
|
||||||
|
* not the backpack that the gun is located in (the gun's parent).
|
||||||
*
|
*
|
||||||
* @param item The item to check.
|
* @param insured - The insurance object containing the items to evaluate.
|
||||||
* @returns true if the item is a base or an independent child item, otherwise false.
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
*/
|
*/
|
||||||
protected isBaseOrIndependentChild(item: Item): boolean;
|
protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
/**
|
/**
|
||||||
* Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added
|
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
|
||||||
* to the `toDelete` array.
|
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
|
||||||
|
* they (and their attached, attachments, if any) are marked for deletion in the toDelete Set.
|
||||||
*
|
*
|
||||||
* @param item The item for which the roll is made.
|
* @param insured The insurance object containing the items to evaluate.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* @param toDelete A Set to keep track of items marked for deletion.
|
||||||
* @param toDelete The array accumulating the IDs of items to be deleted.
|
|
||||||
* @returns true if the item is marked for deletion, otherwise false.
|
|
||||||
*/
|
|
||||||
protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set<string>): boolean;
|
|
||||||
/**
|
|
||||||
* Groups child items by their parent IDs in a Map data structure.
|
|
||||||
*
|
|
||||||
* @param item The child item to be grouped by its parent.
|
|
||||||
* @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs.
|
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map<string, Item[]>): void;
|
protected processRegularItems(insured: Insurance, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to
|
* Process parent items and their attachments, updating the toDelete Set accordingly.
|
||||||
* determine if it should be deleted. The method then deletes the most valuable children based on the number of
|
|
||||||
* successful rolls made.
|
|
||||||
*
|
*
|
||||||
* @param children The array of children items to sort and filter.
|
* This method iterates over a map of parent items to their attachments and performs evaluations on each.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* It marks items for deletion based on certain conditions and updates the toDelete Set accordingly.
|
||||||
|
*
|
||||||
|
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap A Map object for quick item look-up by item ID.
|
||||||
|
* @param traderId The trader ID from the Insurance object.
|
||||||
|
* @param toDelete A Set object to keep track of items marked for deletion.
|
||||||
|
*/
|
||||||
|
protected processAttachments(mainParentToAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>, traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by
|
||||||
|
* their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the
|
||||||
|
* number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most
|
||||||
|
* valuable attachments first.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items to sort, filter, and roll.
|
||||||
|
* @param traderId The ID of the trader to that has ensured these items.
|
||||||
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set<string>): void;
|
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Sorts the attachment items by their max price in descending order.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachments items.
|
||||||
|
* @returns An array of items enriched with their max price and common locale-name.
|
||||||
|
*/
|
||||||
|
protected sortAttachmentsByPrice(attachments: Item[]): EnrichedItem[];
|
||||||
|
/**
|
||||||
|
* Logs the details of each attachment item.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
*/
|
||||||
|
protected logAttachmentsDetails(attachments: EnrichedItem[]): void;
|
||||||
|
/**
|
||||||
|
* Counts the number of successful rolls for the attachment items.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param traderId The ID of the trader that has insured these attachments.
|
||||||
|
* @returns The number of successful rolls.
|
||||||
|
*/
|
||||||
|
protected countSuccessfulRolls(attachments: Item[], traderId: string): number;
|
||||||
|
/**
|
||||||
|
* Marks the most valuable attachments for deletion based on the number of successful rolls made.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param successfulRolls The number of successful rolls.
|
||||||
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
|
*/
|
||||||
|
protected attachmentDeletionByValue(attachments: EnrichedItem[], successfulRolls: number, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Remove items from the insured items that should not be returned to the player.
|
* Remove items from the insured items that should not be returned to the player.
|
||||||
*
|
*
|
||||||
@ -144,6 +168,22 @@ export declare class InsuranceController {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been
|
||||||
|
* deleted from insurance, but any insured items within the parent should remain. This method will remove the
|
||||||
|
* reference from the children to the parent and set item properties to main-level values.
|
||||||
|
*
|
||||||
|
* @param insured Insurance object containing items.
|
||||||
|
*/
|
||||||
|
protected adoptOrphanedItems(insured: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this
|
||||||
|
* method should be a reliable way to fetch it, if it ever does change.
|
||||||
|
*
|
||||||
|
* @param items Array of items to search through.
|
||||||
|
* @returns The parentId of an item with slotId 'hideout'. Empty string if not found.
|
||||||
|
*/
|
||||||
|
protected fetchHideoutItemParent(items: Item[]): string;
|
||||||
/**
|
/**
|
||||||
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
||||||
*
|
*
|
||||||
@ -154,15 +194,14 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
||||||
/**
|
/**
|
||||||
* Determines whether a valid insured item should be removed from the player's inventory based on a random roll and
|
* Determines whether a insured item should be removed from the player's inventory based on a random roll and
|
||||||
* trader-specific return chance.
|
* trader-specific return chance.
|
||||||
*
|
*
|
||||||
* @param insuredItem The insured item being evaluated for removal.
|
|
||||||
* @param traderId The ID of the trader who insured the item.
|
* @param traderId The ID of the trader who insured the item.
|
||||||
* @param itemsBeingDeleted List of items that are already slated for removal.
|
* @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.
|
* @returns true if the insured item should be removed from inventory, false otherwise.
|
||||||
*/
|
*/
|
||||||
protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set<string>): boolean;
|
protected rollForDelete(traderId: string, insuredItem?: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Handle Insure event
|
* Handle Insure event
|
||||||
* Add insurance to an item
|
* Add insurance to an item
|
||||||
@ -183,3 +222,8 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
||||||
}
|
}
|
||||||
|
interface EnrichedItem extends Item {
|
||||||
|
name: string;
|
||||||
|
maxPrice: number;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export declare class Serializer {
|
export declare class Serializer {
|
||||||
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
||||||
canHandle(something: string): boolean;
|
canHandle(something: string): boolean;
|
||||||
|
@ -225,6 +225,48 @@ declare class ItemHelper {
|
|||||||
* @returns true if item is flagged as quest item
|
* @returns true if item is flagged as quest item
|
||||||
*/
|
*/
|
||||||
isQuestItem(tpl: string): boolean;
|
isQuestItem(tpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the
|
||||||
|
* parent items existence in the database, the existence (and value) of the items RaidModdable property, and that
|
||||||
|
* the parents slot-required property exists, matches that of the item, and it's value.
|
||||||
|
*
|
||||||
|
* Note: this function does not preform any checks to see if the item and parent are *actually* related.
|
||||||
|
*
|
||||||
|
* @param item The item to be checked
|
||||||
|
* @param parent The parent of the item to be checked
|
||||||
|
* @returns True if the item is actually moddable, false if it is not, and null if the check cannot be performed.
|
||||||
|
*/
|
||||||
|
isRaidModdable(item: Item, parent: Item): boolean | null;
|
||||||
|
/**
|
||||||
|
* Retrieves the main parent item for a given attachment item.
|
||||||
|
*
|
||||||
|
* This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent
|
||||||
|
* item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it
|
||||||
|
* will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately
|
||||||
|
* attached to, even if that gun is located within multiple containers.
|
||||||
|
*
|
||||||
|
* It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items
|
||||||
|
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
|
||||||
|
* some of the performance concerns, as it allows for quick lookups of items by ID.
|
||||||
|
*
|
||||||
|
* To generate the map:
|
||||||
|
* ```
|
||||||
|
* const itemsMap = new Map<string, Item>();
|
||||||
|
* items.forEach(item => itemsMap.set(item._id, item));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param itemId - The unique identifier of the item for which to find the main parent.
|
||||||
|
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
|
||||||
|
* @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists.
|
||||||
|
*/
|
||||||
|
getAttachmentMainParent(itemId: string, itemsMap: Map<string, Item>): Item | null;
|
||||||
|
/**
|
||||||
|
* Determines if an item is an attachment that is currently attached to it's parent item.
|
||||||
|
*
|
||||||
|
* @param item The item to check.
|
||||||
|
* @returns true if the item is attached attachment, otherwise false.
|
||||||
|
*/
|
||||||
|
isAttachmentAttached(item: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Get the inventory size of an item
|
* Get the inventory size of an item
|
||||||
* @param items Item with children
|
* @param items Item with children
|
||||||
|
@ -66,6 +66,10 @@ export declare class PreAkiModLoader implements IModLoader {
|
|||||||
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
||||||
protected executeMods(container: DependencyContainer): Promise<void>;
|
protected executeMods(container: DependencyContainer): Promise<void>;
|
||||||
sortModsLoadOrder(): string[];
|
sortModsLoadOrder(): string[];
|
||||||
|
/**
|
||||||
|
* Compile mod and add into class property "imported"
|
||||||
|
* @param mod Name of mod to compile/add
|
||||||
|
*/
|
||||||
protected addMod(mod: string): Promise<void>;
|
protected addMod(mod: string): Promise<void>;
|
||||||
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
||||||
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
||||||
/**
|
/**
|
||||||
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
||||||
|
@ -6,6 +6,9 @@ export interface IPackageJsonData {
|
|||||||
author: string;
|
author: string;
|
||||||
version: string;
|
version: string;
|
||||||
akiVersion: string;
|
akiVersion: string;
|
||||||
|
/** We deliberately purge this data */
|
||||||
|
scripts: Record<string, string>;
|
||||||
|
devDependencies: Record<string, string>;
|
||||||
licence: string;
|
licence: string;
|
||||||
main: string;
|
main: string;
|
||||||
isBundleMod: boolean;
|
isBundleMod: boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage } from "http";
|
import { IncomingMessage } from "node:http";
|
||||||
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
||||||
export declare class HttpRouter {
|
export declare class HttpRouter {
|
||||||
protected staticRouters: StaticRouter[];
|
protected staticRouters: StaticRouter[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
||||||
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
||||||
import { VFS } from "../utils/VFS";
|
import { VFS } from "../utils/VFS";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { BundleLoader } from "../../loaders/BundleLoader";
|
import { BundleLoader } from "../../loaders/BundleLoader";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ImageRouter } from "../ImageRouter";
|
import { ImageRouter } from "../ImageRouter";
|
||||||
export declare class ImageSerializer extends Serializer {
|
export declare class ImageSerializer extends Serializer {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { NotifierController } from "../../controllers/NotifierController";
|
import { NotifierController } from "../../controllers/NotifierController";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage, ServerResponse } from "http";
|
import http, { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ApplicationContext } from "../context/ApplicationContext";
|
import { ApplicationContext } from "../context/ApplicationContext";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage } from "http";
|
import http, { IncomingMessage } from "node:http";
|
||||||
import WebSocket from "ws";
|
import WebSocket from "ws";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { INotification } from "../models/eft/notifier/INotifier";
|
import { INotification } from "../models/eft/notifier/INotifier";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
import { HttpRouter } from "../../routers/HttpRouter";
|
import { HttpRouter } from "../../routers/HttpRouter";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export interface IHttpListener {
|
export interface IHttpListener {
|
||||||
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
||||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
||||||
export declare class HttpListenerMod implements IHttpListener {
|
export declare class HttpListenerMod implements IHttpListener {
|
||||||
private canHandleOverride;
|
private canHandleOverride;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
export declare class HttpListenerModService {
|
export declare class HttpListenerModService {
|
||||||
protected container: DependencyContainer;
|
protected container: DependencyContainer;
|
||||||
|
@ -12,7 +12,6 @@ export declare class App {
|
|||||||
protected onLoadComponents: OnLoad[];
|
protected onLoadComponents: OnLoad[];
|
||||||
protected onUpdateComponents: OnUpdate[];
|
protected onUpdateComponents: OnUpdate[];
|
||||||
protected onUpdateLastRun: {};
|
protected onUpdateLastRun: {};
|
||||||
protected os: any;
|
|
||||||
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
||||||
load(): Promise<void>;
|
load(): Promise<void>;
|
||||||
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import crypto from "crypto";
|
import crypto from "node:crypto";
|
||||||
import { TimeUtil } from "./TimeUtil";
|
import { TimeUtil } from "./TimeUtil";
|
||||||
export declare class HashUtil {
|
export declare class HashUtil {
|
||||||
protected timeUtil: TimeUtil;
|
protected timeUtil: TimeUtil;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { ServerResponse } from "http";
|
import { ServerResponse } from "node:http";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
export declare class HttpFileUtil {
|
export declare class HttpFileUtil {
|
||||||
protected httpServerHelper: HttpServerHelper;
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
||||||
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
||||||
|
@ -4,12 +4,10 @@ import { ConfigServer } from "../servers/ConfigServer";
|
|||||||
import { LocalisationService } from "../services/LocalisationService";
|
import { LocalisationService } from "../services/LocalisationService";
|
||||||
export declare class WatermarkLocale {
|
export declare class WatermarkLocale {
|
||||||
protected localisationService: LocalisationService;
|
protected localisationService: LocalisationService;
|
||||||
|
protected description: string[];
|
||||||
|
protected warning: string[];
|
||||||
|
protected modding: string[];
|
||||||
constructor(localisationService: LocalisationService);
|
constructor(localisationService: LocalisationService);
|
||||||
protected watermark: {
|
|
||||||
description: string[];
|
|
||||||
warning: string[];
|
|
||||||
modding: string[];
|
|
||||||
};
|
|
||||||
getDescription(): string[];
|
getDescription(): string[];
|
||||||
getWarning(): string[];
|
getWarning(): string[];
|
||||||
getModding(): string[];
|
getModding(): string[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
||||||
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
||||||
|
@ -49,7 +49,6 @@ export declare class GameController {
|
|||||||
protected giftService: GiftService;
|
protected giftService: GiftService;
|
||||||
protected applicationContext: ApplicationContext;
|
protected applicationContext: ApplicationContext;
|
||||||
protected configServer: ConfigServer;
|
protected configServer: ConfigServer;
|
||||||
protected os: any;
|
|
||||||
protected httpConfig: IHttpConfig;
|
protected httpConfig: IHttpConfig;
|
||||||
protected coreConfig: ICoreConfig;
|
protected coreConfig: ICoreConfig;
|
||||||
protected locationConfig: ILocationConfig;
|
protected locationConfig: ILocationConfig;
|
||||||
|
@ -4,7 +4,6 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
|
|||||||
import { TraderHelper } from "../helpers/TraderHelper";
|
import { TraderHelper } from "../helpers/TraderHelper";
|
||||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||||
import { Item } from "../models/eft/common/tables/IItem";
|
import { Item } from "../models/eft/common/tables/IItem";
|
||||||
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
|
|
||||||
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
||||||
@ -75,67 +74,92 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
||||||
/**
|
/**
|
||||||
* Build an array of items to delete from the insured items.
|
* Finds the items that should be deleted based on the given Insurance object.
|
||||||
*
|
*
|
||||||
* This method orchestrates several steps:
|
* @param insured The insurance object containing the items to evaluate for deletion.
|
||||||
* - Filters items based on their presence in the database and their raid moddability.
|
* @returns A Set containing the IDs of items that should be deleted.
|
||||||
* - Sorts base and independent child items to consider for deletion.
|
|
||||||
* - Groups child items by their parent for later evaluation.
|
|
||||||
* - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll.
|
|
||||||
*
|
|
||||||
* @param insured - The insured items to build a removal array from.
|
|
||||||
* @returns An array of IDs representing items that should be deleted.
|
|
||||||
*/
|
*/
|
||||||
protected findItemsToDelete(insured: Insurance): Set<string>;
|
protected findItemsToDelete(insured: Insurance): Set<string>;
|
||||||
/**
|
/**
|
||||||
* Filters an item based on its existence in the database, raid moddability, and slot requirements.
|
* Populate a Map object of items for quick lookup by their ID.
|
||||||
*
|
*
|
||||||
* @param item The item to be filtered.
|
* @param insured The insurance object containing the items to populate the map with.
|
||||||
* @param parentItemDbDetails The database details of the parent item, or null if the item has no parent.
|
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
|
||||||
* @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database,
|
|
||||||
* and the second element is the item details if it does.
|
|
||||||
* @returns true if the item exists in the database and neither of the following conditions are met:
|
|
||||||
* - The item has the RaidModdable property set to false.
|
|
||||||
* - The item is attached to a required slot in its parent item.
|
|
||||||
* Otherwise, returns false.
|
|
||||||
*/
|
*/
|
||||||
protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean;
|
protected populateItemsMap(insured: Insurance): Map<string, Item>;
|
||||||
/**
|
/**
|
||||||
* Determines if an item is either a base item or a child item that is not equipped to its parent.
|
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
|
||||||
|
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
|
||||||
|
* not the backpack that the gun is located in (the gun's parent).
|
||||||
*
|
*
|
||||||
* @param item The item to check.
|
* @param insured - The insurance object containing the items to evaluate.
|
||||||
* @returns true if the item is a base or an independent child item, otherwise false.
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
*/
|
*/
|
||||||
protected isBaseOrIndependentChild(item: Item): boolean;
|
protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
/**
|
/**
|
||||||
* Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added
|
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
|
||||||
* to the `toDelete` array.
|
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
|
||||||
|
* they (and their attached, attachments, if any) are marked for deletion in the toDelete Set.
|
||||||
*
|
*
|
||||||
* @param item The item for which the roll is made.
|
* @param insured The insurance object containing the items to evaluate.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* @param toDelete A Set to keep track of items marked for deletion.
|
||||||
* @param toDelete The array accumulating the IDs of items to be deleted.
|
|
||||||
* @returns true if the item is marked for deletion, otherwise false.
|
|
||||||
*/
|
|
||||||
protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set<string>): boolean;
|
|
||||||
/**
|
|
||||||
* Groups child items by their parent IDs in a Map data structure.
|
|
||||||
*
|
|
||||||
* @param item The child item to be grouped by its parent.
|
|
||||||
* @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs.
|
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map<string, Item[]>): void;
|
protected processRegularItems(insured: Insurance, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to
|
* Process parent items and their attachments, updating the toDelete Set accordingly.
|
||||||
* determine if it should be deleted. The method then deletes the most valuable children based on the number of
|
|
||||||
* successful rolls made.
|
|
||||||
*
|
*
|
||||||
* @param children The array of children items to sort and filter.
|
* This method iterates over a map of parent items to their attachments and performs evaluations on each.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* It marks items for deletion based on certain conditions and updates the toDelete Set accordingly.
|
||||||
|
*
|
||||||
|
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap A Map object for quick item look-up by item ID.
|
||||||
|
* @param traderId The trader ID from the Insurance object.
|
||||||
|
* @param toDelete A Set object to keep track of items marked for deletion.
|
||||||
|
*/
|
||||||
|
protected processAttachments(mainParentToAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>, traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by
|
||||||
|
* their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the
|
||||||
|
* number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most
|
||||||
|
* valuable attachments first.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items to sort, filter, and roll.
|
||||||
|
* @param traderId The ID of the trader to that has ensured these items.
|
||||||
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set<string>): void;
|
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Sorts the attachment items by their max price in descending order.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachments items.
|
||||||
|
* @returns An array of items enriched with their max price and common locale-name.
|
||||||
|
*/
|
||||||
|
protected sortAttachmentsByPrice(attachments: Item[]): EnrichedItem[];
|
||||||
|
/**
|
||||||
|
* Logs the details of each attachment item.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
*/
|
||||||
|
protected logAttachmentsDetails(attachments: EnrichedItem[]): void;
|
||||||
|
/**
|
||||||
|
* Counts the number of successful rolls for the attachment items.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param traderId The ID of the trader that has insured these attachments.
|
||||||
|
* @returns The number of successful rolls.
|
||||||
|
*/
|
||||||
|
protected countSuccessfulRolls(attachments: Item[], traderId: string): number;
|
||||||
|
/**
|
||||||
|
* Marks the most valuable attachments for deletion based on the number of successful rolls made.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param successfulRolls The number of successful rolls.
|
||||||
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
|
*/
|
||||||
|
protected attachmentDeletionByValue(attachments: EnrichedItem[], successfulRolls: number, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Remove items from the insured items that should not be returned to the player.
|
* Remove items from the insured items that should not be returned to the player.
|
||||||
*
|
*
|
||||||
@ -144,6 +168,22 @@ export declare class InsuranceController {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been
|
||||||
|
* deleted from insurance, but any insured items within the parent should remain. This method will remove the
|
||||||
|
* reference from the children to the parent and set item properties to main-level values.
|
||||||
|
*
|
||||||
|
* @param insured Insurance object containing items.
|
||||||
|
*/
|
||||||
|
protected adoptOrphanedItems(insured: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this
|
||||||
|
* method should be a reliable way to fetch it, if it ever does change.
|
||||||
|
*
|
||||||
|
* @param items Array of items to search through.
|
||||||
|
* @returns The parentId of an item with slotId 'hideout'. Empty string if not found.
|
||||||
|
*/
|
||||||
|
protected fetchHideoutItemParent(items: Item[]): string;
|
||||||
/**
|
/**
|
||||||
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
||||||
*
|
*
|
||||||
@ -154,15 +194,14 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
||||||
/**
|
/**
|
||||||
* Determines whether a valid insured item should be removed from the player's inventory based on a random roll and
|
* Determines whether a insured item should be removed from the player's inventory based on a random roll and
|
||||||
* trader-specific return chance.
|
* trader-specific return chance.
|
||||||
*
|
*
|
||||||
* @param insuredItem The insured item being evaluated for removal.
|
|
||||||
* @param traderId The ID of the trader who insured the item.
|
* @param traderId The ID of the trader who insured the item.
|
||||||
* @param itemsBeingDeleted List of items that are already slated for removal.
|
* @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.
|
* @returns true if the insured item should be removed from inventory, false otherwise.
|
||||||
*/
|
*/
|
||||||
protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set<string>): boolean;
|
protected rollForDelete(traderId: string, insuredItem?: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Handle Insure event
|
* Handle Insure event
|
||||||
* Add insurance to an item
|
* Add insurance to an item
|
||||||
@ -183,3 +222,8 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
||||||
}
|
}
|
||||||
|
interface EnrichedItem extends Item {
|
||||||
|
name: string;
|
||||||
|
maxPrice: number;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export declare class Serializer {
|
export declare class Serializer {
|
||||||
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
||||||
canHandle(something: string): boolean;
|
canHandle(something: string): boolean;
|
||||||
|
@ -225,6 +225,48 @@ declare class ItemHelper {
|
|||||||
* @returns true if item is flagged as quest item
|
* @returns true if item is flagged as quest item
|
||||||
*/
|
*/
|
||||||
isQuestItem(tpl: string): boolean;
|
isQuestItem(tpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the
|
||||||
|
* parent items existence in the database, the existence (and value) of the items RaidModdable property, and that
|
||||||
|
* the parents slot-required property exists, matches that of the item, and it's value.
|
||||||
|
*
|
||||||
|
* Note: this function does not preform any checks to see if the item and parent are *actually* related.
|
||||||
|
*
|
||||||
|
* @param item The item to be checked
|
||||||
|
* @param parent The parent of the item to be checked
|
||||||
|
* @returns True if the item is actually moddable, false if it is not, and null if the check cannot be performed.
|
||||||
|
*/
|
||||||
|
isRaidModdable(item: Item, parent: Item): boolean | null;
|
||||||
|
/**
|
||||||
|
* Retrieves the main parent item for a given attachment item.
|
||||||
|
*
|
||||||
|
* This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent
|
||||||
|
* item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it
|
||||||
|
* will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately
|
||||||
|
* attached to, even if that gun is located within multiple containers.
|
||||||
|
*
|
||||||
|
* It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items
|
||||||
|
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
|
||||||
|
* some of the performance concerns, as it allows for quick lookups of items by ID.
|
||||||
|
*
|
||||||
|
* To generate the map:
|
||||||
|
* ```
|
||||||
|
* const itemsMap = new Map<string, Item>();
|
||||||
|
* items.forEach(item => itemsMap.set(item._id, item));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param itemId - The unique identifier of the item for which to find the main parent.
|
||||||
|
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
|
||||||
|
* @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists.
|
||||||
|
*/
|
||||||
|
getAttachmentMainParent(itemId: string, itemsMap: Map<string, Item>): Item | null;
|
||||||
|
/**
|
||||||
|
* Determines if an item is an attachment that is currently attached to it's parent item.
|
||||||
|
*
|
||||||
|
* @param item The item to check.
|
||||||
|
* @returns true if the item is attached attachment, otherwise false.
|
||||||
|
*/
|
||||||
|
isAttachmentAttached(item: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Get the inventory size of an item
|
* Get the inventory size of an item
|
||||||
* @param items Item with children
|
* @param items Item with children
|
||||||
|
@ -66,6 +66,10 @@ export declare class PreAkiModLoader implements IModLoader {
|
|||||||
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
|
||||||
protected executeMods(container: DependencyContainer): Promise<void>;
|
protected executeMods(container: DependencyContainer): Promise<void>;
|
||||||
sortModsLoadOrder(): string[];
|
sortModsLoadOrder(): string[];
|
||||||
|
/**
|
||||||
|
* Compile mod and add into class property "imported"
|
||||||
|
* @param mod Name of mod to compile/add
|
||||||
|
*/
|
||||||
protected addMod(mod: string): Promise<void>;
|
protected addMod(mod: string): Promise<void>;
|
||||||
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void;
|
||||||
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
|
||||||
/**
|
/**
|
||||||
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
* Associates handlers, HTTP methods and a base url to a listener using a proxy
|
||||||
|
@ -6,6 +6,9 @@ export interface IPackageJsonData {
|
|||||||
author: string;
|
author: string;
|
||||||
version: string;
|
version: string;
|
||||||
akiVersion: string;
|
akiVersion: string;
|
||||||
|
/** We deliberately purge this data */
|
||||||
|
scripts: Record<string, string>;
|
||||||
|
devDependencies: Record<string, string>;
|
||||||
licence: string;
|
licence: string;
|
||||||
main: string;
|
main: string;
|
||||||
isBundleMod: boolean;
|
isBundleMod: boolean;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage } from "http";
|
import { IncomingMessage } from "node:http";
|
||||||
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
import { DynamicRouter, Router, StaticRouter } from "../di/Router";
|
||||||
export declare class HttpRouter {
|
export declare class HttpRouter {
|
||||||
protected staticRouters: StaticRouter[];
|
protected staticRouters: StaticRouter[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
|
||||||
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
import { HttpFileUtil } from "../utils/HttpFileUtil";
|
||||||
import { VFS } from "../utils/VFS";
|
import { VFS } from "../utils/VFS";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { BundleLoader } from "../../loaders/BundleLoader";
|
import { BundleLoader } from "../../loaders/BundleLoader";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ImageRouter } from "../ImageRouter";
|
import { ImageRouter } from "../ImageRouter";
|
||||||
export declare class ImageSerializer extends Serializer {
|
export declare class ImageSerializer extends Serializer {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { NotifierController } from "../../controllers/NotifierController";
|
import { NotifierController } from "../../controllers/NotifierController";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage, ServerResponse } from "http";
|
import http, { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { ApplicationContext } from "../context/ApplicationContext";
|
import { ApplicationContext } from "../context/ApplicationContext";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import http, { IncomingMessage } from "http";
|
import http, { IncomingMessage } from "node:http";
|
||||||
import WebSocket from "ws";
|
import WebSocket from "ws";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
import { INotification } from "../models/eft/notifier/INotifier";
|
import { INotification } from "../models/eft/notifier/INotifier";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { Serializer } from "../../di/Serializer";
|
import { Serializer } from "../../di/Serializer";
|
||||||
import { ILogger } from "../../models/spt/utils/ILogger";
|
import { ILogger } from "../../models/spt/utils/ILogger";
|
||||||
import { HttpRouter } from "../../routers/HttpRouter";
|
import { HttpRouter } from "../../routers/HttpRouter";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export interface IHttpListener {
|
export interface IHttpListener {
|
||||||
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
||||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
import { IHttpListener } from "../../../servers/http/IHttpListener";
|
||||||
export declare class HttpListenerMod implements IHttpListener {
|
export declare class HttpListenerMod implements IHttpListener {
|
||||||
private canHandleOverride;
|
private canHandleOverride;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
export declare class HttpListenerModService {
|
export declare class HttpListenerModService {
|
||||||
protected container: DependencyContainer;
|
protected container: DependencyContainer;
|
||||||
|
1
TypeScript/13AddTrader/types/utils/App.d.ts
vendored
1
TypeScript/13AddTrader/types/utils/App.d.ts
vendored
@ -12,7 +12,6 @@ export declare class App {
|
|||||||
protected onLoadComponents: OnLoad[];
|
protected onLoadComponents: OnLoad[];
|
||||||
protected onUpdateComponents: OnUpdate[];
|
protected onUpdateComponents: OnUpdate[];
|
||||||
protected onUpdateLastRun: {};
|
protected onUpdateLastRun: {};
|
||||||
protected os: any;
|
|
||||||
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
|
||||||
load(): Promise<void>;
|
load(): Promise<void>;
|
||||||
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import crypto from "crypto";
|
import crypto from "node:crypto";
|
||||||
import { TimeUtil } from "./TimeUtil";
|
import { TimeUtil } from "./TimeUtil";
|
||||||
export declare class HashUtil {
|
export declare class HashUtil {
|
||||||
protected timeUtil: TimeUtil;
|
protected timeUtil: TimeUtil;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { ServerResponse } from "http";
|
import { ServerResponse } from "node:http";
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
export declare class HttpFileUtil {
|
export declare class HttpFileUtil {
|
||||||
protected httpServerHelper: HttpServerHelper;
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
2
TypeScript/13AddTrader/types/utils/VFS.d.ts
vendored
2
TypeScript/13AddTrader/types/utils/VFS.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
|
||||||
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";
|
||||||
|
@ -4,12 +4,10 @@ import { ConfigServer } from "../servers/ConfigServer";
|
|||||||
import { LocalisationService } from "../services/LocalisationService";
|
import { LocalisationService } from "../services/LocalisationService";
|
||||||
export declare class WatermarkLocale {
|
export declare class WatermarkLocale {
|
||||||
protected localisationService: LocalisationService;
|
protected localisationService: LocalisationService;
|
||||||
|
protected description: string[];
|
||||||
|
protected warning: string[];
|
||||||
|
protected modding: string[];
|
||||||
constructor(localisationService: LocalisationService);
|
constructor(localisationService: LocalisationService);
|
||||||
protected watermark: {
|
|
||||||
description: string[];
|
|
||||||
warning: string[];
|
|
||||||
modding: string[];
|
|
||||||
};
|
|
||||||
getDescription(): string[];
|
getDescription(): string[];
|
||||||
getWarning(): string[];
|
getWarning(): string[];
|
||||||
getModding(): string[];
|
getModding(): string[];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
import { Daum } from "../../models/eft/itemEvent/IItemEventRouterRequest";
|
||||||
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
import { LogBackgroundColor } from "../../models/spt/logging/LogBackgroundColor";
|
||||||
|
@ -49,7 +49,6 @@ export declare class GameController {
|
|||||||
protected giftService: GiftService;
|
protected giftService: GiftService;
|
||||||
protected applicationContext: ApplicationContext;
|
protected applicationContext: ApplicationContext;
|
||||||
protected configServer: ConfigServer;
|
protected configServer: ConfigServer;
|
||||||
protected os: any;
|
|
||||||
protected httpConfig: IHttpConfig;
|
protected httpConfig: IHttpConfig;
|
||||||
protected coreConfig: ICoreConfig;
|
protected coreConfig: ICoreConfig;
|
||||||
protected locationConfig: ILocationConfig;
|
protected locationConfig: ILocationConfig;
|
||||||
|
@ -4,7 +4,6 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
|
|||||||
import { TraderHelper } from "../helpers/TraderHelper";
|
import { TraderHelper } from "../helpers/TraderHelper";
|
||||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||||
import { Item } from "../models/eft/common/tables/IItem";
|
import { Item } from "../models/eft/common/tables/IItem";
|
||||||
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
|
|
||||||
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData";
|
||||||
@ -75,67 +74,92 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
|
||||||
/**
|
/**
|
||||||
* Build an array of items to delete from the insured items.
|
* Finds the items that should be deleted based on the given Insurance object.
|
||||||
*
|
*
|
||||||
* This method orchestrates several steps:
|
* @param insured The insurance object containing the items to evaluate for deletion.
|
||||||
* - Filters items based on their presence in the database and their raid moddability.
|
* @returns A Set containing the IDs of items that should be deleted.
|
||||||
* - Sorts base and independent child items to consider for deletion.
|
|
||||||
* - Groups child items by their parent for later evaluation.
|
|
||||||
* - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll.
|
|
||||||
*
|
|
||||||
* @param insured - The insured items to build a removal array from.
|
|
||||||
* @returns An array of IDs representing items that should be deleted.
|
|
||||||
*/
|
*/
|
||||||
protected findItemsToDelete(insured: Insurance): Set<string>;
|
protected findItemsToDelete(insured: Insurance): Set<string>;
|
||||||
/**
|
/**
|
||||||
* Filters an item based on its existence in the database, raid moddability, and slot requirements.
|
* Populate a Map object of items for quick lookup by their ID.
|
||||||
*
|
*
|
||||||
* @param item The item to be filtered.
|
* @param insured The insurance object containing the items to populate the map with.
|
||||||
* @param parentItemDbDetails The database details of the parent item, or null if the item has no parent.
|
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
|
||||||
* @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database,
|
|
||||||
* and the second element is the item details if it does.
|
|
||||||
* @returns true if the item exists in the database and neither of the following conditions are met:
|
|
||||||
* - The item has the RaidModdable property set to false.
|
|
||||||
* - The item is attached to a required slot in its parent item.
|
|
||||||
* Otherwise, returns false.
|
|
||||||
*/
|
*/
|
||||||
protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean;
|
protected populateItemsMap(insured: Insurance): Map<string, Item>;
|
||||||
/**
|
/**
|
||||||
* Determines if an item is either a base item or a child item that is not equipped to its parent.
|
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
|
||||||
|
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
|
||||||
|
* not the backpack that the gun is located in (the gun's parent).
|
||||||
*
|
*
|
||||||
* @param item The item to check.
|
* @param insured - The insurance object containing the items to evaluate.
|
||||||
* @returns true if the item is a base or an independent child item, otherwise false.
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
*/
|
*/
|
||||||
protected isBaseOrIndependentChild(item: Item): boolean;
|
protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
/**
|
/**
|
||||||
* Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added
|
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
|
||||||
* to the `toDelete` array.
|
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
|
||||||
|
* they (and their attached, attachments, if any) are marked for deletion in the toDelete Set.
|
||||||
*
|
*
|
||||||
* @param item The item for which the roll is made.
|
* @param insured The insurance object containing the items to evaluate.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* @param toDelete A Set to keep track of items marked for deletion.
|
||||||
* @param toDelete The array accumulating the IDs of items to be deleted.
|
|
||||||
* @returns true if the item is marked for deletion, otherwise false.
|
|
||||||
*/
|
|
||||||
protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set<string>): boolean;
|
|
||||||
/**
|
|
||||||
* Groups child items by their parent IDs in a Map data structure.
|
|
||||||
*
|
|
||||||
* @param item The child item to be grouped by its parent.
|
|
||||||
* @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs.
|
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map<string, Item[]>): void;
|
protected processRegularItems(insured: Insurance, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to
|
* Process parent items and their attachments, updating the toDelete Set accordingly.
|
||||||
* determine if it should be deleted. The method then deletes the most valuable children based on the number of
|
|
||||||
* successful rolls made.
|
|
||||||
*
|
*
|
||||||
* @param children The array of children items to sort and filter.
|
* This method iterates over a map of parent items to their attachments and performs evaluations on each.
|
||||||
* @param traderId The ID of the trader to consider in the rollForItemDelete method.
|
* It marks items for deletion based on certain conditions and updates the toDelete Set accordingly.
|
||||||
|
*
|
||||||
|
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap A Map object for quick item look-up by item ID.
|
||||||
|
* @param traderId The trader ID from the Insurance object.
|
||||||
|
* @param toDelete A Set object to keep track of items marked for deletion.
|
||||||
|
*/
|
||||||
|
protected processAttachments(mainParentToAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>, traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by
|
||||||
|
* their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the
|
||||||
|
* number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most
|
||||||
|
* valuable attachments first.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items to sort, filter, and roll.
|
||||||
|
* @param traderId The ID of the trader to that has ensured these items.
|
||||||
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set<string>): void;
|
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Sorts the attachment items by their max price in descending order.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachments items.
|
||||||
|
* @returns An array of items enriched with their max price and common locale-name.
|
||||||
|
*/
|
||||||
|
protected sortAttachmentsByPrice(attachments: Item[]): EnrichedItem[];
|
||||||
|
/**
|
||||||
|
* Logs the details of each attachment item.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
*/
|
||||||
|
protected logAttachmentsDetails(attachments: EnrichedItem[]): void;
|
||||||
|
/**
|
||||||
|
* Counts the number of successful rolls for the attachment items.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param traderId The ID of the trader that has insured these attachments.
|
||||||
|
* @returns The number of successful rolls.
|
||||||
|
*/
|
||||||
|
protected countSuccessfulRolls(attachments: Item[], traderId: string): number;
|
||||||
|
/**
|
||||||
|
* Marks the most valuable attachments for deletion based on the number of successful rolls made.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items.
|
||||||
|
* @param successfulRolls The number of successful rolls.
|
||||||
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
|
*/
|
||||||
|
protected attachmentDeletionByValue(attachments: EnrichedItem[], successfulRolls: number, toDelete: Set<string>): void;
|
||||||
/**
|
/**
|
||||||
* Remove items from the insured items that should not be returned to the player.
|
* Remove items from the insured items that should not be returned to the player.
|
||||||
*
|
*
|
||||||
@ -144,6 +168,22 @@ export declare class InsuranceController {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been
|
||||||
|
* deleted from insurance, but any insured items within the parent should remain. This method will remove the
|
||||||
|
* reference from the children to the parent and set item properties to main-level values.
|
||||||
|
*
|
||||||
|
* @param insured Insurance object containing items.
|
||||||
|
*/
|
||||||
|
protected adoptOrphanedItems(insured: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this
|
||||||
|
* method should be a reliable way to fetch it, if it ever does change.
|
||||||
|
*
|
||||||
|
* @param items Array of items to search through.
|
||||||
|
* @returns The parentId of an item with slotId 'hideout'. Empty string if not found.
|
||||||
|
*/
|
||||||
|
protected fetchHideoutItemParent(items: Item[]): string;
|
||||||
/**
|
/**
|
||||||
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
||||||
*
|
*
|
||||||
@ -154,15 +194,14 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
|
||||||
/**
|
/**
|
||||||
* Determines whether a valid insured item should be removed from the player's inventory based on a random roll and
|
* Determines whether a insured item should be removed from the player's inventory based on a random roll and
|
||||||
* trader-specific return chance.
|
* trader-specific return chance.
|
||||||
*
|
*
|
||||||
* @param insuredItem The insured item being evaluated for removal.
|
|
||||||
* @param traderId The ID of the trader who insured the item.
|
* @param traderId The ID of the trader who insured the item.
|
||||||
* @param itemsBeingDeleted List of items that are already slated for removal.
|
* @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.
|
* @returns true if the insured item should be removed from inventory, false otherwise.
|
||||||
*/
|
*/
|
||||||
protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set<string>): boolean;
|
protected rollForDelete(traderId: string, insuredItem?: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Handle Insure event
|
* Handle Insure event
|
||||||
* Add insurance to an item
|
* Add insurance to an item
|
||||||
@ -183,3 +222,8 @@ export declare class InsuranceController {
|
|||||||
*/
|
*/
|
||||||
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
||||||
}
|
}
|
||||||
|
interface EnrichedItem extends Item {
|
||||||
|
name: string;
|
||||||
|
maxPrice: number;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
export declare class Serializer {
|
export declare class Serializer {
|
||||||
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
||||||
canHandle(something: string): boolean;
|
canHandle(something: string): boolean;
|
||||||
|
@ -225,6 +225,48 @@ declare class ItemHelper {
|
|||||||
* @returns true if item is flagged as quest item
|
* @returns true if item is flagged as quest item
|
||||||
*/
|
*/
|
||||||
isQuestItem(tpl: string): boolean;
|
isQuestItem(tpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the
|
||||||
|
* parent items existence in the database, the existence (and value) of the items RaidModdable property, and that
|
||||||
|
* the parents slot-required property exists, matches that of the item, and it's value.
|
||||||
|
*
|
||||||
|
* Note: this function does not preform any checks to see if the item and parent are *actually* related.
|
||||||
|
*
|
||||||
|
* @param item The item to be checked
|
||||||
|
* @param parent The parent of the item to be checked
|
||||||
|
* @returns True if the item is actually moddable, false if it is not, and null if the check cannot be performed.
|
||||||
|
*/
|
||||||
|
isRaidModdable(item: Item, parent: Item): boolean | null;
|
||||||
|
/**
|
||||||
|
* Retrieves the main parent item for a given attachment item.
|
||||||
|
*
|
||||||
|
* This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent
|
||||||
|
* item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it
|
||||||
|
* will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately
|
||||||
|
* attached to, even if that gun is located within multiple containers.
|
||||||
|
*
|
||||||
|
* It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items
|
||||||
|
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
|
||||||
|
* some of the performance concerns, as it allows for quick lookups of items by ID.
|
||||||
|
*
|
||||||
|
* To generate the map:
|
||||||
|
* ```
|
||||||
|
* const itemsMap = new Map<string, Item>();
|
||||||
|
* items.forEach(item => itemsMap.set(item._id, item));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param itemId - The unique identifier of the item for which to find the main parent.
|
||||||
|
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
|
||||||
|
* @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists.
|
||||||
|
*/
|
||||||
|
getAttachmentMainParent(itemId: string, itemsMap: Map<string, Item>): Item | null;
|
||||||
|
/**
|
||||||
|
* Determines if an item is an attachment that is currently attached to it's parent item.
|
||||||
|
*
|
||||||
|
* @param item The item to check.
|
||||||
|
* @returns true if the item is attached attachment, otherwise false.
|
||||||
|
*/
|
||||||
|
isAttachmentAttached(item: Item): boolean;
|
||||||
/**
|
/**
|
||||||
* Get the inventory size of an item
|
* Get the inventory size of an item
|
||||||
* @param items Item with children
|
* @param items Item with children
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user