Update examples for 3.2.4

This commit is contained in:
Chomp 2022-10-02 23:00:27 +01:00
parent a8ca8ecac7
commit 4af4e7e780
811 changed files with 7924 additions and 1792 deletions

View File

@ -4,20 +4,20 @@
"main": "src/mod.js",
"license": "MIT",
"author": "Chomp",
"akiVersion": "3.2.3",
"akiVersion": "3.2.4",
"scripts": {
"setup": "npm i",
"build": "node ./packageBuild.ts"
},
"devDependencies": {
"@types/node": "^14.15.3",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@types/node": "16.11.62",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/parser": "5.38.1",
"bestzip": "2.2.1",
"eslint": "7.26.0",
"fs-extra": "^10.1.0",
"glob": "^8.0.3",
"tsyringe": "4.6.0",
"typescript": "4.6.4"
"eslint": "8.24.0",
"fs-extra": "10.1.0",
"glob": "8.0.3",
"tsyringe": "4.7.0",
"typescript": "4.8.4"
}
}
}

View File

@ -0,0 +1,6 @@
export declare class ErrorHandler {
private logger;
private readLine;
constructor();
handleCriticalError(err: any): void;
}

View File

@ -1,4 +1,5 @@
export declare class Program {
private errorHandler;
constructor();
start(): void;
}

View File

@ -1,17 +1,17 @@
import { BundleLoader } from "../loaders/BundleLoader";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
export declare class BundleCallbacks {
protected logger: ILogger;
protected httpResponse: HttpResponseUtil;
protected httpServer: IHttpServer;
protected httpFileUtil: HttpFileUtil;
protected bundleLoader: BundleLoader;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer);
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer);
sendBundle(sessionID: string, req: any, resp: any, body: any): any;
getBundles(url: string, info: any, sessionID: string): string;
getBundle(url: string, info: any, sessionID: string): string;

View File

@ -1,8 +1,8 @@
import { OnLoad } from "../di/OnLoad";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { HttpServer } from "../servers/HttpServer";
export declare class HttpCallbacks extends OnLoad {
protected httpServer: IHttpServer;
constructor(httpServer: IHttpServer);
protected httpServer: HttpServer;
constructor(httpServer: HttpServer);
onLoad(): void;
getRoute(): string;
getImage(): string;

View File

@ -1,18 +1,18 @@
import { OnLoad } from "../di/OnLoad";
import { PostAkiModLoader } from "../loaders/PostAkiModLoader";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
declare class ModCallbacks extends OnLoad {
protected logger: ILogger;
protected httpResponse: HttpResponseUtil;
protected httpServer: IHttpServer;
protected httpFileUtil: HttpFileUtil;
protected postAkiModLoader: PostAkiModLoader;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer);
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer);
onLoad(): void;
getRoute(): string;
sendBundle(sessionID: string, req: any, resp: any, body: any): void;

View File

@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa
export declare class RepairCallbacks {
protected repairController: RepairController;
constructor(repairController: RepairController);
/**
* use trader to repair item
* @param pmcData
* @param body
* @param sessionID
* @returns
*/
traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
/**
* Use repair kit to repair item
* @param pmcData
* @param body
* @param sessionID
* @returns
*/
repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
}

View File

@ -1,3 +1,4 @@
import { ApplicationContext } from "../context/ApplicationContext";
import { BotGenerator } from "../generators/BotGenerator";
import { BotHelper } from "../helpers/BotHelper";
import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData";
@ -18,8 +19,9 @@ export declare class BotController {
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected applicationContext: ApplicationContext;
protected botConfig: IBotConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext);
/**
* Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for
@ -36,6 +38,17 @@ export declare class BotController {
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
/**
* Generate bot profiles and store in cache
* @param sessionId Session id
* @param info bot generation request info
* @returns IBotBase array
*/
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
/**
* Get the max number of bots allowed on a map
* Looks up location player is entering when getting cap value
* @returns cap number
*/
getBotCap(): number;
}

View File

@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper";
import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse";
import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse";
import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile";
import { SaveServer } from "../servers/SaveServer";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class DialogueController {
protected httpResponse: HttpResponseUtil;
protected saveServer: SaveServer;
protected timeUtil: TimeUtil;
protected dialogueHelper: DialogueHelper;
constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper);
constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper);
update(): void;
getFriendList(sessionID: string): IGetFriendListDataResponse;
generateDialogueList(sessionID: string): IGetBodyResponseData<DialogueInfo[]>;
/**
* Create array holding trader dialogs and mail interactions with player
* Set the content of the dialogue on the list tab.
* @param sessionID Session Id
* @returns array of dialogs
*/
generateDialogueList(sessionID: string): DialogueInfo[];
/**
* Get the content of a dialogue
* @param dialogueID Dialog id
* @param sessionID Session Id
* @returns
*/
getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo;
/**
* Set the content of the dialogue on the details panel, showing all the messages
* for the specified dialogue.
* @param dialogueID Dialog id
* @param sessionID Session id
* @returns IGetMailDialogViewResponseData object
*/
generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData;
/**
* Get a count of messages with attachments from a particular dialog
* @param sessionID Session id
* @param dialogueID Dialog id
* @returns Count of messages with attachments
*/
protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number;
/**
* Does array have messages with uncollected rewards (includes expired rewards)
* @param messages Messages to check
* @returns true if uncollected rewards found
*/
protected messagesHaveUncollectedRewards(messages: Message[]): boolean;
removeDialogue(dialogueID: string, sessionID: string): void;
setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void;
setRead(dialogueIDs: string[], sessionID: string): void;
/**
* Get all uncollected items attached to mail in a particular dialog
* @param dialogueID Dialog to get mail attachments from
* @param sessionID Session id
* @returns
*/
getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse;
protected messagesHaveUncollectedRewards(messages: Message[]): boolean;
/**
* Get messages from a specific dialog that have items not expired
* @param sessionId Session id
* @param dialogueId Dialog to get mail attachments from
* @returns Message array
*/
protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[];
/**
* Return array of messages with uncollected items (includes expired)
* @param messages Messages to parse
* @returns messages with items to collect
*/
protected getMessagesWithAttachments(messages: Message[]): Message[];
/**
* Delete expired items. triggers when updating traders.
* @param sessionID Session id
*/
protected removeExpiredItems(sessionID: string): void;
update(): void;
}

View File

@ -1,27 +1,40 @@
import { GameEventHelper } from "../helpers/GameEventHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { Config } from "../models/eft/common/IGlobals";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected watermark: Watermark;
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected profileFixerService: ProfileFixerService;
protected gameEventHelper: GameEventHelper;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void;
protected updateGlobalEvents(globalConfig: Config, eventName: string): void;
protected enableDancingTree(): void;
/**
* Make non-trigger-spawned raiders spawn earlier + always
*/
protected adjustLabsRaiderSpawnRate(): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];

View File

@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa
import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData";
import { BotDifficulty } from "../models/enums/BotDifficulty";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
@ -44,5 +45,11 @@ export declare class MatchController {
protected getMatch(location: string): any;
getGroupStatus(info: IGetGroupStatusRequestData): any;
startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void;
/**
* Convert a difficulty value from pre-raid screen to a bot difficulty
* @param botDifficulty dropdown difficulty
* @returns bot difficulty
*/
protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string;
endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void;
}

View File

@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData";
@ -65,6 +66,35 @@ export declare class RagfairController {
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer);
getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult;
/**
* Get offers for the client based on type of search being performed
* @param searchRequest Client search request data
* @param itemsToAdd
* @param assorts
* @param pmcProfile Player profile
* @returns array of offers
*/
protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data
* @param offers ragfair offers to get categories for
* @returns record with tpls + counts
*/
protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number>;
/**
* Add Required offers to offers result
* @param searchRequest Client search request data
* @param assorts
* @param pmcProfile Player profile
* @param result Result object being sent back to client
*/
protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData, result: IGetOffersResult): void;
/**
* Add index to all offers passed in (0-indexed)
* @param offers Offers to add index value to
*/
protected addIndexValueToOffers(offers: IRagfairOffer[]): void;
/**
* Update a trader flea offer with buy restrictions stored in the traders assort
* @param offer flea offer to update

View File

@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa
import { IRepairConfig } from "../models/spt/config/IRepairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { RepairService } from "../services/RepairService";
export declare class RepairController {
protected logger: ILogger;
protected itemEventRouter: ItemEventRouter;
@ -19,23 +19,23 @@ export declare class RepairController {
protected traderHelper: TraderHelper;
protected paymentService: PaymentService;
protected repairHelper: RepairHelper;
protected configServer: ConfigServer;
protected repairService: RepairService;
protected repairConfig: IRepairConfig;
constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer);
constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService);
/**
* Repair with trader
* @param pmcData player profile
* @param body endpoint request data
* @param sessionID session id
* @param body endpoint request data
* @param pmcData player profile
* @returns item event router action
*/
traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse;
/**
* Repair with repair kit
* @param pmcData player profile
* @param body endpoint request data
* @param sessionID session id
* @param body endpoint request data
* @param pmcData player profile
* @returns item event router action
*/
repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse;
}

View File

@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe";
* Handle the registration of classes to be used by the Dependency Injection code
*/
export declare class Container {
static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void;
static registerTypes(depContainer: DependencyContainer): void;
static registerListTypes(depContainer: DependencyContainer): void;
private static registerUtils;

View File

@ -1,5 +1,6 @@
import { IHttpServer } from "../models/spt/server/IHttpServer";
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export declare class Serializer {
serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
canHandle(something: string): boolean;
}

View File

@ -35,23 +35,25 @@ export declare class LootGenerator {
* Find a random item in items.json and add to result array
* @param items items to choose from
* @param itemTypeCounts item limit counts
* @param options item filters
* @param result array to add found item to
* @returns true if item was valid and added to pool
*/
protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record<string, {
current: number;
max: number;
}>, result: LootItem[]): boolean;
}>, options: LootRequest, result: LootItem[]): boolean;
/**
*
* Find a random item in items.json and add to result array
* @param globalDefaultPresets presets to choose from
* @param itemTypeCounts item limit counts
* @param itemBlacklist items to skip
* @param result array to add found preset to
* @returns true if preset was valid and added to pool
*/
protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record<string, {
current: number;
max: number;
}>, result: LootItem[]): boolean;
}>, itemBlacklist: string[], result: LootItem[]): boolean;
}

View File

@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator {
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer);
createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
/**
* Convert a count of currency into roubles
* @param currencyCount amount of currency to convert into roubles
* @param currencyType Type of currency (euro/dollar/rouble)
* @returns count of roubles
*/
protected calculateRoublePrice(currencyCount: number, currencyType: string): number;
protected getTraderId(userID: string): string;
protected getRating(userID: string): number;
/**

View File

@ -33,6 +33,12 @@ export declare class BotHelper {
* @returns Difficulty object
*/
getPmcDifficultySettings(type: string, difficulty: string): Difficulty;
/**
* Translate chosen value from pre-raid difficulty dropdown into bot difficulty value
* @param dropDownDifficulty Dropdown difficulty value to convert
* @returns bot difficulty
*/
convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string;
/**
* Choose a random difficulty from - easy/normal/hard/impossible
* @returns random difficulty

View File

@ -34,7 +34,8 @@ export declare class DialogueHelper {
* Get the item contents for a particular message.
* @param messageID
* @param sessionID
* @param itemId Item being moved to inventory
* @returns
*/
getMessageItemContents(messageID: string, sessionID: string): Item[];
getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[];
}

View File

@ -1,9 +1,18 @@
import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
export declare class GameEventHelper {
protected databaseServer: DatabaseServer;
constructor(databaseServer: DatabaseServer);
protected configServer: ConfigServer;
protected seasonalEventConfig: ISeasonalEventConfig;
constructor(databaseServer: DatabaseServer, configServer: ConfigServer);
get events(): Record<string, string>;
get christmasEventItems(): string[];
itemIsChristmasRelated(itemId: string): boolean;
christmasEventEnabled(): boolean;
/**
* Get the dates each seasonal event starts and ends
* @returns Record with event name + start/end date
*/
getEventDetails(): ISeasonalEvent[];
}

View File

@ -1,10 +1,10 @@
import { INotification } from "../models/eft/notifier/INotifier";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { HttpServer } from "../servers/HttpServer";
import { NotificationService } from "../services/NotificationService";
export declare class NotificationSendHelper {
protected httpServer: IHttpServer;
protected httpServer: HttpServer;
protected notificationService: NotificationService;
constructor(httpServer: IHttpServer, notificationService: NotificationService);
constructor(httpServer: HttpServer, notificationService: NotificationService);
/**
* Send notification message to the appropiate channel
*/

View File

@ -48,6 +48,12 @@ export declare class RagfairOfferHelper {
constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer);
getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level
* @param offers Offers to check
* @param pmcProfile Players profile with trader loyalty levels
*/
protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[];
processOffersOnProfile(sessionID: string): boolean;
protected getProfileOffers(sessionID: string): IRagfairOffer[];
protected deleteOfferByOfferId(sessionID: string, offerId: string): void;

View File

@ -1,14 +1,28 @@
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
import { RagfairSort } from "../models/enums/RagfairSort";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
export declare class RagfairSortHelper {
protected databaseServer: DatabaseServer;
protected localeService: LocaleService;
constructor(databaseServer: DatabaseServer, localeService: LocaleService);
sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[];
/**
* Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time)
* @param offers Offers to sort
* @param type How to sort it
* @param direction Ascending/descending
* @returns Sorted offers
*/
sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[];
protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number;
protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number;
protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number;
/**
* Order two offers by price value
* @param a Offer a
* @param b Offer b
* @returns
*/
protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number;
protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number;
}

View File

@ -14,8 +14,17 @@ export declare class RepairHelper {
protected configServer: ConfigServer;
protected repairConfig: IRepairConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer);
updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item;
protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number;
protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number;
/**
*
* @param itemToRepair item to update durability details
* @param itemToRepairDetails db details of item to repair
* @param isArmor Is item being repaired a piece of armor
* @param amountToRepair how many unit of durability to repair
* @param useRepairKit Is item being repaired with a repair kit
* @param applyMaxDurabilityDegradation should item have max durability reduced
*/
updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void;
protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number;
protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number;
isWeaponTemplate(tpl: string): boolean;
}

View File

@ -1 +0,0 @@
import "reflect-metadata";

View File

@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService";
import { JsonUtil } from "../utils/JsonUtil";
import { VFS } from "../utils/VFS";
import { BundleLoader } from "./BundleLoader";
import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod";
import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod";
import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod";
export declare class PreAkiModLoader implements IModLoader {
protected logger: ILogger;
protected vfs: VFS;
@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader {
*/
protected getDuplicates(stringArray: string[]): string[];
/**
*
* @param mods Get an array of broken/invalid mods by name
* @returns Mod names array
* Get an array of mods with errors that prevent them from working with SPT
* @param mods mods to validate
* @returns Mod names as array
*/
protected getBrokenMods(mods: string[]): string[];
/**
@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader {
*/
protected getModsPackageData(mods: string[]): Record<string, IPackageJsonData>;
/**
* Does mod have "delayedLoad(" string in its entry class
* @param modFolderName folder name
* @param modToValidate package.json details
* Use defined safe guard to check if the mod is a IPreAkiLoadMod
* @returns boolean
*/
protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean;
protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod;
/**
* Use defined safe guard to check if the mod is a IPostAkiLoadMod
* @returns boolean
*/
protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod;
/**
* Use defined safe guard to check if the mod is a IPostDBLoadMod
* @returns boolean
*/
protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod;
/**
* Check that the mod is compatible with SPT 3.X.X
* @param mod the mod to check
* @returns boolean
*/
protected isModSpt3XXCompatible(mod: any): boolean;
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
protected executeMods(container: DependencyContainer): void;
sortModsLoadOrder(): string[];
protected addMod(mod: string): Promise<void>;
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
protected isModCompatible(mod: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
protected validMod(mod: string): boolean;
/**
* Validate a mod passes a number of checks
* @param modName name of mod in /mods/ to validate
* @returns true if valid
*/
protected validMod(modName: string): boolean;
protected getLoadOrderRecursive(mod: string, result: Record<string, string>, visited: Record<string, string>): void;
protected getLoadOrder(mods: Record<string, ModLoader.IMod>): Record<string, string>;
getContainer(): DependencyContainer;

View File

@ -1175,5 +1175,6 @@ export interface Preset {
_name: string;
_parent: string;
_items: Item[];
/** Default presets have this property */
_encyclopedia?: string;
}

View File

@ -341,6 +341,7 @@ export interface RagfairInfo {
offers: IRagfairOffer[];
}
export interface Bonus {
id?: string;
type: string;
templateId?: string;
passive?: boolean;
@ -348,6 +349,8 @@ export interface Bonus {
visible?: boolean;
value?: number;
icon?: string;
filter?: string[];
skillType?: string;
}
export interface Note {
Time: number;

View File

@ -9,6 +9,7 @@ export interface IRagfairOffer {
intId: number;
itemsCost: number;
requirementsCost: number;
sptRequirementsCostRouble: number;
startTime: number;
endTime: number;
sellInOnePiece: boolean;

View File

@ -1,7 +1,8 @@
import { RagfairSort } from "../../enums/RagfairSort";
export interface ISearchRequestData {
page: number;
limit: number;
sortType: number;
sortType: RagfairSort;
sortDirection: number;
currency: number;
priceFrom: number;

View File

@ -18,5 +18,6 @@ export declare enum ConfigTypes {
REPAIR = "aki-repair",
SCAVCASE = "aki-scavcase",
TRADER = "aki-trader",
WEATHER = "aki-weather"
WEATHER = "aki-weather",
SEASONAL_EVENT = "aki-seasonalevents"
}

View File

@ -0,0 +1,7 @@
export declare enum RagfairSort {
ID = 0,
RATING = 3,
OFFER_TITLE = 4,
PRICE = 5,
EXPIRY = 6
}

View File

@ -0,0 +1,33 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
/**
* Associates handlers, HTTP methods and a base url to a listener using a proxy
* @param basePath The base path
* @returns The decorator that create the listener proxy
*/
export declare const Listen: (basePath: string) => <T extends new (...args: any[]) => any>(Base: T) => T;
/**
* HTTP DELETE decorator
*/
export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP GET decorator
*/
export declare const Get: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP OPTIONS decorator
*/
export declare const Options: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP PATCH decorator
*/
export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP POST decorator
*/
export declare const Post: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP PUT decorator
*/
export declare const Put: (path?: string) => (target: any, propertyKey: string) => void;

View File

@ -25,4 +25,6 @@ export interface AirdropLoot {
itemTypeWhitelist: string[];
/** key: item base type: value: max count */
itemLimits: Record<string, number>;
armorLevelWhitelist: number[];
moneyStackLimits: Record<string, MinMax>;
}

View File

@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig {
/** Show a bots botType value after their name */
showTypeInNickname: boolean;
/** Max number of bots that can be spawned in a raid at any one time */
maxBotCap: number;
maxBotCap: Record<string, number>;
/** How many stacks of secret ammo should a bot have in its bot secure container */
secureContainerAmmoStackCount: number;
}

View File

@ -1,5 +1,6 @@
import { IBaseConfig } from "./IBaseConfig";
export interface IHttpConfig extends IBaseConfig {
webSocketPingDelayMs: number;
kind: "aki-http";
ip: string;
port: number;

View File

@ -0,0 +1,12 @@
import { IBaseConfig } from "./IBaseConfig";
export interface ISeasonalEventConfig extends IBaseConfig {
kind: "aki-seasonalevents";
events: ISeasonalEvent[];
}
export interface ISeasonalEvent {
name: string;
startDay: number;
startMonth: number;
endDay: number;
endMonth: number;
}

View File

@ -1,12 +0,0 @@
/// <reference types="node" />
/// <reference types="node" />
import http, { ServerResponse } from "http";
import { INotification } from "../../eft/notifier/INotifier";
export interface IHttpServer {
load(): void;
getCookies(req: http.IncomingMessage): any;
sendFile(resp: ServerResponse, file: any): void;
isConnectionWebSocket(sessionID: string): boolean;
sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void;
sendMessage(sessionID: string, output: INotification): void;
}

View File

@ -6,4 +6,6 @@ export declare class LootRequest {
itemTypeWhitelist: string[];
/** key: item base type: value: max count */
itemLimits: Record<string, number>;
armorLevelWhitelist: number[];
moneyStackLimits: Record<string, MinMax>;
}

View File

@ -1,13 +1,14 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { VFS } from "../utils/VFS";
export declare class ImageRouter {
protected vfs: VFS;
protected imageRouteService: ImageRouteService;
constructor(vfs: VFS, imageRouteService: ImageRouteService);
protected httpFileUtil: HttpFileUtil;
constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil);
addRoute(key: string, valueToAdd: string): void;
sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void;
sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
getImage(): string;
}

View File

@ -1,11 +1,14 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { Serializer } from "../../di/Serializer";
import { BundleLoader } from "../../loaders/BundleLoader";
import { IHttpServer } from "../../models/spt/server/IHttpServer";
import { ILogger } from "../../models/spt/utils/ILogger";
import { HttpFileUtil } from "../../utils/HttpFileUtil";
export declare class BundleSerializer extends Serializer {
protected logger: ILogger;
protected bundleLoader: BundleLoader;
constructor(logger: ILogger, bundleLoader: BundleLoader);
serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
protected httpFileUtil: HttpFileUtil;
constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil);
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
canHandle(route: string): boolean;
}

View File

@ -1,9 +1,10 @@
import { IHttpServer } from "../../models/spt/server/IHttpServer";
/// <reference types="node" />
import { Serializer } from "../../di/Serializer";
import { ImageRouter } from "../ImageRouter";
import { IncomingMessage, ServerResponse } from "http";
export declare class ImageSerializer extends Serializer {
protected imageRouter: ImageRouter;
constructor(imageRouter: ImageRouter);
serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
canHandle(route: string): boolean;
}

View File

@ -1,11 +1,12 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { NotifierController } from "../../controllers/NotifierController";
import { Serializer } from "../../di/Serializer";
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
import { IHttpServer } from "../../models/spt/server/IHttpServer";
export declare class NotifySerializer extends Serializer {
protected notifierController: NotifierController;
protected httpServerHelper: HttpServerHelper;
constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper);
serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void;
canHandle(route: string): boolean;
}

View File

@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables";
export declare class DatabaseServer {
protected tableData: IDatabaseTables;
getTables(): IDatabaseTables;
setTables(any: any): void;
setTables(tableData: IDatabaseTables): void;
}

View File

@ -1,51 +1,34 @@
/// <reference types="node" />
/// <reference types="node" />
import http, { ServerResponse } from "http";
import http, { IncomingMessage, ServerResponse } from "http";
import WebSocket from "ws";
import { ApplicationContext } from "../context/ApplicationContext";
import { Serializer } from "../di/Serializer";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { NotifierHelper } from "../helpers/NotifierHelper";
import { INotification } from "../models/eft/notifier/INotifier";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ILogger } from "../models/spt/utils/ILogger";
import { HttpRouter } from "../routers/HttpRouter";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { ConfigServer } from "./ConfigServer";
import { DatabaseServer } from "./DatabaseServer";
export declare class HttpServer implements IHttpServer {
protected httpRouter: HttpRouter;
import { IHttpListener } from "./http/IHttpListener";
export declare class HttpServer {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected httpResponse: HttpResponseUtil;
protected databaseServer: DatabaseServer;
protected notifierHelper: NotifierHelper;
protected httpServerHelper: HttpServerHelper;
protected serializers: Serializer[];
protected httpListeners: IHttpListener[];
protected configServer: ConfigServer;
protected applicationContext: ApplicationContext;
constructor(httpRouter: HttpRouter, // TODO: delay required
logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext);
protected buffers: {};
protected onReceive: {};
protected onRespond: {};
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext);
protected httpConfig: IHttpConfig;
protected webSockets: {};
protected websocketPingHandler: any;
getCookies(req: http.IncomingMessage): any;
resetBuffer(sessionID: string): void;
putInBuffer(sessionID: any, data: any, bufLength: number): boolean;
getFromBuffer(sessionID: string): any;
sendZlibJson(resp: any, output: any, sessionID: string): void;
sendMessage(sessionID: string, output: INotification): void;
sendFile(resp: ServerResponse, file: any): void;
isConnectionWebSocket(sessionID: string): boolean;
sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void;
handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void;
handleRequest(req: IncomingMessage, resp: ServerResponse): void;
load(): void;
protected getRandomisedMessage(): string;
wsOnConnection(ws: any, req: any): void;
protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void;
}

View File

@ -0,0 +1,26 @@
/// <reference types="node" />
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { IHttpListener } from "./IHttpListener";
import { Serializer } from "../../di/Serializer";
import { ILogger } from "../../models/spt/utils/ILogger";
import { HttpRouter } from "../../routers/HttpRouter";
import { HttpResponseUtil } from "../../utils/HttpResponseUtil";
import { JsonUtil } from "../../utils/JsonUtil";
import { HttpBufferHandler } from "./HttpBufferHandler";
export declare class AkiHttpListener implements IHttpListener {
protected httpRouter: HttpRouter;
protected serializers: Serializer[];
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected httpResponse: HttpResponseUtil;
protected httpBufferHandler: HttpBufferHandler;
constructor(httpRouter: HttpRouter, // TODO: delay required
serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler);
canHandle(_: string, req: IncomingMessage): boolean;
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void;
getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string;
protected getBodyInfo(body: Buffer): string;
sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void;
}

View File

@ -0,0 +1,6 @@
export declare class HttpBufferHandler {
protected buffers: {};
resetBuffer(sessionID: string): void;
putInBuffer(sessionID: any, data: any, bufLength: number): boolean;
getFromBuffer(sessionID: string): any;
}

View File

@ -0,0 +1,8 @@
export declare enum HttpMethods {
OPTIONS = "OPTIONS",
GET = "GET",
POST = "POST",
PUT = "PUT",
PATCH = "PATCH",
DELETE = "DELETE"
}

View File

@ -0,0 +1,6 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export interface IHttpListener {
canHandle(sessionId: string, req: IncomingMessage): boolean;
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
}

View File

@ -35,13 +35,18 @@ export declare class BotGenerationCacheService {
protected removeBotFromCache(indexOfBotToReturn: number): void;
/**
* Get index of bot profile that matches criteria
* @param role role of bot we want
* @param getPmc is requested bot a pmc
* @returns index of found bot
* @param role Role of bot wanted
* @param getPmc Requested bot a pmc
* @returns index of found bot, -1 if not found
*/
protected getIndexOfBotToReturn(role: string, getPmc: boolean): number;
/**
* Remove all cached bot profiles
*/
clearStoredBots(): void;
/**
* Does cache have bots
* @returns true if empty
*/
cacheIsEmpty(): boolean;
}

View File

@ -1,20 +1,14 @@
import * as ts from "typescript";
import { ILogger } from "../models/spt/utils/ILogger";
import { VFS } from "../utils/VFS";
import { CompilerOptions } from "typescript";
import type { ILogger } from "../models/spt/utils/ILogger";
import { HashCacheService } from "./HashCacheService";
import { VFS } from "../utils/VFS";
export declare class ModCompilerService {
protected logger: ILogger;
protected hashCacheService: HashCacheService;
protected vfs: VFS;
constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS);
compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise<void>;
protected compile(fileNames: string[], options: ts.CompilerOptions): Promise<void>;
protected buildDepth(depth: number): string;
protected getNodesModulesPath(depth: number): string;
protected getAkiPath(depth: number): string;
protected getAkiFolder(): string;
protected getNodesModulesFolder(): string;
protected calculateDepth(file: string): number;
protected compile(fileNames: string[], options: CompilerOptions): Promise<void>;
protected areFilesReady(fileNames: string[]): boolean;
protected delay(ms: number): Promise<unknown>;
}

View File

@ -1,6 +1,8 @@
import { HideoutHelper } from "../helpers/HideoutHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { HideoutSlot } from "../models/eft/common/tables/IBotBase";
import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { StageBonus } from "../models/eft/hideout/IHideoutArea";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { HideoutAreas } from "../models/enums/HideoutAreas";
import { ILogger } from "../models/spt/utils/ILogger";
@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark";
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
protected hideoutHelper: HideoutHelper;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer);
constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer);
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
@ -63,4 +66,21 @@ export declare class ProfileFixerService {
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
/**
* Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing
* @param pmcProfile Profile to update
*/
addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void;
/**
*
* @param profileBonuses bonuses from profile
* @param bonus bonus to find
* @returns matching bonus
*/
protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus;
/**
* Checks profile inventiory for items that do not exist inside the items db
* @param pmcProfile Profile to check inventory of
*/
checkForOrphanedModdedItems(pmcProfile: IPmcData): void;
}

View File

@ -0,0 +1,75 @@
import { QuestHelper } from "../helpers/QuestHelper";
import { RepairHelper } from "../helpers/RepairHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest";
import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest";
import { IRepairConfig } from "../models/spt/config/IRepairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "./PaymentService";
export declare class RepairService {
protected logger: ILogger;
protected itemEventRouter: ItemEventRouter;
protected databaseServer: DatabaseServer;
protected questHelper: QuestHelper;
protected traderHelper: TraderHelper;
protected paymentService: PaymentService;
protected repairHelper: RepairHelper;
protected configServer: ConfigServer;
repairConfig: IRepairConfig;
constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer);
/**
* Use trader to repair an items durability
* @param sessionID Session id
* @param pmcData profile to find item to repair in
* @param repairItemDetails details of the item to repair
* @param traderId Trader being used to repair item
* @returns RepairDetails object
*/
repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails;
/**
*
* @param sessionID Session id
* @param pmcData profile to take money from
* @param repairedItemId Repaired item id
* @param repairCost Cost to repair item in roubles
* @param traderId Id of the trader who repaired the item / who is paid
* @param output
*/
payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void;
/**
* Add skill points to profile after repairing an item
* @param sessionId Session id
* @param repairDetails details of item repaired, cost/item
* @param pmcData Profile to add points to
* @param output IItemEventRouterResponse
*/
addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void;
/**
*
* @param sessionId Session id
* @param pmcData Profile to update repaired item in
* @param repairKits Array of Repair kits to use
* @param itemToRepairId Item id to repair
* @param output IItemEventRouterResponse
* @returns Details of repair, item/price
*/
repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails;
/**
* Update repair kits Resource object if it doesn't exist
* @param repairKitDetails Repair kit details from db
* @param repairKitInInventory Repair kit to update
*/
protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void;
}
export declare class RepairDetails {
repairCost?: number;
repairedItem: Item;
repairedItemIsArmor: boolean;
}

View File

@ -0,0 +1,10 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { IHttpListener } from "../../../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): void;
}

View File

@ -0,0 +1,8 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "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,8 @@
/// <reference types="node" />
import { ServerResponse } from "http";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
export declare class HttpFileUtil {
protected httpServerHelper: HttpServerHelper;
constructor(httpServerHelper: HttpServerHelper);
sendFile(resp: ServerResponse, file: any): void;
}

View File

@ -4,21 +4,21 @@
"author": "Chomp",
"license": "MIT",
"main": "src/mod.js",
"akiVersion": "3.2.3",
"akiVersion": "3.2.4",
"isBundleMod": true,
"scripts": {
"setup": "npm i",
"build": "node ./packageBuild.ts"
},
"devDependencies": {
"@types/node": "^14.15.3",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@types/node": "16.11.62",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/parser": "5.38.1",
"bestzip": "2.2.1",
"eslint": "7.26.0",
"fs-extra": "^10.1.0",
"glob": "^8.0.3",
"tsyringe": "4.6.0",
"typescript": "4.6.4"
"eslint": "8.24.0",
"fs-extra": "10.1.0",
"glob": "8.0.3",
"tsyringe": "4.7.0",
"typescript": "4.8.4"
}
}
}

View File

@ -0,0 +1,6 @@
export declare class ErrorHandler {
private logger;
private readLine;
constructor();
handleCriticalError(err: any): void;
}

View File

@ -1,4 +1,5 @@
export declare class Program {
private errorHandler;
constructor();
start(): void;
}

View File

@ -1,17 +1,17 @@
import { BundleLoader } from "../loaders/BundleLoader";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
export declare class BundleCallbacks {
protected logger: ILogger;
protected httpResponse: HttpResponseUtil;
protected httpServer: IHttpServer;
protected httpFileUtil: HttpFileUtil;
protected bundleLoader: BundleLoader;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer);
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer);
sendBundle(sessionID: string, req: any, resp: any, body: any): any;
getBundles(url: string, info: any, sessionID: string): string;
getBundle(url: string, info: any, sessionID: string): string;

View File

@ -1,8 +1,8 @@
import { OnLoad } from "../di/OnLoad";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { HttpServer } from "../servers/HttpServer";
export declare class HttpCallbacks extends OnLoad {
protected httpServer: IHttpServer;
constructor(httpServer: IHttpServer);
protected httpServer: HttpServer;
constructor(httpServer: HttpServer);
onLoad(): void;
getRoute(): string;
getImage(): string;

View File

@ -1,18 +1,18 @@
import { OnLoad } from "../di/OnLoad";
import { PostAkiModLoader } from "../loaders/PostAkiModLoader";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
declare class ModCallbacks extends OnLoad {
protected logger: ILogger;
protected httpResponse: HttpResponseUtil;
protected httpServer: IHttpServer;
protected httpFileUtil: HttpFileUtil;
protected postAkiModLoader: PostAkiModLoader;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer);
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer);
onLoad(): void;
getRoute(): string;
sendBundle(sessionID: string, req: any, resp: any, body: any): void;

View File

@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa
export declare class RepairCallbacks {
protected repairController: RepairController;
constructor(repairController: RepairController);
/**
* use trader to repair item
* @param pmcData
* @param body
* @param sessionID
* @returns
*/
traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
/**
* Use repair kit to repair item
* @param pmcData
* @param body
* @param sessionID
* @returns
*/
repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
}

View File

@ -1,3 +1,4 @@
import { ApplicationContext } from "../context/ApplicationContext";
import { BotGenerator } from "../generators/BotGenerator";
import { BotHelper } from "../helpers/BotHelper";
import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData";
@ -18,8 +19,9 @@ export declare class BotController {
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected applicationContext: ApplicationContext;
protected botConfig: IBotConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext);
/**
* Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for
@ -36,6 +38,17 @@ export declare class BotController {
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
/**
* Generate bot profiles and store in cache
* @param sessionId Session id
* @param info bot generation request info
* @returns IBotBase array
*/
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
/**
* Get the max number of bots allowed on a map
* Looks up location player is entering when getting cap value
* @returns cap number
*/
getBotCap(): number;
}

View File

@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper";
import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse";
import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse";
import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile";
import { SaveServer } from "../servers/SaveServer";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class DialogueController {
protected httpResponse: HttpResponseUtil;
protected saveServer: SaveServer;
protected timeUtil: TimeUtil;
protected dialogueHelper: DialogueHelper;
constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper);
constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper);
update(): void;
getFriendList(sessionID: string): IGetFriendListDataResponse;
generateDialogueList(sessionID: string): IGetBodyResponseData<DialogueInfo[]>;
/**
* Create array holding trader dialogs and mail interactions with player
* Set the content of the dialogue on the list tab.
* @param sessionID Session Id
* @returns array of dialogs
*/
generateDialogueList(sessionID: string): DialogueInfo[];
/**
* Get the content of a dialogue
* @param dialogueID Dialog id
* @param sessionID Session Id
* @returns
*/
getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo;
/**
* Set the content of the dialogue on the details panel, showing all the messages
* for the specified dialogue.
* @param dialogueID Dialog id
* @param sessionID Session id
* @returns IGetMailDialogViewResponseData object
*/
generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData;
/**
* Get a count of messages with attachments from a particular dialog
* @param sessionID Session id
* @param dialogueID Dialog id
* @returns Count of messages with attachments
*/
protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number;
/**
* Does array have messages with uncollected rewards (includes expired rewards)
* @param messages Messages to check
* @returns true if uncollected rewards found
*/
protected messagesHaveUncollectedRewards(messages: Message[]): boolean;
removeDialogue(dialogueID: string, sessionID: string): void;
setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void;
setRead(dialogueIDs: string[], sessionID: string): void;
/**
* Get all uncollected items attached to mail in a particular dialog
* @param dialogueID Dialog to get mail attachments from
* @param sessionID Session id
* @returns
*/
getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse;
protected messagesHaveUncollectedRewards(messages: Message[]): boolean;
/**
* Get messages from a specific dialog that have items not expired
* @param sessionId Session id
* @param dialogueId Dialog to get mail attachments from
* @returns Message array
*/
protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[];
/**
* Return array of messages with uncollected items (includes expired)
* @param messages Messages to parse
* @returns messages with items to collect
*/
protected getMessagesWithAttachments(messages: Message[]): Message[];
/**
* Delete expired items. triggers when updating traders.
* @param sessionID Session id
*/
protected removeExpiredItems(sessionID: string): void;
update(): void;
}

View File

@ -1,27 +1,40 @@
import { GameEventHelper } from "../helpers/GameEventHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { Config } from "../models/eft/common/IGlobals";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected watermark: Watermark;
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected profileFixerService: ProfileFixerService;
protected gameEventHelper: GameEventHelper;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void;
protected updateGlobalEvents(globalConfig: Config, eventName: string): void;
protected enableDancingTree(): void;
/**
* Make non-trigger-spawned raiders spawn earlier + always
*/
protected adjustLabsRaiderSpawnRate(): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];

View File

@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa
import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData";
import { BotDifficulty } from "../models/enums/BotDifficulty";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
@ -44,5 +45,11 @@ export declare class MatchController {
protected getMatch(location: string): any;
getGroupStatus(info: IGetGroupStatusRequestData): any;
startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void;
/**
* Convert a difficulty value from pre-raid screen to a bot difficulty
* @param botDifficulty dropdown difficulty
* @returns bot difficulty
*/
protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string;
endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void;
}

View File

@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData";
@ -65,6 +66,35 @@ export declare class RagfairController {
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer);
getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult;
/**
* Get offers for the client based on type of search being performed
* @param searchRequest Client search request data
* @param itemsToAdd
* @param assorts
* @param pmcProfile Player profile
* @returns array of offers
*/
protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data
* @param offers ragfair offers to get categories for
* @returns record with tpls + counts
*/
protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number>;
/**
* Add Required offers to offers result
* @param searchRequest Client search request data
* @param assorts
* @param pmcProfile Player profile
* @param result Result object being sent back to client
*/
protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData, result: IGetOffersResult): void;
/**
* Add index to all offers passed in (0-indexed)
* @param offers Offers to add index value to
*/
protected addIndexValueToOffers(offers: IRagfairOffer[]): void;
/**
* Update a trader flea offer with buy restrictions stored in the traders assort
* @param offer flea offer to update

View File

@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa
import { IRepairConfig } from "../models/spt/config/IRepairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { RepairService } from "../services/RepairService";
export declare class RepairController {
protected logger: ILogger;
protected itemEventRouter: ItemEventRouter;
@ -19,23 +19,23 @@ export declare class RepairController {
protected traderHelper: TraderHelper;
protected paymentService: PaymentService;
protected repairHelper: RepairHelper;
protected configServer: ConfigServer;
protected repairService: RepairService;
protected repairConfig: IRepairConfig;
constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer);
constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService);
/**
* Repair with trader
* @param pmcData player profile
* @param body endpoint request data
* @param sessionID session id
* @param body endpoint request data
* @param pmcData player profile
* @returns item event router action
*/
traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse;
/**
* Repair with repair kit
* @param pmcData player profile
* @param body endpoint request data
* @param sessionID session id
* @param body endpoint request data
* @param pmcData player profile
* @returns item event router action
*/
repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse;
}

View File

@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe";
* Handle the registration of classes to be used by the Dependency Injection code
*/
export declare class Container {
static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void;
static registerTypes(depContainer: DependencyContainer): void;
static registerListTypes(depContainer: DependencyContainer): void;
private static registerUtils;

View File

@ -1,5 +1,6 @@
import { IHttpServer } from "../models/spt/server/IHttpServer";
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export declare class Serializer {
serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
canHandle(something: string): boolean;
}

View File

@ -35,23 +35,25 @@ export declare class LootGenerator {
* Find a random item in items.json and add to result array
* @param items items to choose from
* @param itemTypeCounts item limit counts
* @param options item filters
* @param result array to add found item to
* @returns true if item was valid and added to pool
*/
protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record<string, {
current: number;
max: number;
}>, result: LootItem[]): boolean;
}>, options: LootRequest, result: LootItem[]): boolean;
/**
*
* Find a random item in items.json and add to result array
* @param globalDefaultPresets presets to choose from
* @param itemTypeCounts item limit counts
* @param itemBlacklist items to skip
* @param result array to add found preset to
* @returns true if preset was valid and added to pool
*/
protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record<string, {
current: number;
max: number;
}>, result: LootItem[]): boolean;
}>, itemBlacklist: string[], result: LootItem[]): boolean;
}

View File

@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator {
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer);
createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
/**
* Convert a count of currency into roubles
* @param currencyCount amount of currency to convert into roubles
* @param currencyType Type of currency (euro/dollar/rouble)
* @returns count of roubles
*/
protected calculateRoublePrice(currencyCount: number, currencyType: string): number;
protected getTraderId(userID: string): string;
protected getRating(userID: string): number;
/**

View File

@ -33,6 +33,12 @@ export declare class BotHelper {
* @returns Difficulty object
*/
getPmcDifficultySettings(type: string, difficulty: string): Difficulty;
/**
* Translate chosen value from pre-raid difficulty dropdown into bot difficulty value
* @param dropDownDifficulty Dropdown difficulty value to convert
* @returns bot difficulty
*/
convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string;
/**
* Choose a random difficulty from - easy/normal/hard/impossible
* @returns random difficulty

View File

@ -34,7 +34,8 @@ export declare class DialogueHelper {
* Get the item contents for a particular message.
* @param messageID
* @param sessionID
* @param itemId Item being moved to inventory
* @returns
*/
getMessageItemContents(messageID: string, sessionID: string): Item[];
getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[];
}

View File

@ -1,9 +1,18 @@
import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
export declare class GameEventHelper {
protected databaseServer: DatabaseServer;
constructor(databaseServer: DatabaseServer);
protected configServer: ConfigServer;
protected seasonalEventConfig: ISeasonalEventConfig;
constructor(databaseServer: DatabaseServer, configServer: ConfigServer);
get events(): Record<string, string>;
get christmasEventItems(): string[];
itemIsChristmasRelated(itemId: string): boolean;
christmasEventEnabled(): boolean;
/**
* Get the dates each seasonal event starts and ends
* @returns Record with event name + start/end date
*/
getEventDetails(): ISeasonalEvent[];
}

View File

@ -1,10 +1,10 @@
import { INotification } from "../models/eft/notifier/INotifier";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { HttpServer } from "../servers/HttpServer";
import { NotificationService } from "../services/NotificationService";
export declare class NotificationSendHelper {
protected httpServer: IHttpServer;
protected httpServer: HttpServer;
protected notificationService: NotificationService;
constructor(httpServer: IHttpServer, notificationService: NotificationService);
constructor(httpServer: HttpServer, notificationService: NotificationService);
/**
* Send notification message to the appropiate channel
*/

View File

@ -48,6 +48,12 @@ export declare class RagfairOfferHelper {
constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer);
getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level
* @param offers Offers to check
* @param pmcProfile Players profile with trader loyalty levels
*/
protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[];
processOffersOnProfile(sessionID: string): boolean;
protected getProfileOffers(sessionID: string): IRagfairOffer[];
protected deleteOfferByOfferId(sessionID: string, offerId: string): void;

View File

@ -1,14 +1,28 @@
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
import { RagfairSort } from "../models/enums/RagfairSort";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
export declare class RagfairSortHelper {
protected databaseServer: DatabaseServer;
protected localeService: LocaleService;
constructor(databaseServer: DatabaseServer, localeService: LocaleService);
sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[];
/**
* Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time)
* @param offers Offers to sort
* @param type How to sort it
* @param direction Ascending/descending
* @returns Sorted offers
*/
sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[];
protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number;
protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number;
protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number;
/**
* Order two offers by price value
* @param a Offer a
* @param b Offer b
* @returns
*/
protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number;
protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number;
}

View File

@ -14,8 +14,17 @@ export declare class RepairHelper {
protected configServer: ConfigServer;
protected repairConfig: IRepairConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer);
updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item;
protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number;
protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number;
/**
*
* @param itemToRepair item to update durability details
* @param itemToRepairDetails db details of item to repair
* @param isArmor Is item being repaired a piece of armor
* @param amountToRepair how many unit of durability to repair
* @param useRepairKit Is item being repaired with a repair kit
* @param applyMaxDurabilityDegradation should item have max durability reduced
*/
updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void;
protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number;
protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number;
isWeaponTemplate(tpl: string): boolean;
}

View File

@ -1 +0,0 @@
import "reflect-metadata";

View File

@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService";
import { JsonUtil } from "../utils/JsonUtil";
import { VFS } from "../utils/VFS";
import { BundleLoader } from "./BundleLoader";
import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod";
import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod";
import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod";
export declare class PreAkiModLoader implements IModLoader {
protected logger: ILogger;
protected vfs: VFS;
@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader {
*/
protected getDuplicates(stringArray: string[]): string[];
/**
*
* @param mods Get an array of broken/invalid mods by name
* @returns Mod names array
* Get an array of mods with errors that prevent them from working with SPT
* @param mods mods to validate
* @returns Mod names as array
*/
protected getBrokenMods(mods: string[]): string[];
/**
@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader {
*/
protected getModsPackageData(mods: string[]): Record<string, IPackageJsonData>;
/**
* Does mod have "delayedLoad(" string in its entry class
* @param modFolderName folder name
* @param modToValidate package.json details
* Use defined safe guard to check if the mod is a IPreAkiLoadMod
* @returns boolean
*/
protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean;
protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod;
/**
* Use defined safe guard to check if the mod is a IPostAkiLoadMod
* @returns boolean
*/
protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod;
/**
* Use defined safe guard to check if the mod is a IPostDBLoadMod
* @returns boolean
*/
protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod;
/**
* Check that the mod is compatible with SPT 3.X.X
* @param mod the mod to check
* @returns boolean
*/
protected isModSpt3XXCompatible(mod: any): boolean;
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
protected executeMods(container: DependencyContainer): void;
sortModsLoadOrder(): string[];
protected addMod(mod: string): Promise<void>;
protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
protected isModCompatible(mod: IPackageJsonData, loadedMods: Record<string, IPackageJsonData>): boolean;
protected validMod(mod: string): boolean;
/**
* Validate a mod passes a number of checks
* @param modName name of mod in /mods/ to validate
* @returns true if valid
*/
protected validMod(modName: string): boolean;
protected getLoadOrderRecursive(mod: string, result: Record<string, string>, visited: Record<string, string>): void;
protected getLoadOrder(mods: Record<string, ModLoader.IMod>): Record<string, string>;
getContainer(): DependencyContainer;

View File

@ -1175,5 +1175,6 @@ export interface Preset {
_name: string;
_parent: string;
_items: Item[];
/** Default presets have this property */
_encyclopedia?: string;
}

View File

@ -341,6 +341,7 @@ export interface RagfairInfo {
offers: IRagfairOffer[];
}
export interface Bonus {
id?: string;
type: string;
templateId?: string;
passive?: boolean;
@ -348,6 +349,8 @@ export interface Bonus {
visible?: boolean;
value?: number;
icon?: string;
filter?: string[];
skillType?: string;
}
export interface Note {
Time: number;

View File

@ -9,6 +9,7 @@ export interface IRagfairOffer {
intId: number;
itemsCost: number;
requirementsCost: number;
sptRequirementsCostRouble: number;
startTime: number;
endTime: number;
sellInOnePiece: boolean;

View File

@ -1,7 +1,8 @@
import { RagfairSort } from "../../enums/RagfairSort";
export interface ISearchRequestData {
page: number;
limit: number;
sortType: number;
sortType: RagfairSort;
sortDirection: number;
currency: number;
priceFrom: number;

View File

@ -18,5 +18,6 @@ export declare enum ConfigTypes {
REPAIR = "aki-repair",
SCAVCASE = "aki-scavcase",
TRADER = "aki-trader",
WEATHER = "aki-weather"
WEATHER = "aki-weather",
SEASONAL_EVENT = "aki-seasonalevents"
}

View File

@ -0,0 +1,7 @@
export declare enum RagfairSort {
ID = 0,
RATING = 3,
OFFER_TITLE = 4,
PRICE = 5,
EXPIRY = 6
}

View File

@ -0,0 +1,33 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
/**
* Associates handlers, HTTP methods and a base url to a listener using a proxy
* @param basePath The base path
* @returns The decorator that create the listener proxy
*/
export declare const Listen: (basePath: string) => <T extends new (...args: any[]) => any>(Base: T) => T;
/**
* HTTP DELETE decorator
*/
export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP GET decorator
*/
export declare const Get: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP OPTIONS decorator
*/
export declare const Options: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP PATCH decorator
*/
export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP POST decorator
*/
export declare const Post: (path?: string) => (target: any, propertyKey: string) => void;
/**
* HTTP PUT decorator
*/
export declare const Put: (path?: string) => (target: any, propertyKey: string) => void;

View File

@ -25,4 +25,6 @@ export interface AirdropLoot {
itemTypeWhitelist: string[];
/** key: item base type: value: max count */
itemLimits: Record<string, number>;
armorLevelWhitelist: number[];
moneyStackLimits: Record<string, MinMax>;
}

View File

@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig {
/** Show a bots botType value after their name */
showTypeInNickname: boolean;
/** Max number of bots that can be spawned in a raid at any one time */
maxBotCap: number;
maxBotCap: Record<string, number>;
/** How many stacks of secret ammo should a bot have in its bot secure container */
secureContainerAmmoStackCount: number;
}

View File

@ -1,5 +1,6 @@
import { IBaseConfig } from "./IBaseConfig";
export interface IHttpConfig extends IBaseConfig {
webSocketPingDelayMs: number;
kind: "aki-http";
ip: string;
port: number;

View File

@ -0,0 +1,12 @@
import { IBaseConfig } from "./IBaseConfig";
export interface ISeasonalEventConfig extends IBaseConfig {
kind: "aki-seasonalevents";
events: ISeasonalEvent[];
}
export interface ISeasonalEvent {
name: string;
startDay: number;
startMonth: number;
endDay: number;
endMonth: number;
}

View File

@ -1,12 +0,0 @@
/// <reference types="node" />
/// <reference types="node" />
import http, { ServerResponse } from "http";
import { INotification } from "../../eft/notifier/INotifier";
export interface IHttpServer {
load(): void;
getCookies(req: http.IncomingMessage): any;
sendFile(resp: ServerResponse, file: any): void;
isConnectionWebSocket(sessionID: string): boolean;
sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void;
sendMessage(sessionID: string, output: INotification): void;
}

View File

@ -6,4 +6,6 @@ export declare class LootRequest {
itemTypeWhitelist: string[];
/** key: item base type: value: max count */
itemLimits: Record<string, number>;
armorLevelWhitelist: number[];
moneyStackLimits: Record<string, MinMax>;
}

View File

@ -1,13 +1,14 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { IHttpServer } from "../models/spt/server/IHttpServer";
import { ImageRouteService } from "../services/mod/image/ImageRouteService";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { VFS } from "../utils/VFS";
export declare class ImageRouter {
protected vfs: VFS;
protected imageRouteService: ImageRouteService;
constructor(vfs: VFS, imageRouteService: ImageRouteService);
protected httpFileUtil: HttpFileUtil;
constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil);
addRoute(key: string, valueToAdd: string): void;
sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void;
sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
getImage(): string;
}

View File

@ -1,11 +1,14 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { Serializer } from "../../di/Serializer";
import { BundleLoader } from "../../loaders/BundleLoader";
import { IHttpServer } from "../../models/spt/server/IHttpServer";
import { ILogger } from "../../models/spt/utils/ILogger";
import { HttpFileUtil } from "../../utils/HttpFileUtil";
export declare class BundleSerializer extends Serializer {
protected logger: ILogger;
protected bundleLoader: BundleLoader;
constructor(logger: ILogger, bundleLoader: BundleLoader);
serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
protected httpFileUtil: HttpFileUtil;
constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil);
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
canHandle(route: string): boolean;
}

View File

@ -1,9 +1,10 @@
import { IHttpServer } from "../../models/spt/server/IHttpServer";
/// <reference types="node" />
import { Serializer } from "../../di/Serializer";
import { ImageRouter } from "../ImageRouter";
import { IncomingMessage, ServerResponse } from "http";
export declare class ImageSerializer extends Serializer {
protected imageRouter: ImageRouter;
constructor(imageRouter: ImageRouter);
serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
canHandle(route: string): boolean;
}

View File

@ -1,11 +1,12 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import { NotifierController } from "../../controllers/NotifierController";
import { Serializer } from "../../di/Serializer";
import { HttpServerHelper } from "../../helpers/HttpServerHelper";
import { IHttpServer } from "../../models/spt/server/IHttpServer";
export declare class NotifySerializer extends Serializer {
protected notifierController: NotifierController;
protected httpServerHelper: HttpServerHelper;
constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper);
serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void;
serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void;
canHandle(route: string): boolean;
}

View File

@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables";
export declare class DatabaseServer {
protected tableData: IDatabaseTables;
getTables(): IDatabaseTables;
setTables(any: any): void;
setTables(tableData: IDatabaseTables): void;
}

Some files were not shown because too many files have changed in this diff Show More