Initial release for SPT 3.9

This commit is contained in:
2024-07-20 18:08:38 +02:00
parent 7df25ba694
commit c83da69a3e
713 changed files with 34110 additions and 1 deletions

View File

@@ -0,0 +1,94 @@
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ITemplateItem, Props } from "@spt/models/eft/common/tables/ITemplateItem";
import { CreateItemResult, LocaleDetails, NewItemDetails, NewItemFromCloneDetails } from "@spt/models/spt/mod/NewItemDetails";
import { ILogger } from "@spt/models/spt/utils/ILogger";
import { DatabaseService } from "@spt/services/DatabaseService";
import { ItemBaseClassService } from "@spt/services/ItemBaseClassService";
import { ICloner } from "@spt/utils/cloners/ICloner";
import { HashUtil } from "@spt/utils/HashUtil";
export declare class CustomItemService {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseService: DatabaseService;
protected itemHelper: ItemHelper;
protected itemBaseClassService: ItemBaseClassService;
protected cloner: ICloner;
constructor(logger: ILogger, hashUtil: HashUtil, databaseService: DatabaseService, itemHelper: ItemHelper, itemBaseClassService: ItemBaseClassService, cloner: ICloner);
/**
* Create a new item from a cloned item base
* WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start
* Add to the items db
* Add to the flea market
* Add to the handbook
* Add to the locales
* @param newItemDetails Item details for the new item to be created
* @returns tplId of the new item created
*/
createItemFromClone(newItemDetails: NewItemFromCloneDetails): CreateItemResult;
/**
* Create a new item without using an existing item as a template
* Add to the items db
* Add to the flea market
* Add to the handbook
* Add to the locales
* @param newItemDetails Details on what the item to be created
* @returns CreateItemResult containing the completed items Id
*/
createItem(newItemDetails: NewItemDetails): CreateItemResult;
/**
* If the id provided is an empty string, return a randomly generated guid, otherwise return the newId parameter
* @param newId id supplied to code
* @returns item id
*/
protected getOrGenerateIdForItem(newId: string): string;
/**
* Iterates through supplied properties and updates the cloned items properties with them
* Complex objects cannot have overrides, they must be fully hydrated with values if they are to be used
* @param overrideProperties new properties to apply
* @param itemClone item to update
*/
protected updateBaseItemPropertiesWithOverrides(overrideProperties: Props, itemClone: ITemplateItem): void;
/**
* Addd a new item object to the in-memory representation of items.json
* @param newItemId id of the item to add to items.json
* @param itemToAdd Item to add against the new id
*/
protected addToItemsDb(newItemId: string, itemToAdd: ITemplateItem): void;
/**
* Add a handbook price for an item
* @param newItemId id of the item being added
* @param parentId parent id of the item being added
* @param priceRoubles price of the item being added
*/
protected addToHandbookDb(newItemId: string, parentId: string, priceRoubles: number): void;
/**
* Iterate through the passed in locale data and add to each locale in turn
* If data is not provided for each langauge eft uses, the first object will be used in its place
* e.g.
* en[0]
* fr[1]
*
* No jp provided, so english will be used as a substitute
* @param localeDetails key is language, value are the new locale details
* @param newItemId id of the item being created
*/
protected addToLocaleDbs(localeDetails: Record<string, LocaleDetails>, newItemId: string): void;
/**
* Add a price to the in-memory representation of prices.json, used to inform the flea of an items price on the market
* @param newItemId id of the new item
* @param fleaPriceRoubles Price of the new item
*/
protected addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void;
/**
* Add a weapon to the hideout weapon shelf whitelist
* @param newItemId Weapon id to add
*/
protected addToWeaponShelf(newItemId: string): void;
/**
* Add a custom weapon to PMCs loadout
* @param weaponTpl Custom weapon tpl to add to PMCs
* @param weaponWeight The weighting for the weapon to be picked vs other weapons
* @param weaponSlot The slot the weapon should be added to (e.g. FirstPrimaryWeapon/SecondPrimaryWeapon/Holster)
*/
addCustomWeaponToPMCs(weaponTpl: string, weaponWeight: number, weaponSlot: string): void;
}

View File

@@ -0,0 +1,6 @@
import { DynamicRouter, RouteAction } from "@spt/di/Router";
export declare class DynamicRouterMod extends DynamicRouter {
private topLevelRoute;
constructor(routes: RouteAction[], topLevelRoute: string);
getTopLevelRoute(): string;
}

View File

@@ -0,0 +1,7 @@
import { DependencyContainer } from "tsyringe";
import { RouteAction } from "@spt/di/Router";
export declare class DynamicRouterModService {
private container;
constructor(container: DependencyContainer);
registerDynamicRouter(name: string, routes: RouteAction[], topLevelRoute: string): void;
}

View File

@@ -0,0 +1,10 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "node:http";
import { IHttpListener } from "@spt/servers/http/IHttpListener";
export declare class HttpListenerMod implements IHttpListener {
private canHandleOverride;
private handleOverride;
constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void);
canHandle(sessionId: string, req: IncomingMessage): boolean;
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): Promise<void>;
}

View File

@@ -0,0 +1,8 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "node:http";
import { DependencyContainer } from "tsyringe";
export declare class HttpListenerModService {
protected container: DependencyContainer;
constructor(container: DependencyContainer);
registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void;
}

View File

@@ -0,0 +1,6 @@
export declare class ImageRouteService {
protected routes: Record<string, string>;
addRoute(urlKey: string, route: string): void;
getByKey(urlKey: string): string;
existsByKey(urlKey: string): boolean;
}

View File

@@ -0,0 +1,8 @@
import { OnLoad } from "@spt/di/OnLoad";
export declare class OnLoadMod implements OnLoad {
private onLoadOverride;
private getRouteOverride;
constructor(onLoadOverride: () => void, getRouteOverride: () => string);
onLoad(): Promise<void>;
getRoute(): string;
}

View File

@@ -0,0 +1,6 @@
import { DependencyContainer } from "tsyringe";
export declare class OnLoadModService {
protected container: DependencyContainer;
constructor(container: DependencyContainer);
registerOnLoad(name: string, onLoad: () => void, getRoute: () => string): void;
}

View File

@@ -0,0 +1,8 @@
import { OnUpdate } from "@spt/di/OnUpdate";
export declare class OnUpdateMod implements OnUpdate {
private onUpdateOverride;
private getRouteOverride;
constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string);
onUpdate(timeSinceLastRun: number): Promise<boolean>;
getRoute(): string;
}

View File

@@ -0,0 +1,6 @@
import { DependencyContainer } from "tsyringe";
export declare class OnUpdateModService {
protected container: DependencyContainer;
constructor(container: DependencyContainer);
registerOnUpdate(name: string, onUpdate: (timeSinceLastRun: number) => boolean, getRoute: () => string): void;
}

View File

@@ -0,0 +1,6 @@
import { RouteAction, StaticRouter } from "@spt/di/Router";
export declare class StaticRouterMod extends StaticRouter {
private topLevelRoute;
constructor(routes: RouteAction[], topLevelRoute: string);
getTopLevelRoute(): string;
}

View File

@@ -0,0 +1,7 @@
import { DependencyContainer } from "tsyringe";
import { RouteAction } from "@spt/di/Router";
export declare class StaticRouterModService {
protected container: DependencyContainer;
constructor(container: DependencyContainer);
registerStaticRouter(name: string, routes: RouteAction[], topLevelRoute: string): void;
}