Merge branch 'fix/linting-errors' into 3.8.0

# Conflicts:
#	project/src/callbacks/DataCallbacks.ts
#	project/src/callbacks/DialogueCallbacks.ts
#	project/src/callbacks/GameCallbacks.ts
#	project/src/callbacks/HandbookCallbacks.ts
#	project/src/callbacks/HealthCallbacks.ts
#	project/src/callbacks/HttpCallbacks.ts
#	project/src/callbacks/InventoryCallbacks.ts
#	project/src/callbacks/LauncherCallbacks.ts
#	project/src/callbacks/ModCallbacks.ts
#	project/src/callbacks/PresetCallbacks.ts
#	project/src/callbacks/TraderCallbacks.ts
#	project/src/context/ApplicationContext.ts
#	project/src/context/ContextVariableType.ts
#	project/src/controllers/BotController.ts
#	project/src/controllers/CustomizationController.ts
#	project/src/controllers/DialogueController.ts
#	project/src/controllers/GameController.ts
#	project/src/controllers/HideoutController.ts
#	project/src/controllers/InraidController.ts
#	project/src/controllers/InsuranceController.ts
#	project/src/controllers/InventoryController.ts
#	project/src/controllers/LauncherController.ts
#	project/src/controllers/LocationController.ts
#	project/src/controllers/QuestController.ts
#	project/src/controllers/RagfairController.ts
#	project/src/controllers/RepeatableQuestController.ts
#	project/src/controllers/TradeController.ts
#	project/src/di/Container.ts
#	project/src/di/Router.ts
#	project/src/generators/BotEquipmentModGenerator.ts
#	project/src/generators/BotGenerator.ts
#	project/src/generators/BotWeaponGenerator.ts
#	project/src/generators/LocationGenerator.ts
#	project/src/generators/LootGenerator.ts
#	project/src/generators/RepeatableQuestGenerator.ts
#	project/src/generators/WeatherGenerator.ts
#	project/src/generators/weapongen/InventoryMagGen.ts
#	project/src/generators/weapongen/implementations/BarrelInventoryMagGen.ts
#	project/src/generators/weapongen/implementations/ExternalInventoryMagGen.ts
#	project/src/helpers/AssortHelper.ts
#	project/src/helpers/BotGeneratorHelper.ts
#	project/src/helpers/HttpServerHelper.ts
#	project/src/helpers/InRaidHelper.ts
#	project/src/helpers/TradeHelper.ts
#	project/src/helpers/TraderHelper.ts
#	project/src/loaders/PostDBModLoader.ts
#	project/src/loaders/PreAkiModLoader.ts
#	project/src/models/eft/common/tables/IProfileTemplate.ts
#	project/src/models/eft/common/tables/ITemplateItem.ts
#	project/src/models/eft/dialog/IAcceptFriendRequestData.ts
#	project/src/models/eft/dialog/IDeleteFriendRequest.ts
#	project/src/models/eft/game/IGameConfigResponse.ts
#	project/src/models/eft/game/IGameKeepAliveResponse.ts
#	project/src/models/eft/game/IGameStartResponse.ts
#	project/src/models/eft/match/IJoinMatchResult.ts
#	project/src/models/eft/notifier/INotifier.ts
#	project/src/models/eft/profile/GetProfileStatusResponseData.ts
#	project/src/models/eft/trade/IProcessSellTradeRequestData.ts
#	project/src/models/external/HttpFramework.ts
#	project/src/models/external/tsyringe.ts
#	project/src/models/spt/config/ILocationConfig.ts
#	project/src/models/spt/server/ILocations.ts
#	project/src/routers/dynamic/BundleDynamicRouter.ts
#	project/src/routers/dynamic/DataDynamicRouter.ts
#	project/src/routers/dynamic/HttpDynamicRouter.ts
#	project/src/routers/dynamic/NotifierDynamicRouter.ts
#	project/src/routers/save_load/HealthSaveLoadRouter.ts
#	project/src/routers/save_load/InraidSaveLoadRouter.ts
#	project/src/routers/save_load/InsuranceSaveLoadRouter.ts
#	project/src/routers/save_load/ProfileSaveLoadRouter.ts
#	project/src/routers/static/BundleStaticRouter.ts
#	project/src/routers/static/ClientLogStaticRouter.ts
#	project/src/routers/static/DataStaticRouter.ts
#	project/src/routers/static/DialogStaticRouter.ts
#	project/src/routers/static/GameStaticRouter.ts
#	project/src/routers/static/HealthStaticRouter.ts
#	project/src/routers/static/InraidStaticRouter.ts
#	project/src/routers/static/LauncherStaticRouter.ts
#	project/src/routers/static/LocationStaticRouter.ts
#	project/src/routers/static/MatchStaticRouter.ts
#	project/src/routers/static/ProfileStaticRouter.ts
#	project/src/routers/static/QuestStaticRouter.ts
#	project/src/routers/static/RagfairStaticRouter.ts
#	project/src/routers/static/WeatherStaticRouter.ts
#	project/src/services/BotGenerationCacheService.ts
#	project/src/services/BotLootCacheService.ts
#	project/src/services/LocalisationService.ts
#	project/src/services/ProfileFixerService.ts
#	project/src/services/RagfairOfferService.ts
#	project/src/services/RagfairTaxService.ts
#	project/src/services/RepairService.ts
#	project/src/utils/App.ts
#	project/src/utils/DatabaseImporter.ts
#	project/src/utils/RagfairOfferHolder.ts
#	project/src/utils/collections/queue/Queue.ts
#	project/tests/__factories__/ProfileInsurance.factory.ts
#	project/tests/controllers/InsuranceController.test.ts

Manually resolved by Refringe
This commit is contained in:
Refringe 2023-11-15 22:28:43 -05:00
commit 8066eb942e
No known key found for this signature in database
GPG Key ID: 64E03E5F892C6F9E
136 changed files with 957 additions and 1129 deletions

2
.gitattributes vendored
View File

@ -1,7 +1,7 @@
############################################################################### ###############################################################################
# Set default behavior to automatically normalize line endings. # Set default behavior to automatically normalize line endings.
############################################################################### ###############################################################################
* text=auto * text=auto eol=lf
############################################################################### ###############################################################################
# Set default behavior for command prompt diff. # Set default behavior for command prompt diff.
# #

View File

@ -1,7 +1,4 @@
{ {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {

View File

@ -1,20 +0,0 @@
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.detectIndentation": false,
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"cSpell.words": [
"Baseclass",
"IIIA",
"medkit",
"Superfors",
"ULACH"
]
}

View File

@ -1,12 +1,10 @@
/* eslint-disable @typescript-eslint/naming-convention */
import gulp from "gulp";
import { exec } from "gulp-execa";
import rename from "gulp-rename";
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs/promises"; import fs from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import gulp from "gulp";
import { exec } from "gulp-execa";
import rename from "gulp-rename";
import pkg from "pkg"; import pkg from "pkg";
import pkgfetch from "pkg-fetch"; import pkgfetch from "pkg-fetch";
import * as ResEdit from "resedit"; import * as ResEdit from "resedit";
@ -27,7 +25,7 @@ const entries = {
const licenseFile = "../LICENSE.md"; const licenseFile = "../LICENSE.md";
/** /**
* Transpiles the src files into javascript with swc * Transpile src files into Javascript with SWC
*/ */
const compile = async () => await exec("swc src -d obj", { stdio }); const compile = async () => await exec("swc src -d obj", { stdio });

View File

@ -72,7 +72,6 @@
"pkg": "5.8.1", "pkg": "5.8.1",
"pkg-fetch": "3.5.2", "pkg-fetch": "3.5.2",
"resedit": "2.0.0", "resedit": "2.0.0",
"rome": "12.1.3",
"ts-node-dev": "2.0.0", "ts-node-dev": "2.0.0",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"typedoc": "0.25.2", "typedoc": "0.25.2",

View File

@ -41,7 +41,6 @@ export class BotCallbacks
{ {
return this.httpResponse.noBody(this.botController.getBotCoreDifficulty()); return this.httpResponse.noBody(this.botController.getBotCoreDifficulty());
} }
return this.httpResponse.noBody(this.botController.getBotDifficulty(type, difficulty)); return this.httpResponse.noBody(this.botController.getBotDifficulty(type, difficulty));
} }

View File

@ -190,9 +190,11 @@ export class DataCallbacks
supplyNextTime: 1672236024, // todo: get trader refresh time? supplyNextTime: 1672236024, // todo: get trader refresh time?
prices: handbookPrices, prices: handbookPrices,
currencyCourses: { currencyCourses: {
/* eslint-disable @typescript-eslint/naming-convention */
"5449016a4bdc2d6f028b456f": handbookPrices[Money.ROUBLES], "5449016a4bdc2d6f028b456f": handbookPrices[Money.ROUBLES],
"569668774bdc2da2298b4568": handbookPrices[Money.EUROS], "569668774bdc2da2298b4568": handbookPrices[Money.EUROS],
"5696686a4bdc2da3298b456a": handbookPrices[Money.DOLLARS], "5696686a4bdc2da3298b456a": handbookPrices[Money.DOLLARS],
/* eslint-enable @typescript-eslint/naming-convention */
}, },
}; };
return this.httpResponse.getBody(response); return this.httpResponse.getBody(response);

View File

@ -41,8 +41,7 @@ export class DialogueCallbacks implements OnUpdate
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("DialogueController") protected dialogueController: DialogueController, @inject("DialogueController") protected dialogueController: DialogueController,
) )
{ {}
}
/** /**
* Handle client/friend/list * Handle client/friend/list
@ -73,7 +72,7 @@ export class DialogueCallbacks implements OnUpdate
DateTime: this.timeUtil.getTimestamp(), DateTime: this.timeUtil.getTimestamp(),
IsDeveloper: true, IsDeveloper: true,
Regions: ["EUR"], Regions: ["EUR"],
VersionId: "bgkidft87ddd", VersionId: "bgkidft87ddd", // TODO: Is this... correct?
Ip: "", Ip: "",
Port: 0, Port: 0,
Chats: [{ _id: "0", Members: 0 }], Chats: [{ _id: "0", Members: 0 }],

View File

@ -20,7 +20,7 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { Watermark } from "@spt-aki/utils/Watermark"; import { Watermark } from "@spt-aki/utils/Watermark";
@injectable() @injectable()
class GameCallbacks implements OnLoad export class GameCallbacks implements OnLoad
{ {
constructor( constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@ -58,9 +58,7 @@ class GameCallbacks implements OnLoad
const today = new Date().toUTCString(); const today = new Date().toUTCString();
const startTimeStampMS = Date.parse(today); const startTimeStampMS = Date.parse(today);
this.gameController.gameStart(url, info, sessionID, startTimeStampMS); this.gameController.gameStart(url, info, sessionID, startTimeStampMS);
return this.httpResponse.getBody({ return this.httpResponse.getBody({ utc_time: startTimeStampMS / 1000 });
utc_time: startTimeStampMS / 1000,
});
} }
/** /**
@ -150,5 +148,3 @@ class GameCallbacks implements OnLoad
return this.httpResponse.nullResponse(); return this.httpResponse.nullResponse();
} }
} }
export {GameCallbacks};

View File

@ -7,12 +7,13 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
export class HandbookCallbacks implements OnLoad export class HandbookCallbacks implements OnLoad
{ {
constructor(@inject("HandbookController") protected handbookController: HandbookController) constructor(@inject("HandbookController") protected handbookController: HandbookController)
{ {}
}
public async onLoad(): Promise<void> public async onLoad(): Promise<void>
{ {
this.handbookController.load(); this.handbookController.load();
} }
public getRoute(): string public getRoute(): string
{ {
return "aki-handbook"; return "aki-handbook";

View File

@ -45,7 +45,6 @@ export class HealthCallbacks
public handleWorkoutEffects(url: string, info: IWorkoutData, sessionID: string): IGetBodyResponseData<string> public handleWorkoutEffects(url: string, info: IWorkoutData, sessionID: string): IGetBodyResponseData<string>
{ {
this.healthController.applyWorkoutChanges(this.profileHelper.getPmcProfile(sessionID), info, sessionID); this.healthController.applyWorkoutChanges(this.profileHelper.getPmcProfile(sessionID), info, sessionID);
return this.httpResponse.emptyResponse(); return this.httpResponse.emptyResponse();
} }

View File

@ -193,7 +193,6 @@ export class HideoutCallbacks implements OnUpdate
this.hideoutController.update(); this.hideoutController.update();
return true; return true;
} }
return false; return false;
} }

View File

@ -7,8 +7,7 @@ import { HttpServer } from "@spt-aki/servers/HttpServer";
export class HttpCallbacks implements OnLoad export class HttpCallbacks implements OnLoad
{ {
constructor(@inject("HttpServer") protected httpServer: HttpServer) constructor(@inject("HttpServer") protected httpServer: HttpServer)
{ {}
}
public async onLoad(): Promise<void> public async onLoad(): Promise<void>
{ {

View File

@ -57,7 +57,6 @@ export class InsuranceCallbacks implements OnUpdate
this.insuranceController.processReturn(); this.insuranceController.processReturn();
return true; return true;
} }
return false; return false;
} }

View File

@ -41,7 +41,6 @@ export class ItemEventCallbacks
{ {
return Number(warnings[0].code); return Number(warnings[0].code);
} }
return BackendErrorCodes.UNKNOWN_ERROR; return BackendErrorCodes.UNKNOWN_ERROR;
} }
} }

View File

@ -11,7 +11,7 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { Watermark } from "@spt-aki/utils/Watermark"; import { Watermark } from "@spt-aki/utils/Watermark";
@injectable() @injectable()
class LauncherCallbacks export class LauncherCallbacks
{ {
constructor( constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@ -92,5 +92,3 @@ class LauncherCallbacks
return this.httpResponse.noBody(this.launcherController.getServerModsProfileUsed(sessionId)); return this.httpResponse.noBody(this.launcherController.getServerModsProfileUsed(sessionId));
} }
} }
export {LauncherCallbacks};

View File

@ -91,6 +91,7 @@ export class MatchCallbacks
{ {
return this.httpResponse.getBody(true); return this.httpResponse.getBody(true);
} }
/** Handle client/match/group/transfer */ /** Handle client/match/group/transfer */
public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean> public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean>
{ {

View File

@ -11,7 +11,7 @@ import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
@injectable() @injectable()
class ModCallbacks implements OnLoad export class ModCallbacks implements OnLoad
{ {
protected httpConfig: IHttpConfig; protected httpConfig: IHttpConfig;
@ -40,5 +40,3 @@ class ModCallbacks implements OnLoad
return "aki-mods"; return "aki-mods";
} }
} }
export {ModCallbacks};

View File

@ -7,8 +7,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
export class PresetCallbacks implements OnLoad export class PresetCallbacks implements OnLoad
{ {
constructor(@inject("PresetController") protected presetController: PresetController) constructor(@inject("PresetController") protected presetController: PresetController)
{ {}
}
public async onLoad(): Promise<void> public async onLoad(): Promise<void>
{ {

View File

@ -46,7 +46,6 @@ export class QuestCallbacks
{ {
return this.questController.acceptRepeatableQuest(pmcData, body, sessionID); return this.questController.acceptRepeatableQuest(pmcData, body, sessionID);
} }
return this.questController.acceptQuest(pmcData, body, sessionID); return this.questController.acceptQuest(pmcData, body, sessionID);
} }

View File

@ -67,7 +67,6 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
return true; return true;
} }
return false; return false;
} }
@ -96,7 +95,7 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
return this.ragfairController.addPlayerOffer(pmcData, info, sessionID); return this.ragfairController.addPlayerOffer(pmcData, info, sessionID);
} }
/** \Handle RagFairRemoveOffer event */ /** Handle RagFairRemoveOffer event */
public removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse public removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse
{ {
return this.ragfairController.removeOffer(info.offerId, sessionID); return this.ragfairController.removeOffer(info.offerId, sessionID);

View File

@ -38,7 +38,6 @@ export class SaveCallbacks implements OnLoad, OnUpdate
this.saveServer.save(); this.saveServer.save();
return true; return true;
} }
return false; return false;
} }
} }

View File

@ -12,12 +12,11 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export class TraderCallbacks implements OnLoad, OnUpdate export class TraderCallbacks implements OnLoad, OnUpdate
{ {
constructor( constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, // TODO: delay required
@inject("TraderController") protected traderController: TraderController, @inject("TraderController") protected traderController: TraderController,
) )
// TODO: delay required {}
{
}
public async onLoad(): Promise<void> public async onLoad(): Promise<void>
{ {
this.traderController.load(); this.traderController.load();

View File

@ -11,13 +11,16 @@ export class ApplicationContext
private static holderMaxSize = 10; private static holderMaxSize = 10;
/** /**
* Called like: * @examples
* *
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue<IRegisterPlayerRequestData>(); * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST)
* .getValue<IRegisterPlayerRequestData>();
* *
* const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue<string>(); * const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID)
* .getValue<string>();
* *
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue<IStartOfflineRaidRequestData>(); * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO)
* .getValue<IStartOfflineRaidRequestData>();
* @param type * @param type
* @returns * @returns
*/ */
@ -27,7 +30,6 @@ export class ApplicationContext
{ {
return this.variables.get(type)?.getTail()?.getValue(); return this.variables.get(type)?.getTail()?.getValue();
} }
return undefined; return undefined;
} }
@ -37,7 +39,6 @@ export class ApplicationContext
{ {
return this.variables.get(type).toList(); return this.variables.get(type).toList();
} }
return undefined; return undefined;
} }

View File

@ -1,11 +1,7 @@
export enum ContextVariableType export enum ContextVariableType
{ {
/** Logged in users session id */ SESSION_ID = 0, // Logged in users session id
SESSION_ID, RAID_CONFIGURATION = 1, // Currently active raid information
/** Currently acive raid information */ CLIENT_START_TIMESTAMP = 2, // Timestamp when client first connected
RAID_CONFIGURATION, REGISTER_PLAYER_REQUEST = 3, // When player is loading into map and loot is requested
/** Timestamp when client first connected */
CLIENT_START_TIMESTAMP,
/** When player is loading into map and loot is requested */
REGISTER_PLAYER_REQUEST,
} }

View File

@ -51,8 +51,8 @@ export class BotController
} }
/** /**
* Return the number of bot loadout varieties to be generated * Return the number of bot load-out varieties to be generated
* @param type bot Type we want the loadout gen count for * @param type bot Type we want the load-out gen count for
* @returns number of bots to generate * @returns number of bots to generate
*/ */
public getBotPresetGenerationLimit(type: string): number public getBotPresetGenerationLimit(type: string): number
@ -62,16 +62,14 @@ export class BotController
if (!value) if (!value)
{ {
this.logger.warning(`No value found for bot type ${type}, defaulting to 30`); this.logger.warning(`No value found for bot type ${type}, defaulting to 30`);
return value; return value;
} }
return value; return value;
} }
/** /**
* Handle singleplayer/settings/bot/difficulty * Handle singleplayer/settings/bot/difficulty
* Get the core.json difficulty settings from database\bots * Get the core.json difficulty settings from database/bots
* @returns IBotCore * @returns IBotCore
*/ */
public getBotCoreDifficulty(): IBotCore public getBotCoreDifficulty(): IBotCore
@ -130,7 +128,7 @@ export class BotController
break; break;
default: default:
difficultySettings = this.botDifficultyHelper.getBotDifficultySettings(type, difficulty); difficultySettings = this.botDifficultyHelper.getBotDifficultySettings(type, difficulty);
// Don't add pmcs to event enemies (e.g. gifter/peacefullzryachiyevent) // Don't add PMCs to event enemies (e.g. gifter/peacefullzryachiyevent)
if (!this.botConfig.botsToNotAddPMCsAsEnemiesTo.includes(type.toLowerCase())) if (!this.botConfig.botsToNotAddPMCsAsEnemiesTo.includes(type.toLowerCase()))
{ {
this.botHelper.addBotToEnemyList(difficultySettings, [ this.botHelper.addBotToEnemyList(difficultySettings, [
@ -138,7 +136,6 @@ export class BotController
this.pmcConfig.usecType, this.pmcConfig.usecType,
], lowercasedBotType); ], lowercasedBotType);
} }
break; break;
} }
@ -211,6 +208,7 @@ export class BotController
} }
cacheKey = `${botRole}${details.botDifficulty}`; cacheKey = `${botRole}${details.botDifficulty}`;
// Check for bot in cache, add if not // Check for bot in cache, add if not
if (!this.botGenerationCacheService.cacheHasBotOfRole(cacheKey)) if (!this.botGenerationCacheService.cacheHasBotOfRole(cacheKey))
{ {
@ -219,6 +217,7 @@ export class BotController
this.botGenerationCacheService.storeBots(cacheKey, botsToAddToCache); this.botGenerationCacheService.storeBots(cacheKey, botsToAddToCache);
} }
} }
// Get bot from cache, add to return array // Get bot from cache, add to return array
const botToReturn = this.botGenerationCacheService.getBot(cacheKey); const botToReturn = this.botGenerationCacheService.getBot(cacheKey);
@ -236,13 +235,13 @@ export class BotController
} }
/** /**
* Get the difficulty passed in, if its not "asoline", get selected difficulty from config * Get the difficulty passed in, if its not "asonline", get selected difficulty from config
* @param requestedDifficulty * @param requestedDifficulty
* @returns * @returns
*/ */
public getPMCDifficulty(requestedDifficulty: string): string public getPMCDifficulty(requestedDifficulty: string): string
{ {
// maybe retrun a random difficulty... // Maybe return a random difficulty...
if (this.pmcConfig.difficulty.toLowerCase() === "asonline") if (this.pmcConfig.difficulty.toLowerCase() === "asonline")
{ {
return requestedDifficulty; return requestedDifficulty;

View File

@ -42,7 +42,7 @@ export class CustomizationController
const templates = this.databaseServer.getTables().templates.customization; const templates = this.databaseServer.getTables().templates.customization;
const suits = this.databaseServer.getTables().traders[traderID].suits; const suits = this.databaseServer.getTables().traders[traderID].suits;
// Get an inner join of clothing from templates.customization and ragmans suits array // Get an inner join of clothing from templates.customization and Ragman's suits array
const matchingSuits = suits.filter((x) => x.suiteId in templates); const matchingSuits = suits.filter((x) => x.suiteId in templates);
// Return all suits that have a side array containing the players side (usec/bear) // Return all suits that have a side array containing the players side (usec/bear)

View File

@ -141,7 +141,7 @@ export class DialogueController
/** /**
* Handle client/mail/dialog/view * Handle client/mail/dialog/view
* Handle player clicking 'messenger' and seeing all the messages they've recieved * Handle player clicking 'messenger' and seeing all the messages they've received
* Set the content of the dialogue on the details panel, showing all the messages * Set the content of the dialogue on the details panel, showing all the messages
* for the specified dialogue. * for the specified dialogue.
* @param request Get dialog request * @param request Get dialog request
@ -173,7 +173,7 @@ export class DialogueController
/** /**
* Get dialog from player profile, create if doesn't exist * Get dialog from player profile, create if doesn't exist
* @param profile Player profile * @param profile Player profile
* @param request get dialog request (params used when dialog doesnt exist in profile) * @param request get dialog request (params used when dialog doesn't exist in profile)
* @returns Dialogue * @returns Dialogue
*/ */
protected getDialogByIdFromProfile(profile: IAkiProfile, request: IGetMailDialogViewRequestData): Dialogue protected getDialogByIdFromProfile(profile: IAkiProfile, request: IGetMailDialogViewRequestData): Dialogue
@ -211,7 +211,7 @@ export class DialogueController
{ {
result.push(...dialogUsers); result.push(...dialogUsers);
// Player doesnt exist, add them in before returning // Player doesn't exist, add them in before returning
if (!result.find((x) => x._id === fullProfile.info.id)) if (!result.find((x) => x._id === fullProfile.info.id))
{ {
const pmcProfile = fullProfile.characters.pmc; const pmcProfile = fullProfile.characters.pmc;
@ -274,7 +274,6 @@ export class DialogueController
if (!dialog) if (!dialog)
{ {
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`); this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
return; return;
} }
@ -288,7 +287,6 @@ export class DialogueController
if (!dialog) if (!dialog)
{ {
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`); this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
return; return;
} }
@ -307,7 +305,6 @@ export class DialogueController
if (!dialogs) if (!dialogs)
{ {
this.logger.error(`No dialog object in profile: ${sessionId}`); this.logger.error(`No dialog object in profile: ${sessionId}`);
return; return;
} }
@ -332,7 +329,6 @@ export class DialogueController
if (!dialog) if (!dialog)
{ {
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`); this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
return; return;
} }
@ -371,9 +367,7 @@ export class DialogueController
protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void
{ {
const sender = this.profileHelper.getPmcProfile(sessionId); const sender = this.profileHelper.getPmcProfile(sessionId);
const sptFriendUser = this.getSptFriendData(); const sptFriendUser = this.getSptFriendData();
const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text); const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text);
if (giftSent === GiftSentResult.SUCCESS) if (giftSent === GiftSentResult.SUCCESS)
@ -387,7 +381,6 @@ export class DialogueController
"You found a gift code!", "You found a gift code!",
]), ]),
); );
return; return;
} }
@ -398,7 +391,6 @@ export class DialogueController
sptFriendUser, sptFriendUser,
this.randomUtil.getArrayValue(["Looks like you already used that code", "You already have that!!"]), this.randomUtil.getArrayValue(["Looks like you already used that code", "You already have that!!"]),
); );
return; return;
} }
@ -435,7 +427,7 @@ export class DialogueController
"Hi", "Hi",
"Greetings", "Greetings",
"Hello", "Hello",
"bonjor", "Bonjour",
"Yo", "Yo",
"Sup", "Sup",
"Heyyyyy", "Heyyyyy",

View File

@ -82,10 +82,10 @@ export class GameController
public load(): void public load(): void
{ {
// Regenerate basecache now mods are loaded and game is starting // Regenerate base cache now mods are loaded and game is starting
// Mods that add items and use the baseclass service generate the cache including their items, the next mod that add items gets left out,causing warnings // Mods that add items and use the baseClass service generate the cache including their items, the next mod that
// add items gets left out,causing warnings
this.itemBaseClassService.hydrateItemBaseClassCache(); this.itemBaseClassService.hydrateItemBaseClassCache();
this.addCustomLooseLootPositions(); this.addCustomLooseLootPositions();
} }
@ -121,9 +121,9 @@ export class GameController
this.checkTraderRepairValuesExist(); this.checkTraderRepairValuesExist();
// repeatableQuests are stored by in profile.Quests due to the responses of the client (e.g. Quests in offraidData) // repeatableQuests are stored by in profile.Quests due to the responses of the client (e.g. Quests in
// Since we don't want to clutter the Quests list, we need to remove all completed (failed / successful) repeatable quests. // offraidData). Since we don't want to clutter the Quests list, we need to remove all completed (failed or
// We also have to remove the Counters from the repeatableQuests // successful) repeatable quests. We also have to remove the Counters from the repeatableQuests
if (sessionID) if (sessionID)
{ {
const fullProfile = this.profileHelper.getFullProfile(sessionID); const fullProfile = this.profileHelper.getFullProfile(sessionID);
@ -253,6 +253,9 @@ export class GameController
this.logger.warning( this.logger.warning(
`Trader ${trader.base._id} ${trader.base.nickname} is missing a repair quality value, adding in default value`, `Trader ${trader.base._id} ${trader.base.nickname} is missing a repair quality value, adding in default value`,
); );
trader.base.repair.quality = this.jsonUtil.clone(
this.databaseServer.getTables().traders.ragfair.base.repair.quality,
);
trader.base.repair.quality = this.databaseServer.getTables().traders.ragfair.base.repair.quality; trader.base.repair.quality = this.databaseServer.getTables().traders.ragfair.base.repair.quality;
} }
} }
@ -289,7 +292,7 @@ export class GameController
continue; continue;
} }
// new postion, add entire object // New position, add entire object
mapLooseLoot.spawnpoints.push(positionToAdd); mapLooseLoot.spawnpoints.push(positionToAdd);
} }
} }
@ -386,6 +389,7 @@ export class GameController
} }
else else
{ {
// Bot type not found, add new object
map.base.MinMaxBots.push({ map.base.MinMaxBots.push({
// Bot type not found, add new object // Bot type not found, add new object
WildSpawnType: botToLimit.type, WildSpawnType: botToLimit.type,
@ -457,10 +461,7 @@ export class GameController
*/ */
public getKeepAlive(sessionId: string): IGameKeepAliveResponse public getKeepAlive(sessionId: string): IGameKeepAliveResponse
{ {
return { return { msg: "OK", utc_time: new Date().getTime() / 1000 };
msg: "OK",
utc_time: new Date().getTime() / 1000,
};
} }
/** /**
@ -510,7 +511,7 @@ export class GameController
/** /**
* When player logs in, iterate over all active effects and reduce timer * When player logs in, iterate over all active effects and reduce timer
* TODO - add body part HP regen * // TODO: Add body part HP regeneration
* @param pmcProfile * @param pmcProfile
*/ */
protected updateProfileHealthValues(pmcProfile: IPmcData): void protected updateProfileHealthValues(pmcProfile: IPmcData): void
@ -641,7 +642,7 @@ export class GameController
*/ */
protected fixRoguesSpawningInstantlyOnLighthouse(): void protected fixRoguesSpawningInstantlyOnLighthouse(): void
{ {
const lighthouse = this.databaseServer.getTables().locations["lighthouse"].base; const lighthouse = this.databaseServer.getTables().locations.lighthouse.base;
for (const wave of lighthouse.BossLocationSpawn) for (const wave of lighthouse.BossLocationSpawn)
{ {
// Find Rogues that spawn instantly // Find Rogues that spawn instantly
@ -676,7 +677,8 @@ export class GameController
} }
/** /**
* Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these
* waves to one bot when they're waiting to spawn for too long
*/ */
protected splitBotWavesIntoSingleWaves(): void protected splitBotWavesIntoSingleWaves(): void
{ {
@ -724,12 +726,12 @@ export class GameController
waveToAdd.number = index; waveToAdd.number = index;
} }
// Place wave into array in just-edited postion + 1 // Place wave into array in just-edited position + 1
location.base.waves.splice(index, 0, waveToAdd); location.base.waves.splice(index, 0, waveToAdd);
wavesAddedCount++; wavesAddedCount++;
} }
// Update subsequent wave number property to accomodate the new waves // Update subsequent wave number property to accommodate the new waves
for ( for (
let index = indexOfWaveToSplit + wavesAddedCount + 1; let index = indexOfWaveToSplit + wavesAddedCount + 1;
index < location.base.waves.length; index < location.base.waves.length;
@ -784,7 +786,7 @@ export class GameController
} }
/** /**
* Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json * Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json
*/ */
protected validateQuestAssortUnlocksExist(): void protected validateQuestAssortUnlocksExist(): void
{ {
@ -802,18 +804,18 @@ export class GameController
// Merge started/success/fail quest assorts into one dictionary // Merge started/success/fail quest assorts into one dictionary
const mergedQuestAssorts = { const mergedQuestAssorts = {
...traderData.questassort["started"], ...traderData.questassort.started,
...traderData.questassort["success"], ...traderData.questassort.success,
...traderData.questassort["fail"], ...traderData.questassort.fail,
}; };
// loop over all assorts for trader // Loop over all assorts for trader
for (const [assortKey, questKey] of Object.entries(mergedQuestAssorts)) for (const [assortKey, questKey] of Object.entries(mergedQuestAssorts))
{ {
// Does assort key exist in trader assort file // Does assort key exist in trader assort file
if (!traderAssorts.loyal_level_items[assortKey]) if (!traderAssorts.loyal_level_items[assortKey])
{ {
// reverse lookup of enum key by value // Reverse lookup of enum key by value
const messageValues = { const messageValues = {
traderName: Object.keys(Traders)[Object.values(Traders).indexOf(traderId)], traderName: Object.keys(Traders)[Object.values(Traders).indexOf(traderId)],
questName: quests[questKey]?.QuestName ?? "UNKNOWN", questName: quests[questKey]?.QuestName ?? "UNKNOWN",
@ -837,14 +839,14 @@ export class GameController
{ {
const bots = this.databaseServer.getTables().bots.types; const bots = this.databaseServer.getTables().bots.types;
if (bots["bear"]) if (bots.bear)
{ {
bots["bear"].firstName.push(playerName); bots.bear.firstName.push(playerName);
} }
if (bots["usec"]) if (bots.usec)
{ {
bots["usec"].firstName.push(playerName); bots.usec.firstName.push(playerName);
} }
} }
} }
@ -855,10 +857,10 @@ export class GameController
*/ */
protected checkForAndRemoveUndefinedDialogs(fullProfile: IAkiProfile): void protected checkForAndRemoveUndefinedDialogs(fullProfile: IAkiProfile): void
{ {
const undefinedDialog = fullProfile.dialogues["undefined"]; const undefinedDialog = fullProfile.dialogues.undefined;
if (undefinedDialog) if (undefinedDialog)
{ {
delete fullProfile.dialogues["undefined"]; delete fullProfile.dialogues.undefined;
} }
} }
@ -867,7 +869,7 @@ export class GameController
*/ */
protected removePraporTestMessage(): void protected removePraporTestMessage(): void
{ {
// Iterate over all langauges (e.g. "en", "fr") // Iterate over all languages (e.g. "en", "fr")
for (const localeKey in this.databaseServer.getTables().locales.global) for (const localeKey in this.databaseServer.getTables().locales.global)
{ {
this.databaseServer.getTables().locales.global[localeKey]["61687e2c3e526901fa76baf9"] = ""; this.databaseServer.getTables().locales.global[localeKey]["61687e2c3e526901fa76baf9"] = "";

View File

@ -91,8 +91,8 @@ export class HealthController
else else
{ {
// Get max healing from db // Get max healing from db
const maxhp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource; const maxHp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource;
healingItemToUse.upd.MedKit = { HpResource: maxhp - request.count }; // Subtract amout used from max healingItemToUse.upd.MedKit = { HpResource: maxHp - request.count }; // Subtract amount used from max
} }
// Resource in medkit is spent, delete it // Resource in medkit is spent, delete it
@ -188,7 +188,7 @@ export class HealthController
const partRequest: BodyPart = healthTreatmentRequest.difference.BodyParts[bodyPartKey]; const partRequest: BodyPart = healthTreatmentRequest.difference.BodyParts[bodyPartKey];
const profilePart = pmcData.Health.BodyParts[bodyPartKey]; const profilePart = pmcData.Health.BodyParts[bodyPartKey];
// Set profile bodypart to max // Set profile body part to max
profilePart.Health.Current = profilePart.Health.Maximum; profilePart.Health.Current = profilePart.Health.Maximum;
// Check for effects to remove // Check for effects to remove

View File

@ -320,7 +320,6 @@ export class HideoutController
{ {
// Update existing items container tpl to point to new id (tpl) // Update existing items container tpl to point to new id (tpl)
existingInventoryItem._tpl = hideoutStage.container; existingInventoryItem._tpl = hideoutStage.container;
return; return;
} }
@ -358,7 +357,7 @@ export class HideoutController
* Handle HideoutPutItemsInAreaSlots * Handle HideoutPutItemsInAreaSlots
* Create item in hideout slot item array, remove item from player inventory * Create item in hideout slot item array, remove item from player inventory
* @param pmcData Profile data * @param pmcData Profile data
* @param addItemToHideoutRequest reqeust from client to place item in area slot * @param addItemToHideoutRequest request from client to place item in area slot
* @param sessionID Session id * @param sessionID Session id
* @returns IItemEventRouterResponse object * @returns IItemEventRouterResponse object
*/ */
@ -372,7 +371,7 @@ export class HideoutController
const itemsToAdd = Object.entries(addItemToHideoutRequest.items).map((kvp) => const itemsToAdd = Object.entries(addItemToHideoutRequest.items).map((kvp) =>
{ {
const item = pmcData.Inventory.items.find((invItem) => invItem._id === kvp[1]["id"]); const item = pmcData.Inventory.items.find((invItem) => invItem._id === kvp[1].id);
return { inventoryItem: item, requestedItem: kvp[1], slot: kvp[0] }; return { inventoryItem: item, requestedItem: kvp[1], slot: kvp[0] };
}); });
@ -394,7 +393,7 @@ export class HideoutController
{ {
this.logger.error( this.logger.error(
this.localisationService.getText("hideout-unable_to_find_item_in_inventory", { this.localisationService.getText("hideout-unable_to_find_item_in_inventory", {
itemId: item.requestedItem["id"], itemId: item.requestedItem.id,
area: hideoutArea.type, area: hideoutArea.type,
}), }),
); );
@ -557,7 +556,7 @@ export class HideoutController
* Handle HideoutSingleProductionStart event * Handle HideoutSingleProductionStart event
* Start production for an item from hideout area * Start production for an item from hideout area
* @param pmcData Player profile * @param pmcData Player profile
* @param body Start prodution of single item request * @param body Start production of single item request
* @param sessionID Session id * @param sessionID Session id
* @returns IItemEventRouterResponse * @returns IItemEventRouterResponse
*/ */
@ -672,7 +671,6 @@ export class HideoutController
{ {
return productionTime; return productionTime;
} }
return productionTime * fenceLevel.ScavCaseTimeModifier; return productionTime * fenceLevel.ScavCaseTimeModifier;
} }
@ -690,7 +688,7 @@ export class HideoutController
/** /**
* Start production of continuously created item * Start production of continuously created item
* @param pmcData Player profile * @param pmcData Player profile
* @param request Continious production request * @param request Continuous production request
* @param sessionID Session id * @param sessionID Session id
* @returns IItemEventRouterResponse * @returns IItemEventRouterResponse
*/ */
@ -701,7 +699,6 @@ export class HideoutController
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
this.registerProduction(pmcData, request, sessionID); this.registerProduction(pmcData, request, sessionID);
return this.eventOutputHolder.getOutput(sessionID); return this.eventOutputHolder.getOutput(sessionID);
} }
@ -765,7 +762,7 @@ export class HideoutController
output: IItemEventRouterResponse, output: IItemEventRouterResponse,
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
// Variables for managemnet of skill // Variables for management of skill
let craftingExpAmount = 0; let craftingExpAmount = 0;
// ? move the logic of BackendCounters in new method? // ? move the logic of BackendCounters in new method?
@ -789,13 +786,7 @@ export class HideoutController
id = this.presetHelper.getDefaultPreset(id)._id; id = this.presetHelper.getDefaultPreset(id)._id;
} }
const newReq = { const newReq = { items: [{ item_id: id, count: recipe.count }], tid: "ragfair" };
items: [{
item_id: id,
count: recipe.count,
}],
tid: "ragfair",
};
const entries = Object.entries(pmcData.Hideout.Production); const entries = Object.entries(pmcData.Hideout.Production);
let prodId: string; let prodId: string;
@ -911,6 +902,7 @@ export class HideoutController
let prodId: string; let prodId: string;
for (const production of ongoingProductions) for (const production of ongoingProductions)
{ {
// Production or ScavCase
if (this.hideoutHelper.isProductionType(production[1])) if (this.hideoutHelper.isProductionType(production[1]))
{ // Production or ScavCase { // Production or ScavCase
if ((production[1] as ScavCase).RecipeId === request.recipeId) if ((production[1] as ScavCase).RecipeId === request.recipeId)
@ -983,7 +975,7 @@ export class HideoutController
/** /**
* Get quick time event list for hideout * Get quick time event list for hideout
* // TODO - implement this * // TODO: Implement this
* @param sessionId Session id * @param sessionId Session id
* @returns IQteData array * @returns IQteData array
*/ */
@ -1006,10 +998,10 @@ export class HideoutController
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
// { // {
// "Action": "HideoutQuickTimeEvent", // Action: "HideoutQuickTimeEvent",
// "results": [true, false, true, true, true, true, true, true, true, false, false, false, false, false, false], // results: [true, false, true, true, true, true, true, true, true, false, false, false, false, false, false],
// "id": "63b16feb5d012c402c01f6ef", // id: "63b16feb5d012c402c01f6ef",
// "timestamp": 1672585349 // timestamp: 1672585349
// } // }
// Skill changes are done in // Skill changes are done in
@ -1043,7 +1035,7 @@ export class HideoutController
request: IRecordShootingRangePoints, request: IRecordShootingRangePoints,
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
// Check if counter exists, add placeholder if it doesnt // Check if counter exists, add placeholder if it doesn't
if (!pmcData.Stats.Eft.OverallCounters.Items.find((x) => x.Key.includes("ShootingRangePoints"))) if (!pmcData.Stats.Eft.OverallCounters.Items.find((x) => x.Key.includes("ShootingRangePoints")))
{ {
pmcData.Stats.Eft.OverallCounters.Items.push({ Key: ["ShootingRangePoints"], Value: 0 }); pmcData.Stats.Eft.OverallCounters.Items.push({ Key: ["ShootingRangePoints"], Value: 0 });
@ -1055,7 +1047,7 @@ export class HideoutController
); );
shootingRangeHighScore.Value = request.points; shootingRangeHighScore.Value = request.points;
// Check against live, maybe a response isnt necessary // Check against live, maybe a response isn't necessary
return this.eventOutputHolder.getOutput(sessionId); return this.eventOutputHolder.getOutput(sessionId);
} }
@ -1073,7 +1065,7 @@ export class HideoutController
{ {
const output = this.eventOutputHolder.getOutput(sessionId); const output = this.eventOutputHolder.getOutput(sessionId);
// Create mapping of required item with corrisponding item from player inventory // Create mapping of required item with corresponding item from player inventory
const items = request.items.map((reqItem) => const items = request.items.map((reqItem) =>
{ {
const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id); const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id);
@ -1122,7 +1114,7 @@ export class HideoutController
return this.httpResponse.appendErrorToOutput(output); return this.httpResponse.appendErrorToOutput(output);
} }
// Add all improvemets to output object // Add all improvements to output object
const improvements = hideoutDbData.stages[profileHideoutArea.level].improvements; const improvements = hideoutDbData.stages[profileHideoutArea.level].improvements;
const timestamp = this.timeUtil.getTimestamp(); const timestamp = this.timeUtil.getTimestamp();
for (const improvement of improvements) for (const improvement of improvements)
@ -1170,7 +1162,7 @@ export class HideoutController
// Null out production data so client gets informed when response send back // Null out production data so client gets informed when response send back
pmcData.Hideout.Production[request.recipeId] = null; pmcData.Hideout.Production[request.recipeId] = null;
// TODO - handle timestamp somehow? // TODO: handle timestamp somehow?
return output; return output;
} }

View File

@ -188,7 +188,7 @@ export class InraidController
/** /**
* Make changes to pmc profile after they've died in raid, * Make changes to pmc profile after they've died in raid,
* Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items * Alter body part hp, handle insurance, delete inventory items, remove carried quest items
* @param postRaidSaveRequest Post-raid save request * @param postRaidSaveRequest Post-raid save request
* @param pmcData Pmc profile * @param pmcData Pmc profile
* @param sessionID Session id * @param sessionID Session id
@ -205,7 +205,8 @@ export class InraidController
if (this.inRaidHelper.removeQuestItemsOnDeath()) if (this.inRaidHelper.removeQuestItemsOnDeath())
{ {
// Find and remove the completed condition from profile if player died, otherwise quest is stuck in limbo and quest items cannot be picked up again // Find and remove the completed condition from profile if player died, otherwise quest is stuck in limbo
// and quest items cannot be picked up again
const allQuests = this.questHelper.getQuestsFromDb(); const allQuests = this.questHelper.getQuestsFromDb();
const activeQuestIdsInProfile = pmcData.Quests.filter((x) => const activeQuestIdsInProfile = pmcData.Quests.filter((x) =>
![QuestStatus.AvailableForStart, QuestStatus.Success, QuestStatus.Expired].includes(x.status) ![QuestStatus.AvailableForStart, QuestStatus.Success, QuestStatus.Expired].includes(x.status)
@ -232,7 +233,7 @@ export class InraidController
} }
/** /**
* Adjust player characters bodypart hp post-raid * Adjust player characters body part hp post-raid
* @param postRaidSaveRequest post raid data * @param postRaidSaveRequest post raid data
* @param pmcData player profile * @param pmcData player profile
*/ */
@ -257,13 +258,13 @@ export class InraidController
/** /**
* Reduce body part hp to % of max * Reduce body part hp to % of max
* @param pmcData profile to edit * @param pmcData profile to edit
* @param multipler multipler to apply to max health * @param multiplier multiplier to apply to max health
*/ */
protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void
{ {
for (const bodyPart of Object.values(pmcData.Health.BodyParts)) for (const bodyPart of Object.values(pmcData.Health.BodyParts))
{ {
(<BodyPartHealth>bodyPart).Health.Current = (<BodyPartHealth>bodyPart).Health.Maximum * multipler; (<BodyPartHealth>bodyPart).Health.Current = (<BodyPartHealth>bodyPart).Health.Maximum * multiplier;
} }
} }
@ -314,7 +315,6 @@ export class InraidController
{ {
return false; return false;
} }
return profile.ConditionCounters.Counters.length > 0; return profile.ConditionCounters.Counters.length > 0;
} }
@ -365,7 +365,6 @@ export class InraidController
{ {
// Doesn't exist yet, push it straight in // Doesn't exist yet, push it straight in
pmcProfile.ConditionCounters.Counters.push(scavCounter); pmcProfile.ConditionCounters.Counters.push(scavCounter);
continue; continue;
} }
@ -400,7 +399,7 @@ export class InraidController
{ {
if (offraidData.exit !== PlayerRaidEndState.SURVIVED) if (offraidData.exit !== PlayerRaidEndState.SURVIVED)
{ {
// Remove FIR status if the player havn't survived // Remove FIR status if the player hasn't survived
offraidData.profile = this.inRaidHelper.removeSpawnedInSessionPropertyFromItems(offraidData.profile); offraidData.profile = this.inRaidHelper.removeSpawnedInSessionPropertyFromItems(offraidData.profile);
} }
} }

View File

@ -24,9 +24,9 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService"; import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { MailSendService } from "@spt-aki/services/MailSendService"; import { MailSendService } from "@spt-aki/services/MailSendService";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
import { MathUtil } from "@spt-aki/utils/MathUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil";
@injectable() @injectable()
export class InsuranceController export class InsuranceController
@ -124,7 +124,7 @@ export class InsuranceController
); );
// Iterate over each of the insurance packages. // Iterate over each of the insurance packages.
insuranceDetails.forEach((insured) => for (const insured of insuranceDetails)
{ {
// Find items that should be deleted from the insured items. // Find items that should be deleted from the insured items.
const itemsToDelete = this.findItemsToDelete(insured); const itemsToDelete = this.findItemsToDelete(insured);
@ -140,7 +140,7 @@ export class InsuranceController
// Remove the fully processed insurance package from the profile. // Remove the fully processed insurance package from the profile.
this.removeInsurancePackageFromProfile(sessionID, insured.messageContent.systemData); this.removeInsurancePackageFromProfile(sessionID, insured.messageContent.systemData);
}); }
} }
/** /**
@ -224,7 +224,10 @@ export class InsuranceController
protected populateItemsMap(insured: Insurance): Map<string, Item> protected populateItemsMap(insured: Insurance): Map<string, Item>
{ {
const itemsMap = new Map<string, Item>(); const itemsMap = new Map<string, Item>();
insured.items.forEach((item) => itemsMap.set(item._id, item)); for (const item of insured.items)
{
itemsMap.set(item._id, item);
}
return itemsMap; return itemsMap;
} }
@ -325,7 +328,10 @@ export class InsuranceController
); );
if (allChildrenAreAttachments) if (allChildrenAreAttachments)
{ {
itemAndChildren.forEach((item) => toDelete.add(item._id)); for (const item of itemAndChildren)
{
toDelete.add(item._id);
}
} }
} }
} }
@ -346,7 +352,7 @@ export class InsuranceController
toDelete: Set<string>, toDelete: Set<string>,
): void ): void
{ {
mainParentToAttachmentsMap.forEach((attachmentItems, parentId) => for (const [parentId, attachmentItems] of mainParentToAttachmentsMap)
{ {
// Log the parent item's name. // Log the parent item's name.
const parentItem = itemsMap.get(parentId); const parentItem = itemsMap.get(parentId);
@ -355,7 +361,7 @@ export class InsuranceController
// Process the attachments for this individual parent item. // Process the attachments for this individual parent item.
this.processAttachmentByParent(attachmentItems, traderId, toDelete); this.processAttachmentByParent(attachmentItems, traderId, toDelete);
}); }
} }
/** /**
@ -402,10 +408,10 @@ export class InsuranceController
*/ */
protected logAttachmentsDetails(attachments: EnrichedItem[]): void protected logAttachmentsDetails(attachments: EnrichedItem[]): void
{ {
attachments.forEach(({ name, maxPrice }) => for (const attachment of attachments)
{ {
this.logger.debug(`Child Item - Name: ${name}, Max Price: ${maxPrice}`); this.logger.debug(`Child Item - Name: ${attachment.name}, Max Price: ${attachment.maxPrice}`);
}); }
} }
/** /**
@ -436,7 +442,7 @@ export class InsuranceController
{ {
const valuableToDelete = attachments.slice(0, successfulRolls).map(({ _id }) => _id); const valuableToDelete = attachments.slice(0, successfulRolls).map(({ _id }) => _id);
valuableToDelete.forEach((attachmentsId) => for (const attachmentsId of valuableToDelete)
{ {
const valuableChild = attachments.find(({ _id }) => _id === attachmentsId); const valuableChild = attachments.find(({ _id }) => _id === attachmentsId);
if (valuableChild) if (valuableChild)
@ -445,7 +451,7 @@ export class InsuranceController
this.logger.debug(`Marked for removal - Child Item: ${name}, Max Price: ${maxPrice}`); this.logger.debug(`Marked for removal - Child Item: ${name}, Max Price: ${maxPrice}`);
toDelete.add(attachmentsId); toDelete.add(attachmentsId);
} }
}); }
} }
/** /**
@ -471,7 +477,7 @@ export class InsuranceController
{ {
const hideoutParentId = this.fetchHideoutItemParent(insured.items); const hideoutParentId = this.fetchHideoutItemParent(insured.items);
insured.items.forEach((item) => for (const item of insured.items)
{ {
// Check if the item's parent exists in the insured items list. // Check if the item's parent exists in the insured items list.
const parentExists = insured.items.some((parentItem) => parentItem._id === item.parentId); const parentExists = insured.items.some((parentItem) => parentItem._id === item.parentId);
@ -483,7 +489,7 @@ export class InsuranceController
item.slotId = "hideout"; item.slotId = "hideout";
delete item.location; delete item.location;
} }
}); }
} }
/** /**

View File

@ -93,7 +93,7 @@ export class InventoryController
const ownerInventoryItems = this.inventoryHelper.getOwnerInventoryItems(moveRequest, sessionID); const ownerInventoryItems = this.inventoryHelper.getOwnerInventoryItems(moveRequest, sessionID);
if (ownerInventoryItems.sameInventory) if (ownerInventoryItems.sameInventory)
{ {
// Dont move items from trader to profile, this can happen when editing a traders preset weapons // Don't move items from trader to profile, this can happen when editing a traders preset weapons
if (moveRequest.fromOwner?.type === "Trader" && !ownerInventoryItems.isMail) if (moveRequest.fromOwner?.type === "Trader" && !ownerInventoryItems.isMail)
{ {
return this.getTraderExploitErrorResponse(output); return this.getTraderExploitErrorResponse(output);
@ -182,7 +182,7 @@ export class InventoryController
/** /**
* Split Item * Split Item
* spliting 1 stack into 2 * splitting 1 stack into 2
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
* @param request Split request * @param request Split request
* @param sessionID Session/player id * @param sessionID Session/player id
@ -206,7 +206,8 @@ export class InventoryController
request.container.location = matchingItems.length; // Wrong location for first cartridge request.container.location = matchingItems.length; // Wrong location for first cartridge
} }
// The item being merged has three possible sources: pmc, scav or mail, getOwnerInventoryItems() handles getting correct one // The item being merged has three possible sources: pmc, scav or mail, getOwnerInventoryItems() handles getting
// correct one.
const itemToSplit = inventoryItems.from.find((x) => x._id === request.splitItem); const itemToSplit = inventoryItems.from.find((x) => x._id === request.splitItem);
if (!itemToSplit) if (!itemToSplit)
{ {
@ -280,7 +281,7 @@ export class InventoryController
if (!(destinationItem.upd?.StackObjectsCount)) if (!(destinationItem.upd?.StackObjectsCount))
{ {
// No stackcount on destination, add one // No stack count on destination, add one
destinationItem.upd = { StackObjectsCount: 1 }; destinationItem.upd = { StackObjectsCount: 1 };
} }
@ -290,11 +291,11 @@ export class InventoryController
} }
else if (!sourceItem.upd.StackObjectsCount) else if (!sourceItem.upd.StackObjectsCount)
{ {
// Items pulled out of raid can have no stackcount if the stack should be 1 // Items pulled out of raid can have no stack count if the stack should be 1
sourceItem.upd.StackObjectsCount = 1; sourceItem.upd.StackObjectsCount = 1;
} }
destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stackcount to destination destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stack count to destination
output.profileChanges[sessionID].items.del.push({ _id: sourceItem._id }); // Inform client source item being deleted output.profileChanges[sessionID].items.del.push({ _id: sourceItem._id }); // Inform client source item being deleted
const indexOfItemToRemove = inventoryItems.from.findIndex((x) => x._id === sourceItem._id); const indexOfItemToRemove = inventoryItems.from.findIndex((x) => x._id === sourceItem._id);
@ -311,8 +312,8 @@ export class InventoryController
} }
/** /**
* TODO: Adds no data to output to send to client, is this by design? * // TODO: Adds no data to output to send to client, is this by design?
* TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc * // TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc
* Transfer items from one stack into another while keeping original stack * Transfer items from one stack into another while keeping original stack
* Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload"
* @param pmcData Player profile * @param pmcData Player profile
@ -418,10 +419,10 @@ export class InventoryController
this.logger.error(`Unable to find item: ${request.item2} to swap positions with: ${request.item}`); this.logger.error(`Unable to find item: ${request.item2} to swap positions with: ${request.item}`);
} }
// to.id is the parentid // to.id is the parentId
itemOne.parentId = request.to.id; itemOne.parentId = request.to.id;
// to.container is the slotid // to.container is the slotId
itemOne.slotId = request.to.container; itemOne.slotId = request.to.container;
// Request object has location data, add it in, otherwise remove existing location from object // Request object has location data, add it in, otherwise remove existing location from object
@ -473,7 +474,7 @@ export class InventoryController
} }
/** /**
* Toggles "Toggleable" items like night vision goggles and face shields. * Toggles "toggleable" items like night vision goggles and face shields.
* @param pmcData player profile * @param pmcData player profile
* @param body Toggle request * @param body Toggle request
* @param sessionID Session id * @param sessionID Session id
@ -545,7 +546,7 @@ export class InventoryController
* Bind an inventory item to the quick access menu at bottom of player screen * Bind an inventory item to the quick access menu at bottom of player screen
* Handle bind event * Handle bind event
* @param pmcData Player profile * @param pmcData Player profile
* @param bindRequest Reqeust object * @param bindRequest Request object
* @param sessionID Session id * @param sessionID Session id
* @returns IItemEventRouterResponse * @returns IItemEventRouterResponse
*/ */
@ -663,9 +664,9 @@ export class InventoryController
} }
/** /**
* Get the tplid of an item from the examine request object * Get the tplId of an item from the examine request object
* @param body response request * @param body response request
* @returns tplid * @returns string
*/ */
protected getExaminedItemTpl(body: IInventoryExamineRequestData): string protected getExaminedItemTpl(body: IInventoryExamineRequestData): string
{ {
@ -675,40 +676,41 @@ export class InventoryController
} }
else if (body.fromOwner.id === Traders.FENCE) else if (body.fromOwner.id === Traders.FENCE)
{ {
// get tpl from fence assorts // Get tpl from fence assorts
return this.fenceService.getRawFenceAssorts().items.find((x) => x._id === body.item)._tpl; return this.fenceService.getRawFenceAssorts().items.find((x) => x._id === body.item)._tpl;
} }
else if (body.fromOwner.type === "Trader") else if (body.fromOwner.type === "Trader")
{ // not fence { // not fence
// get tpl from trader assort // Not fence
// Get tpl from trader assort
return this.databaseServer.getTables().traders[body.fromOwner.id].assort.items.find((item) => return this.databaseServer.getTables().traders[body.fromOwner.id].assort.items.find((item) =>
item._id === body.item item._id === body.item
)._tpl; )._tpl;
} }
else if (body.fromOwner.type === "RagFair") else if (body.fromOwner.type === "RagFair")
{ {
// try to get tplid from items.json first // try to get tplId from items.json first
const item = this.databaseServer.getTables().templates.items[body.item]; const item = this.databaseServer.getTables().templates.items[body.item];
if (item) if (item)
{ {
return item._id; return item._id;
} }
// try alternate way of getting offer if first approach fails // Try alternate way of getting offer if first approach fails
let offer = this.ragfairOfferService.getOfferByOfferId(body.item); let offer = this.ragfairOfferService.getOfferByOfferId(body.item);
if (!offer) if (!offer)
{ {
offer = this.ragfairOfferService.getOfferByOfferId(body.fromOwner.id); offer = this.ragfairOfferService.getOfferByOfferId(body.fromOwner.id);
} }
// try find examine item inside offer items array // Try find examine item inside offer items array
const matchingItem = offer.items.find((x) => x._id === body.item); const matchingItem = offer.items.find((x) => x._id === body.item);
if (matchingItem) if (matchingItem)
{ {
return matchingItem._tpl; return matchingItem._tpl;
} }
// unable to find item in database or ragfair // Unable to find item in database or ragfair
throw new Error(this.localisationService.getText("inventory-unable_to_find_item", body.item)); throw new Error(this.localisationService.getText("inventory-unable_to_find_item", body.item));
} }
} }
@ -723,7 +725,6 @@ export class InventoryController
{ {
pmcData.Encyclopedia[id] = true; pmcData.Encyclopedia[id] = true;
} }
return this.eventOutputHolder.getOutput(sessionID); return this.eventOutputHolder.getOutput(sessionID);
} }

View File

@ -47,12 +47,13 @@ export class LauncherController
} }
/** /**
* Get descriptive text for each of the profile edtions a player can choose * Get descriptive text for each of the profile editions a player can choose
* @returns * @returns
*/ */
protected getProfileDescriptions(): Record<string, string> protected getProfileDescriptions(): Record<string, string>
{ {
return { return {
/* eslint-disable @typescript-eslint/naming-convention */
Standard: this.localisationService.getText("launcher-profile_standard"), Standard: this.localisationService.getText("launcher-profile_standard"),
"Left Behind": this.localisationService.getText("launcher-profile_leftbehind"), "Left Behind": this.localisationService.getText("launcher-profile_leftbehind"),
"Prepare To Escape": this.localisationService.getText("launcher-profile_preparetoescape"), "Prepare To Escape": this.localisationService.getText("launcher-profile_preparetoescape"),
@ -60,6 +61,7 @@ export class LauncherController
"SPT Easy start": this.localisationService.getText("launcher-profile_spteasystart"), "SPT Easy start": this.localisationService.getText("launcher-profile_spteasystart"),
"SPT Zero to hero": this.localisationService.getText("launcher-profile_sptzerotohero"), "SPT Zero to hero": this.localisationService.getText("launcher-profile_sptzerotohero"),
"SPT Developer": this.localisationService.getText("launcher-profile_sptdeveloper"), "SPT Developer": this.localisationService.getText("launcher-profile_sptdeveloper"),
/* eslint-enable @typescript-eslint/naming-convention */
}; };
} }
@ -115,6 +117,7 @@ export class LauncherController
this.saveServer.loadProfile(sessionID); this.saveServer.loadProfile(sessionID);
this.saveServer.saveProfile(sessionID); this.saveServer.saveProfile(sessionID);
return sessionID; return sessionID;
} }

View File

@ -89,7 +89,7 @@ export class LocationController
const staticLoot = this.locationGenerator.generateStaticContainers(location.base, staticAmmoDist); const staticLoot = this.locationGenerator.generateStaticContainers(location.base, staticAmmoDist);
output.Loot.push(...staticLoot); output.Loot.push(...staticLoot);
// Add dyanmic loot to output loot // Add dynamic loot to output loot
const dynamicLootDist: ILooseLoot = this.jsonUtil.clone(location.looseLoot); const dynamicLootDist: ILooseLoot = this.jsonUtil.clone(location.looseLoot);
const dynamicSpawnPoints: SpawnpointTemplate[] = this.locationGenerator.generateDynamicLoot( const dynamicSpawnPoints: SpawnpointTemplate[] = this.locationGenerator.generateDynamicLoot(
dynamicLootDist, dynamicLootDist,
@ -140,7 +140,7 @@ export class LocationController
/** /**
* Handle client/location/getAirdropLoot * Handle client/location/getAirdropLoot
* Get loot for an airdop container * Get loot for an airdrop container
* Generates it randomly based on config/airdrop.json values * Generates it randomly based on config/airdrop.json values
* @returns Array of LootItem objects * @returns Array of LootItem objects
*/ */

View File

@ -140,7 +140,7 @@ export class MatchController
// TODO: add code to strip PMC of equipment now they've started the raid // TODO: add code to strip PMC of equipment now they've started the raid
// Set pmcs to difficulty set in pre-raid screen if override in bot config isnt enabled // Set PMCs to difficulty set in pre-raid screen if override in bot config isn't enabled
if (!this.pmcConfig.useDifficultyOverride) if (!this.pmcConfig.useDifficultyOverride)
{ {
this.pmcConfig.difficulty = this.convertDifficultyDropdownIntoBotDifficulty( this.pmcConfig.difficulty = this.convertDifficultyDropdownIntoBotDifficulty(
@ -299,8 +299,8 @@ export class MatchController
{ {
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing); let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
// Not exact replica of Live behaviour // Not exact replica of Live behaviour... Simplified for now. No real reason to do the whole (unconfirmed)
// Simplified for now, no real reason to do the whole (unconfirmed) extra 0.01 standing per day regeneration mechanic // extra 0.01 standing per day regeneration mechanic.
const baseGain: number = this.inraidConfig.carExtractBaseStandingGain; const baseGain: number = this.inraidConfig.carExtractBaseStandingGain;
const extractCount: number = pmcData.CarExtractCounts[extractName]; const extractCount: number = pmcData.CarExtractCounts[extractName];

View File

@ -48,7 +48,7 @@ export class PresetBuildController
); );
if (playerSecureContainer && playerSecureContainer?._tpl !== firstDefaultItemsSecureContainer?._tpl) if (playerSecureContainer && playerSecureContainer?._tpl !== firstDefaultItemsSecureContainer?._tpl)
{ {
// Default equipment presets' secure container tpl doesnt match players secure container tpl // Default equipment presets' secure container tpl doesn't match players secure container tpl
for (const defaultPreset of defaultEquipmentPresets) for (const defaultPreset of defaultEquipmentPresets)
{ {
// Find presets secure container // Find presets secure container
@ -74,7 +74,7 @@ export class PresetBuildController
sessionId: string, sessionId: string,
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
// TODO - could be merged into saveBuild, maybe // TODO: Could be merged into saveBuild, maybe
const output = this.eventOutputHolder.getOutput(sessionId); const output = this.eventOutputHolder.getOutput(sessionId);
// Replace duplicate Id's. The first item is the base item. // Replace duplicate Id's. The first item is the base item.
@ -182,7 +182,7 @@ export class PresetBuildController
sessionID: string, sessionID: string,
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
// todo - does this get called? // TODO: Does this get called?
return this.removePlayerBuild(pmcData, body.id, sessionID); return this.removePlayerBuild(pmcData, body.id, sessionID);
} }
@ -193,7 +193,7 @@ export class PresetBuildController
sessionID: string, sessionID: string,
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
// todo - does this get called? // TODO: Does this get called?
return this.removePlayerBuild(pmcData, body.id, sessionID); return this.removePlayerBuild(pmcData, body.id, sessionID);
} }

View File

@ -133,7 +133,7 @@ export class QuestController
break; break;
} }
// Prereq does not have its status requirement fulfilled // Prerequisite does not have its status requirement fulfilled
if (!conditionToFulfil._props.status.includes(prerequisiteQuest.status)) if (!conditionToFulfil._props.status.includes(prerequisiteQuest.status))
{ {
haveCompletedPreviousQuest = false; haveCompletedPreviousQuest = false;
@ -402,15 +402,15 @@ export class QuestController
// Can be started text or description text based on above function result // Can be started text or description text based on above function result
let questStartedMessageText = locale[questStartedMessageKey]; let questStartedMessageText = locale[questStartedMessageKey];
// TODO: remove this whole if statement, possibly not required? // TODO: Remove this whole if statement, possibly not required?
if (!questStartedMessageText) if (!questStartedMessageText)
{ {
this.logger.debug( this.logger.debug(
`Unable to accept quest ${acceptedQuest.qid}, cannot find the quest started message text with id ${questStartedMessageKey}. attempting to find it in en locale instead`, `Unable to accept quest ${acceptedQuest.qid}, cannot find the quest started message text with id ${questStartedMessageKey}. attempting to find it in en locale instead`,
); );
// For some reason non-en locales dont have repeatable quest ids, fall back to en and grab it if possible // For some reason non-en locales don't have repeatable quest ids, fall back to en and grab it if possible
const enLocale = this.databaseServer.getTables().locales.global["en"]; const enLocale = this.databaseServer.getTables().locales.global.en;
questStartedMessageText = enLocale[repeatableQuestProfile.startedMessageText]; questStartedMessageText = enLocale[repeatableQuestProfile.startedMessageText];
if (!questStartedMessageText) if (!questStartedMessageText)
@ -532,7 +532,7 @@ export class QuestController
// Add diff of quests before completion vs after for client response // Add diff of quests before completion vs after for client response
const questDelta = this.questHelper.getDeltaQuests(beforeQuests, this.getClientQuests(sessionID)); const questDelta = this.questHelper.getDeltaQuests(beforeQuests, this.getClientQuests(sessionID));
// Check newly available + failed quests for timegates and add them to profile // Check newly available + failed quests for time gates and add them to profile
this.addTimeLockedQuestsToProfile(pmcData, [...questDelta, ...questsToFail], body.qid); this.addTimeLockedQuestsToProfile(pmcData, [...questDelta, ...questsToFail], body.qid);
// Inform client of quest changes // Inform client of quest changes
@ -593,12 +593,12 @@ export class QuestController
/** /**
* Return quests that have different statuses * Return quests that have different statuses
* @param preQuestStatusus Quests before * @param preQuestStatuses Quests before
* @param postQuestStatuses Quests after * @param postQuestStatuses Quests after
* @returns QuestStatusChange array * @returns QuestStatusChange array
*/ */
protected getQuestsWithDifferentStatuses( protected getQuestsWithDifferentStatuses(
preQuestStatusus: IQuestStatus[], preQuestStatuses: IQuestStatus[],
postQuestStatuses: IQuestStatus[], postQuestStatuses: IQuestStatus[],
): IQuestStatus[] ): IQuestStatus[]
{ {
@ -607,7 +607,7 @@ export class QuestController
for (const quest of postQuestStatuses) for (const quest of postQuestStatuses)
{ {
// Add quest if status differs or quest not found // Add quest if status differs or quest not found
const preQuest = preQuestStatusus.find((x) => x.qid === quest.qid); const preQuest = preQuestStatuses.find((x) => x.qid === quest.qid);
if (!preQuest || preQuest.status !== quest.status) if (!preQuest || preQuest.status !== quest.status)
{ {
result.push(quest); result.push(quest);
@ -659,7 +659,7 @@ export class QuestController
// Iterate over quests, look for quests with right criteria // Iterate over quests, look for quests with right criteria
for (const quest of quests) for (const quest of quests)
{ {
// If quest has prereq of completed quest + availableAfter value > 0 (quest has wait time) // If quest has prerequisite of completed quest + availableAfter value > 0 (quest has wait time)
const nextQuestWaitCondition = quest.conditions.AvailableForStart.find((x) => const nextQuestWaitCondition = quest.conditions.AvailableForStart.find((x) =>
x._props.target === completedQuestId && x._props.availableAfter > 0 x._props.target === completedQuestId && x._props.availableAfter > 0
); );
@ -686,7 +686,7 @@ export class QuestController
startTime: 0, startTime: 0,
status: QuestStatus.AvailableAfter, status: QuestStatus.AvailableAfter,
statusTimers: { statusTimers: {
"9": this.timeUtil.getTimestamp(), "9": this.timeUtil.getTimestamp(), // eslint-disable-line @typescript-eslint/naming-convention
}, },
availableAfter: availableAfterTimestamp, availableAfter: availableAfterTimestamp,
}); });
@ -832,7 +832,7 @@ export class QuestController
const matchingItemInProfile = pmcData.Inventory.items.find((x) => x._id === itemHandover.id); const matchingItemInProfile = pmcData.Inventory.items.find((x) => x._id === itemHandover.id);
if (!handoverRequirements._props.target.includes(matchingItemInProfile._tpl)) if (!handoverRequirements._props.target.includes(matchingItemInProfile._tpl))
{ {
// Item handed in by player doesnt match what was requested // Item handed in by player doesn't match what was requested
return this.showQuestItemHandoverMatchError( return this.showQuestItemHandoverMatchError(
handoverQuestRequest, handoverQuestRequest,
matchingItemInProfile, matchingItemInProfile,

View File

@ -118,8 +118,8 @@ export class RagfairController
{ {
if (offer.user.memberType === MemberCategory.TRADER) if (offer.user.memberType === MemberCategory.TRADER)
{ {
// for the items, check the barter schemes. The method getDisplayableAssorts sets a flag sptQuestLocked to true if the quest // for the items, check the barter schemes. The method getDisplayableAssorts sets a flag sptQuestLocked
// is not completed yet // to true if the quest is not completed yet
if (this.ragfairOfferHelper.traderOfferItemQuestLocked(offer, traderAssorts)) if (this.ragfairOfferHelper.traderOfferItemQuestLocked(offer, traderAssorts))
{ {
offer.locked = true; offer.locked = true;
@ -174,7 +174,7 @@ export class RagfairController
* Get categories for the type of search being performed, linked/required/all * Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data * @param searchRequest Client search request data
* @param offers ragfair offers to get categories for * @param offers ragfair offers to get categories for
* @returns record with tpls + counts * @returns record with templates + counts
*/ */
protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number> protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number>
{ {
@ -228,7 +228,7 @@ export class RagfairController
for (const offer of offers) for (const offer of offers)
{ {
offer.intId = ++counter; offer.intId = ++counter;
offer.items[0].parentId = ""; // without this it causes error: "Item deserialization error: No parent with id hideout found for item x" offer.items[0].parentId = ""; // Without this it causes error: "Item deserialization error: No parent with id hideout found for item x"
} }
} }
@ -547,7 +547,7 @@ export class RagfairController
} }
/** /**
* Using item ids from flea offer request, find corrispnding items from player inventory and return as array * Using item ids from flea offer request, find corresponding items from player inventory and return as array
* @param pmcData Player profile * @param pmcData Player profile
* @param itemIdsFromFleaOfferRequest Ids from request * @param itemIdsFromFleaOfferRequest Ids from request
* @param errorMessage if item is not found, add error message to this parameter * @param errorMessage if item is not found, add error message to this parameter
@ -673,7 +673,8 @@ export class RagfairController
const differenceInSeconds = offers[index].endTime - this.timeUtil.getTimestamp(); const differenceInSeconds = offers[index].endTime - this.timeUtil.getTimestamp();
if (differenceInSeconds > this.ragfairConfig.sell.expireSeconds) if (differenceInSeconds > this.ragfairConfig.sell.expireSeconds)
{ // expireSeconds Default is 71 seconds {
// expireSeconds Default is 71 seconds
const newEndTime = this.ragfairConfig.sell.expireSeconds + this.timeUtil.getTimestamp(); const newEndTime = this.ragfairConfig.sell.expireSeconds + this.timeUtil.getTimestamp();
offers[index].endTime = Math.round(newEndTime); offers[index].endTime = Math.round(newEndTime);
} }

View File

@ -72,8 +72,8 @@ export class RepeatableQuestController
* } * }
* *
* The method checks if the player level requirement for repeatable quests (e.g. daily lvl5, weekly lvl15) is met and if the previously active quests * The method checks if the player level requirement for repeatable quests (e.g. daily lvl5, weekly lvl15) is met and if the previously active quests
* are still valid. This ischecked by endTime persisted in profile accordning to the resetTime configured for each repeatable kind (daily, weekly) * are still valid. This is checked by endTime persisted in profile according to the resetTime configured for each repeatable kind (daily, weekly)
* in QuestCondig.js * in QuestConfig.js
* *
* If the condition is met, new repeatableQuests are created, old quests (which are persisted in the profile.RepeatableQuests[i].activeQuests) are * If the condition is met, new repeatableQuests are created, old quests (which are persisted in the profile.RepeatableQuests[i].activeQuests) are
* moved to profile.RepeatableQuests[i].inactiveQuests. This memory is required to get rid of old repeatable quest data in the profile, otherwise * moved to profile.RepeatableQuests[i].inactiveQuests. This memory is required to get rid of old repeatable quest data in the profile, otherwise
@ -82,7 +82,7 @@ export class RepeatableQuestController
* The new quests generated are again persisted in profile.RepeatableQuests * The new quests generated are again persisted in profile.RepeatableQuests
* *
* @param {string} sessionId Player's session id * @param {string} sessionId Player's session id
* @returns {array} array of "repeatableQuestObjects" as descibed above * @returns {array} array of "repeatableQuestObjects" as described above
*/ */
public getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[] public getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]
{ {
@ -304,7 +304,7 @@ export class RepeatableQuestController
} }
// Add "any" to pickup quest pool // Add "any" to pickup quest pool
questPool.pool.Pickup.locations["any"] = ["any"]; questPool.pool.Pickup.locations.any = ["any"];
const eliminationConfig = this.repeatableQuestHelper.getEliminationConfigByPmcLevel(pmcLevel, repeatableConfig); const eliminationConfig = this.repeatableQuestHelper.getEliminationConfigByPmcLevel(pmcLevel, repeatableConfig);
const targetsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.targets); const targetsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.targets);
@ -319,7 +319,7 @@ export class RepeatableQuestController
{ {
const possibleLocations = Object.keys(repeatableConfig.locations); const possibleLocations = Object.keys(repeatableConfig.locations);
// Set possible locations for elimination task, ift arget is savage, exclude labs from locations // Set possible locations for elimination task, if target is savage, exclude labs from locations
questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage") questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage")
? { locations: possibleLocations.filter((x) => x !== "laboratory") } ? { locations: possibleLocations.filter((x) => x !== "laboratory") }
: { locations: possibleLocations }; : { locations: possibleLocations };
@ -394,7 +394,8 @@ export class RepeatableQuestController
// Get cost to replace existing quest // Get cost to replace existing quest
changeRequirement = this.jsonUtil.clone(currentRepeatablePool.changeRequirement[changeRequest.qid]); changeRequirement = this.jsonUtil.clone(currentRepeatablePool.changeRequirement[changeRequest.qid]);
delete currentRepeatablePool.changeRequirement[changeRequest.qid]; delete currentRepeatablePool.changeRequirement[changeRequest.qid];
// TODO: somehow we need to reduce the questPool by the currently active quests (for all repeatables)
// TODO: somehow we need to reduce the questPool by the currently active quests (for all repeatable)
const repeatableConfig = this.questConfig.repeatableQuests.find((x) => const repeatableConfig = this.questConfig.repeatableQuests.find((x) =>
x.name === currentRepeatablePool.name x.name === currentRepeatablePool.name
@ -484,7 +485,6 @@ export class RepeatableQuestController
break; break;
} }
} }
return newRepeatableQuest; return newRepeatableQuest;
} }
} }

View File

@ -29,7 +29,7 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
@injectable() @injectable()
class TradeController export class TradeController
{ {
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
@ -119,7 +119,8 @@ class TradeController
scheme_items: offer.items, scheme_items: offer.items,
}; };
// confirmTrading() must occur prior to removing the offer stack, otherwise item inside offer doesn't exist for confirmTrading() to use // confirmTrading() must occur prior to removing the offer stack, otherwise item inside offer doesn't exist
// for confirmTrading() to use
output = this.confirmTradingInternal( output = this.confirmTradingInternal(
pmcData, pmcData,
buyData, buyData,
@ -157,7 +158,7 @@ class TradeController
} }
/** /**
* Sell all sellable items to a trader from inventory * Sell all items (that can be sold) to a trader from inventory
* WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD
* @param sessionId Session id * @param sessionId Session id
* @param profileWithItemsToSell Profile with items to be sold to trader * @param profileWithItemsToSell Profile with items to be sold to trader
@ -173,7 +174,7 @@ class TradeController
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
const handbookPrices = this.ragfairPriceService.getAllStaticPrices(); const handbookPrices = this.ragfairPriceService.getAllStaticPrices();
// TODO, apply trader sell bonuses? // TODO: apply trader sell bonuses?
const traderDetails = this.traderHelper.getTrader(trader, sessionId); const traderDetails = this.traderHelper.getTrader(trader, sessionId);
// Prep request object // Prep request object
@ -237,7 +238,7 @@ class TradeController
&& this.itemHelper.isOfBaseclasses(itemDetails[1]._id, traderDetails.items_buy.category)) && this.itemHelper.isOfBaseclasses(itemDetails[1]._id, traderDetails.items_buy.category))
) )
{ {
// Skip if tpl isnt item OR item doesn't fulfill match traders buy categories // Skip if tpl isn't item OR item doesn't fulfill match traders buy categories
continue; continue;
} }
@ -273,5 +274,3 @@ class TradeController
return null; return null;
} }
} }
export {TradeController};

View File

@ -16,7 +16,7 @@ export class WishlistController
{ {
for (const item in pmcData.WishList) for (const item in pmcData.WishList)
{ {
// don't add the item // Don't add the item
if (pmcData.WishList[item] === body.templateId) if (pmcData.WishList[item] === body.templateId)
{ {
return this.eventOutputHolder.getOutput(sessionID); return this.eventOutputHolder.getOutput(sessionID);

View File

@ -255,397 +255,388 @@ export class Container
childContainer.registerType("HttpListener", "AkiHttpListener"); childContainer.registerType("HttpListener", "AkiHttpListener");
} }
public static registerTypes(depContainer: DependencyContainer): void public static registerTypes(con: DependencyContainer): void
{ {
depContainer.register("ApplicationContext", ApplicationContext, { lifecycle: Lifecycle.Singleton }); con.register("ApplicationContext", ApplicationContext, { lifecycle: Lifecycle.Singleton });
Container.registerUtils(depContainer); Container.registerUtils(con);
Container.registerRouters(con);
Container.registerRouters(depContainer); Container.registerGenerators(con);
Container.registerHelpers(con);
Container.registerGenerators(depContainer); Container.registerLoaders(con);
Container.registerCallbacks(con);
Container.registerHelpers(depContainer); Container.registerServers(con);
Container.registerServices(con);
Container.registerLoaders(depContainer); Container.registerControllers(con);
Container.registerCallbacks(depContainer);
Container.registerServers(depContainer);
Container.registerServices(depContainer);
Container.registerControllers(depContainer);
} }
public static registerListTypes(depContainer: DependencyContainer): void public static registerListTypes(con: DependencyContainer): void
{ {
depContainer.register("OnLoadModService", { useValue: new OnLoadModService(depContainer) }); con.register("OnLoadModService", { useValue: new OnLoadModService(con) });
depContainer.register("HttpListenerModService", { useValue: new HttpListenerModService(depContainer) }); con.register("HttpListenerModService", { useValue: new HttpListenerModService(con) });
depContainer.register("OnUpdateModService", { useValue: new OnUpdateModService(depContainer) }); con.register("OnUpdateModService", { useValue: new OnUpdateModService(con) });
depContainer.register("DynamicRouterModService", { useValue: new DynamicRouterModService(depContainer) }); con.register("DynamicRouterModService", { useValue: new DynamicRouterModService(con) });
depContainer.register("StaticRouterModService", { useValue: new StaticRouterModService(depContainer) }); con.register("StaticRouterModService", { useValue: new StaticRouterModService(con) });
depContainer.registerType("OnLoad", "DatabaseImporter"); con.registerType("OnLoad", "DatabaseImporter");
depContainer.registerType("OnLoad", "PostDBModLoader"); con.registerType("OnLoad", "PostDBModLoader");
depContainer.registerType("OnLoad", "HandbookCallbacks"); con.registerType("OnLoad", "HandbookCallbacks");
depContainer.registerType("OnLoad", "HttpCallbacks"); con.registerType("OnLoad", "HttpCallbacks");
depContainer.registerType("OnLoad", "PresetCallbacks"); con.registerType("OnLoad", "PresetCallbacks");
depContainer.registerType("OnLoad", "SaveCallbacks"); con.registerType("OnLoad", "SaveCallbacks");
depContainer.registerType("OnLoad", "TraderCallbacks"); // must occur prior to RagfairCallbacks con.registerType("OnLoad", "TraderCallbacks"); // Must occur prior to RagfairCallbacks
depContainer.registerType("OnLoad", "RagfairPriceService"); con.registerType("OnLoad", "RagfairPriceService");
depContainer.registerType("OnLoad", "RagfairCallbacks"); con.registerType("OnLoad", "RagfairCallbacks");
depContainer.registerType("OnLoad", "ModCallbacks"); con.registerType("OnLoad", "ModCallbacks");
depContainer.registerType("OnLoad", "GameCallbacks"); con.registerType("OnLoad", "GameCallbacks");
depContainer.registerType("OnUpdate", "DialogueCallbacks"); con.registerType("OnUpdate", "DialogueCallbacks");
depContainer.registerType("OnUpdate", "HideoutCallbacks"); con.registerType("OnUpdate", "HideoutCallbacks");
depContainer.registerType("OnUpdate", "TraderCallbacks"); con.registerType("OnUpdate", "TraderCallbacks");
depContainer.registerType("OnUpdate", "RagfairCallbacks"); con.registerType("OnUpdate", "RagfairCallbacks");
depContainer.registerType("OnUpdate", "InsuranceCallbacks"); con.registerType("OnUpdate", "InsuranceCallbacks");
depContainer.registerType("OnUpdate", "SaveCallbacks"); con.registerType("OnUpdate", "SaveCallbacks");
depContainer.registerType("StaticRoutes", "BotStaticRouter"); con.registerType("StaticRoutes", "BotStaticRouter");
depContainer.registerType("StaticRoutes", "ClientLogStaticRouter"); con.registerType("StaticRoutes", "ClientLogStaticRouter");
depContainer.registerType("StaticRoutes", "CustomizationStaticRouter"); con.registerType("StaticRoutes", "CustomizationStaticRouter");
depContainer.registerType("StaticRoutes", "DataStaticRouter"); con.registerType("StaticRoutes", "DataStaticRouter");
depContainer.registerType("StaticRoutes", "DialogStaticRouter"); con.registerType("StaticRoutes", "DialogStaticRouter");
depContainer.registerType("StaticRoutes", "GameStaticRouter"); con.registerType("StaticRoutes", "GameStaticRouter");
depContainer.registerType("StaticRoutes", "HealthStaticRouter"); con.registerType("StaticRoutes", "HealthStaticRouter");
depContainer.registerType("StaticRoutes", "InraidStaticRouter"); con.registerType("StaticRoutes", "InraidStaticRouter");
depContainer.registerType("StaticRoutes", "InsuranceStaticRouter"); con.registerType("StaticRoutes", "InsuranceStaticRouter");
depContainer.registerType("StaticRoutes", "ItemEventStaticRouter"); con.registerType("StaticRoutes", "ItemEventStaticRouter");
depContainer.registerType("StaticRoutes", "LauncherStaticRouter"); con.registerType("StaticRoutes", "LauncherStaticRouter");
depContainer.registerType("StaticRoutes", "LocationStaticRouter"); con.registerType("StaticRoutes", "LocationStaticRouter");
depContainer.registerType("StaticRoutes", "WeatherStaticRouter"); con.registerType("StaticRoutes", "WeatherStaticRouter");
depContainer.registerType("StaticRoutes", "MatchStaticRouter"); con.registerType("StaticRoutes", "MatchStaticRouter");
depContainer.registerType("StaticRoutes", "QuestStaticRouter"); con.registerType("StaticRoutes", "QuestStaticRouter");
depContainer.registerType("StaticRoutes", "RagfairStaticRouter"); con.registerType("StaticRoutes", "RagfairStaticRouter");
depContainer.registerType("StaticRoutes", "PresetStaticRouter"); con.registerType("StaticRoutes", "PresetStaticRouter");
depContainer.registerType("StaticRoutes", "BundleStaticRouter"); con.registerType("StaticRoutes", "BundleStaticRouter");
depContainer.registerType("StaticRoutes", "NotifierStaticRouter"); con.registerType("StaticRoutes", "NotifierStaticRouter");
depContainer.registerType("StaticRoutes", "ProfileStaticRouter"); con.registerType("StaticRoutes", "ProfileStaticRouter");
depContainer.registerType("StaticRoutes", "TraderStaticRouter"); con.registerType("StaticRoutes", "TraderStaticRouter");
depContainer.registerType("DynamicRoutes", "BotDynamicRouter"); con.registerType("DynamicRoutes", "BotDynamicRouter");
depContainer.registerType("DynamicRoutes", "BundleDynamicRouter"); con.registerType("DynamicRoutes", "BundleDynamicRouter");
depContainer.registerType("DynamicRoutes", "CustomizationDynamicRouter"); con.registerType("DynamicRoutes", "CustomizationDynamicRouter");
depContainer.registerType("DynamicRoutes", "DataDynamicRouter"); con.registerType("DynamicRoutes", "DataDynamicRouter");
depContainer.registerType("DynamicRoutes", "HttpDynamicRouter"); con.registerType("DynamicRoutes", "HttpDynamicRouter");
depContainer.registerType("DynamicRoutes", "InraidDynamicRouter"); con.registerType("DynamicRoutes", "InraidDynamicRouter");
depContainer.registerType("DynamicRoutes", "LocationDynamicRouter"); con.registerType("DynamicRoutes", "LocationDynamicRouter");
depContainer.registerType("DynamicRoutes", "NotifierDynamicRouter"); con.registerType("DynamicRoutes", "NotifierDynamicRouter");
depContainer.registerType("DynamicRoutes", "TraderDynamicRouter"); con.registerType("DynamicRoutes", "TraderDynamicRouter");
depContainer.registerType("IERouters", "CustomizationItemEventRouter"); con.registerType("IERouters", "CustomizationItemEventRouter");
depContainer.registerType("IERouters", "HealthItemEventRouter"); con.registerType("IERouters", "HealthItemEventRouter");
depContainer.registerType("IERouters", "HideoutItemEventRouter"); con.registerType("IERouters", "HideoutItemEventRouter");
depContainer.registerType("IERouters", "InsuranceItemEventRouter"); con.registerType("IERouters", "InsuranceItemEventRouter");
depContainer.registerType("IERouters", "InventoryItemEventRouter"); con.registerType("IERouters", "InventoryItemEventRouter");
depContainer.registerType("IERouters", "NoteItemEventRouter"); con.registerType("IERouters", "NoteItemEventRouter");
depContainer.registerType("IERouters", "PresetBuildItemEventRouter"); con.registerType("IERouters", "PresetBuildItemEventRouter");
depContainer.registerType("IERouters", "QuestItemEventRouter"); con.registerType("IERouters", "QuestItemEventRouter");
depContainer.registerType("IERouters", "RagfairItemEventRouter"); con.registerType("IERouters", "RagfairItemEventRouter");
depContainer.registerType("IERouters", "RepairItemEventRouter"); con.registerType("IERouters", "RepairItemEventRouter");
depContainer.registerType("IERouters", "TradeItemEventRouter"); con.registerType("IERouters", "TradeItemEventRouter");
depContainer.registerType("IERouters", "WishlistItemEventRouter"); con.registerType("IERouters", "WishlistItemEventRouter");
depContainer.registerType("Serializer", "ImageSerializer"); con.registerType("Serializer", "ImageSerializer");
depContainer.registerType("Serializer", "BundleSerializer"); con.registerType("Serializer", "BundleSerializer");
depContainer.registerType("Serializer", "NotifySerializer"); con.registerType("Serializer", "NotifySerializer");
depContainer.registerType("SaveLoadRouter", "HealthSaveLoadRouter"); con.registerType("SaveLoadRouter", "HealthSaveLoadRouter");
depContainer.registerType("SaveLoadRouter", "InraidSaveLoadRouter"); con.registerType("SaveLoadRouter", "InraidSaveLoadRouter");
depContainer.registerType("SaveLoadRouter", "InsuranceSaveLoadRouter"); con.registerType("SaveLoadRouter", "InsuranceSaveLoadRouter");
depContainer.registerType("SaveLoadRouter", "ProfileSaveLoadRouter"); con.registerType("SaveLoadRouter", "ProfileSaveLoadRouter");
} }
private static registerUtils(depContainer: DependencyContainer): void private static registerUtils(con: DependencyContainer): void
{ {
// Utils // Utils
depContainer.register<App>("App", App, { lifecycle: Lifecycle.Singleton }); con.register<App>("App", App, { lifecycle: Lifecycle.Singleton });
depContainer.register<DatabaseImporter>("DatabaseImporter", DatabaseImporter, { con.register<DatabaseImporter>("DatabaseImporter", DatabaseImporter, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<HashUtil>("HashUtil", HashUtil, { lifecycle: Lifecycle.Singleton }); con.register<HashUtil>("HashUtil", HashUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<ImporterUtil>("ImporterUtil", ImporterUtil, { lifecycle: Lifecycle.Singleton }); con.register<ImporterUtil>("ImporterUtil", ImporterUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<HttpResponseUtil>("HttpResponseUtil", HttpResponseUtil); con.register<HttpResponseUtil>("HttpResponseUtil", HttpResponseUtil);
depContainer.register<EncodingUtil>("EncodingUtil", EncodingUtil, { lifecycle: Lifecycle.Singleton }); con.register<EncodingUtil>("EncodingUtil", EncodingUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<JsonUtil>("JsonUtil", JsonUtil); con.register<JsonUtil>("JsonUtil", JsonUtil);
depContainer.register<WinstonMainLogger>("WinstonLogger", WinstonMainLogger, { con.register<WinstonMainLogger>("WinstonLogger", WinstonMainLogger, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<WinstonRequestLogger>("RequestsLogger", WinstonRequestLogger, { con.register<WinstonRequestLogger>("RequestsLogger", WinstonRequestLogger, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<MathUtil>("MathUtil", MathUtil, { lifecycle: Lifecycle.Singleton }); con.register<MathUtil>("MathUtil", MathUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<ObjectId>("ObjectId", ObjectId); con.register<ObjectId>("ObjectId", ObjectId);
depContainer.register<RandomUtil>("RandomUtil", RandomUtil, { lifecycle: Lifecycle.Singleton }); con.register<RandomUtil>("RandomUtil", RandomUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<TimeUtil>("TimeUtil", TimeUtil, { lifecycle: Lifecycle.Singleton }); con.register<TimeUtil>("TimeUtil", TimeUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<VFS>("VFS", VFS, { lifecycle: Lifecycle.Singleton }); con.register<VFS>("VFS", VFS, { lifecycle: Lifecycle.Singleton });
depContainer.register<WatermarkLocale>("WatermarkLocale", WatermarkLocale, { lifecycle: Lifecycle.Singleton }); con.register<WatermarkLocale>("WatermarkLocale", WatermarkLocale, { lifecycle: Lifecycle.Singleton });
depContainer.register<Watermark>("Watermark", Watermark, { lifecycle: Lifecycle.Singleton }); con.register<Watermark>("Watermark", Watermark, { lifecycle: Lifecycle.Singleton });
depContainer.register<IAsyncQueue>("AsyncQueue", AsyncQueue, { lifecycle: Lifecycle.Singleton }); con.register<IAsyncQueue>("AsyncQueue", AsyncQueue, { lifecycle: Lifecycle.Singleton });
depContainer.register<HttpFileUtil>("HttpFileUtil", HttpFileUtil, { lifecycle: Lifecycle.Singleton }); con.register<HttpFileUtil>("HttpFileUtil", HttpFileUtil, { lifecycle: Lifecycle.Singleton });
depContainer.register<ModLoadOrder>("ModLoadOrder", ModLoadOrder, { lifecycle: Lifecycle.Singleton }); con.register<ModLoadOrder>("ModLoadOrder", ModLoadOrder, { lifecycle: Lifecycle.Singleton });
depContainer.register<ModTypeCheck>("ModTypeCheck", ModTypeCheck, { lifecycle: Lifecycle.Singleton }); con.register<ModTypeCheck>("ModTypeCheck", ModTypeCheck, { lifecycle: Lifecycle.Singleton });
} }
private static registerRouters(depContainer: DependencyContainer): void private static registerRouters(con: DependencyContainer): void
{ {
// Routers // Routers
depContainer.register<HttpRouter>("HttpRouter", HttpRouter, { lifecycle: Lifecycle.Singleton }); con.register<HttpRouter>("HttpRouter", HttpRouter, { lifecycle: Lifecycle.Singleton });
depContainer.register<ImageRouter>("ImageRouter", ImageRouter); con.register<ImageRouter>("ImageRouter", ImageRouter);
depContainer.register<EventOutputHolder>("EventOutputHolder", EventOutputHolder, { con.register<EventOutputHolder>("EventOutputHolder", EventOutputHolder, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<ItemEventRouter>("ItemEventRouter", ItemEventRouter); con.register<ItemEventRouter>("ItemEventRouter", ItemEventRouter);
// Dynamic routes // Dynamic routes
depContainer.register<BotDynamicRouter>("BotDynamicRouter", { useClass: BotDynamicRouter }); con.register<BotDynamicRouter>("BotDynamicRouter", { useClass: BotDynamicRouter });
depContainer.register<BundleDynamicRouter>("BundleDynamicRouter", { useClass: BundleDynamicRouter }); con.register<BundleDynamicRouter>("BundleDynamicRouter", { useClass: BundleDynamicRouter });
depContainer.register<CustomizationDynamicRouter>("CustomizationDynamicRouter", { con.register<CustomizationDynamicRouter>("CustomizationDynamicRouter", {
useClass: CustomizationDynamicRouter, useClass: CustomizationDynamicRouter,
}); });
depContainer.register<DataDynamicRouter>("DataDynamicRouter", { useClass: DataDynamicRouter }); con.register<DataDynamicRouter>("DataDynamicRouter", { useClass: DataDynamicRouter });
depContainer.register<HttpDynamicRouter>("HttpDynamicRouter", { useClass: HttpDynamicRouter }); con.register<HttpDynamicRouter>("HttpDynamicRouter", { useClass: HttpDynamicRouter });
depContainer.register<InraidDynamicRouter>("InraidDynamicRouter", { useClass: InraidDynamicRouter }); con.register<InraidDynamicRouter>("InraidDynamicRouter", { useClass: InraidDynamicRouter });
depContainer.register<LocationDynamicRouter>("LocationDynamicRouter", { useClass: LocationDynamicRouter }); con.register<LocationDynamicRouter>("LocationDynamicRouter", { useClass: LocationDynamicRouter });
depContainer.register<NotifierDynamicRouter>("NotifierDynamicRouter", { useClass: NotifierDynamicRouter }); con.register<NotifierDynamicRouter>("NotifierDynamicRouter", { useClass: NotifierDynamicRouter });
depContainer.register<TraderDynamicRouter>("TraderDynamicRouter", { useClass: TraderDynamicRouter }); con.register<TraderDynamicRouter>("TraderDynamicRouter", { useClass: TraderDynamicRouter });
// Item event routes // Item event routes
depContainer.register<CustomizationItemEventRouter>("CustomizationItemEventRouter", { con.register<CustomizationItemEventRouter>("CustomizationItemEventRouter", {
useClass: CustomizationItemEventRouter, useClass: CustomizationItemEventRouter,
}); });
depContainer.register<HealthItemEventRouter>("HealthItemEventRouter", { useClass: HealthItemEventRouter }); con.register<HealthItemEventRouter>("HealthItemEventRouter", { useClass: HealthItemEventRouter });
depContainer.register<HideoutItemEventRouter>("HideoutItemEventRouter", { useClass: HideoutItemEventRouter }); con.register<HideoutItemEventRouter>("HideoutItemEventRouter", { useClass: HideoutItemEventRouter });
depContainer.register<InsuranceItemEventRouter>("InsuranceItemEventRouter", { con.register<InsuranceItemEventRouter>("InsuranceItemEventRouter", { useClass: InsuranceItemEventRouter });
useClass: InsuranceItemEventRouter, useClass: InsuranceItemEventRouter,
}); });
depContainer.register<InventoryItemEventRouter>("InventoryItemEventRouter", { con.register<InventoryItemEventRouter>("InventoryItemEventRouter", { useClass: InventoryItemEventRouter });
useClass: InventoryItemEventRouter, useClass: InventoryItemEventRouter,
}); });
depContainer.register<NoteItemEventRouter>("NoteItemEventRouter", { useClass: NoteItemEventRouter }); con.register<NoteItemEventRouter>("NoteItemEventRouter", { useClass: NoteItemEventRouter });
depContainer.register<PresetBuildItemEventRouter>("PresetBuildItemEventRouter", { con.register<PresetBuildItemEventRouter>("PresetBuildItemEventRouter", {
useClass: PresetBuildItemEventRouter, useClass: PresetBuildItemEventRouter,
}); });
depContainer.register<QuestItemEventRouter>("QuestItemEventRouter", { useClass: QuestItemEventRouter }); con.register<QuestItemEventRouter>("QuestItemEventRouter", { useClass: QuestItemEventRouter });
depContainer.register<RagfairItemEventRouter>("RagfairItemEventRouter", { useClass: RagfairItemEventRouter }); con.register<RagfairItemEventRouter>("RagfairItemEventRouter", { useClass: RagfairItemEventRouter });
depContainer.register<RepairItemEventRouter>("RepairItemEventRouter", { useClass: RepairItemEventRouter }); con.register<RepairItemEventRouter>("RepairItemEventRouter", { useClass: RepairItemEventRouter });
depContainer.register<TradeItemEventRouter>("TradeItemEventRouter", { useClass: TradeItemEventRouter }); con.register<TradeItemEventRouter>("TradeItemEventRouter", { useClass: TradeItemEventRouter });
depContainer.register<WishlistItemEventRouter>("WishlistItemEventRouter", { con.register<WishlistItemEventRouter>("WishlistItemEventRouter", { useClass: WishlistItemEventRouter });
useClass: WishlistItemEventRouter, useClass: WishlistItemEventRouter,
}); });
// save load routes // save load routes
depContainer.register<HealthSaveLoadRouter>("HealthSaveLoadRouter", { useClass: HealthSaveLoadRouter }); con.register<HealthSaveLoadRouter>("HealthSaveLoadRouter", { useClass: HealthSaveLoadRouter });
depContainer.register<InraidSaveLoadRouter>("InraidSaveLoadRouter", { useClass: InraidSaveLoadRouter }); con.register<InraidSaveLoadRouter>("InraidSaveLoadRouter", { useClass: InraidSaveLoadRouter });
depContainer.register<InsuranceSaveLoadRouter>("InsuranceSaveLoadRouter", { con.register<InsuranceSaveLoadRouter>("InsuranceSaveLoadRouter", { useClass: InsuranceSaveLoadRouter });
useClass: InsuranceSaveLoadRouter, useClass: InsuranceSaveLoadRouter,
}); });
depContainer.register<ProfileSaveLoadRouter>("ProfileSaveLoadRouter", { useClass: ProfileSaveLoadRouter }); con.register<ProfileSaveLoadRouter>("ProfileSaveLoadRouter", { useClass: ProfileSaveLoadRouter });
// Route serializers // Route serializers
depContainer.register<BundleSerializer>("BundleSerializer", { useClass: BundleSerializer }); con.register<BundleSerializer>("BundleSerializer", { useClass: BundleSerializer });
depContainer.register<ImageSerializer>("ImageSerializer", { useClass: ImageSerializer }); con.register<ImageSerializer>("ImageSerializer", { useClass: ImageSerializer });
depContainer.register<NotifySerializer>("NotifySerializer", { useClass: NotifySerializer }); con.register<NotifySerializer>("NotifySerializer", { useClass: NotifySerializer });
// Static routes // Static routes
depContainer.register<BotStaticRouter>("BotStaticRouter", { useClass: BotStaticRouter }); con.register<BotStaticRouter>("BotStaticRouter", { useClass: BotStaticRouter });
depContainer.register<BundleStaticRouter>("BundleStaticRouter", { useClass: BundleStaticRouter }); con.register<BundleStaticRouter>("BundleStaticRouter", { useClass: BundleStaticRouter });
depContainer.register<ClientLogStaticRouter>("ClientLogStaticRouter", { useClass: ClientLogStaticRouter }); con.register<ClientLogStaticRouter>("ClientLogStaticRouter", { useClass: ClientLogStaticRouter });
depContainer.register<CustomizationStaticRouter>("CustomizationStaticRouter", { con.register<CustomizationStaticRouter>("CustomizationStaticRouter", { useClass: CustomizationStaticRouter });
useClass: CustomizationStaticRouter, useClass: CustomizationStaticRouter,
}); });
depContainer.register<DataStaticRouter>("DataStaticRouter", { useClass: DataStaticRouter }); con.register<DataStaticRouter>("DataStaticRouter", { useClass: DataStaticRouter });
depContainer.register<DialogStaticRouter>("DialogStaticRouter", { useClass: DialogStaticRouter }); con.register<DialogStaticRouter>("DialogStaticRouter", { useClass: DialogStaticRouter });
depContainer.register<GameStaticRouter>("GameStaticRouter", { useClass: GameStaticRouter }); con.register<GameStaticRouter>("GameStaticRouter", { useClass: GameStaticRouter });
depContainer.register<HealthStaticRouter>("HealthStaticRouter", { useClass: HealthStaticRouter }); con.register<HealthStaticRouter>("HealthStaticRouter", { useClass: HealthStaticRouter });
depContainer.register<InraidStaticRouter>("InraidStaticRouter", { useClass: InraidStaticRouter }); con.register<InraidStaticRouter>("InraidStaticRouter", { useClass: InraidStaticRouter });
depContainer.register<InsuranceStaticRouter>("InsuranceStaticRouter", { useClass: InsuranceStaticRouter }); con.register<InsuranceStaticRouter>("InsuranceStaticRouter", { useClass: InsuranceStaticRouter });
depContainer.register<ItemEventStaticRouter>("ItemEventStaticRouter", { useClass: ItemEventStaticRouter }); con.register<ItemEventStaticRouter>("ItemEventStaticRouter", { useClass: ItemEventStaticRouter });
depContainer.register<LauncherStaticRouter>("LauncherStaticRouter", { useClass: LauncherStaticRouter }); con.register<LauncherStaticRouter>("LauncherStaticRouter", { useClass: LauncherStaticRouter });
depContainer.register<LocationStaticRouter>("LocationStaticRouter", { useClass: LocationStaticRouter }); con.register<LocationStaticRouter>("LocationStaticRouter", { useClass: LocationStaticRouter });
depContainer.register<MatchStaticRouter>("MatchStaticRouter", { useClass: MatchStaticRouter }); con.register<MatchStaticRouter>("MatchStaticRouter", { useClass: MatchStaticRouter });
depContainer.register<NotifierStaticRouter>("NotifierStaticRouter", { useClass: NotifierStaticRouter }); con.register<NotifierStaticRouter>("NotifierStaticRouter", { useClass: NotifierStaticRouter });
depContainer.register<PresetStaticRouter>("PresetStaticRouter", { useClass: PresetStaticRouter }); con.register<PresetStaticRouter>("PresetStaticRouter", { useClass: PresetStaticRouter });
depContainer.register<ProfileStaticRouter>("ProfileStaticRouter", { useClass: ProfileStaticRouter }); con.register<ProfileStaticRouter>("ProfileStaticRouter", { useClass: ProfileStaticRouter });
depContainer.register<QuestStaticRouter>("QuestStaticRouter", { useClass: QuestStaticRouter }); con.register<QuestStaticRouter>("QuestStaticRouter", { useClass: QuestStaticRouter });
depContainer.register<RagfairStaticRouter>("RagfairStaticRouter", { useClass: RagfairStaticRouter }); con.register<RagfairStaticRouter>("RagfairStaticRouter", { useClass: RagfairStaticRouter });
depContainer.register<TraderStaticRouter>("TraderStaticRouter", { useClass: TraderStaticRouter }); con.register<TraderStaticRouter>("TraderStaticRouter", { useClass: TraderStaticRouter });
depContainer.register<WeatherStaticRouter>("WeatherStaticRouter", { useClass: WeatherStaticRouter }); con.register<WeatherStaticRouter>("WeatherStaticRouter", { useClass: WeatherStaticRouter });
} }
private static registerGenerators(depContainer: DependencyContainer): void private static registerGenerators(con: DependencyContainer): void
{ {
// Generators // Generators
depContainer.register<BotGenerator>("BotGenerator", BotGenerator); con.register<BotGenerator>("BotGenerator", BotGenerator);
depContainer.register<BotWeaponGenerator>("BotWeaponGenerator", BotWeaponGenerator); con.register<BotWeaponGenerator>("BotWeaponGenerator", BotWeaponGenerator);
depContainer.register<BotLootGenerator>("BotLootGenerator", BotLootGenerator); con.register<BotLootGenerator>("BotLootGenerator", BotLootGenerator);
depContainer.register<BotInventoryGenerator>("BotInventoryGenerator", BotInventoryGenerator); con.register<BotInventoryGenerator>("BotInventoryGenerator", BotInventoryGenerator);
depContainer.register<LocationGenerator>("LocationGenerator", { useClass: LocationGenerator }); con.register<LocationGenerator>("LocationGenerator", { useClass: LocationGenerator });
depContainer.register<PMCLootGenerator>("PMCLootGenerator", PMCLootGenerator, { con.register<PMCLootGenerator>("PMCLootGenerator", PMCLootGenerator, { lifecycle: Lifecycle.Singleton });
con.register<ScavCaseRewardGenerator>("ScavCaseRewardGenerator", ScavCaseRewardGenerator, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<ScavCaseRewardGenerator>("ScavCaseRewardGenerator", ScavCaseRewardGenerator, { depContainer.register<ScavCaseRewardGenerator>("ScavCaseRewardGenerator", ScavCaseRewardGenerator, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairAssortGenerator>("RagfairAssortGenerator", { useClass: RagfairAssortGenerator }); con.register<RagfairAssortGenerator>("RagfairAssortGenerator", { useClass: RagfairAssortGenerator });
depContainer.register<RagfairOfferGenerator>("RagfairOfferGenerator", { useClass: RagfairOfferGenerator }); con.register<RagfairOfferGenerator>("RagfairOfferGenerator", { useClass: RagfairOfferGenerator });
depContainer.register<WeatherGenerator>("WeatherGenerator", { useClass: WeatherGenerator }); con.register<WeatherGenerator>("WeatherGenerator", { useClass: WeatherGenerator });
depContainer.register<PlayerScavGenerator>("PlayerScavGenerator", { useClass: PlayerScavGenerator }); con.register<PlayerScavGenerator>("PlayerScavGenerator", { useClass: PlayerScavGenerator });
depContainer.register<LootGenerator>("LootGenerator", { useClass: LootGenerator }); con.register<LootGenerator>("LootGenerator", { useClass: LootGenerator });
depContainer.register<FenceBaseAssortGenerator>("FenceBaseAssortGenerator", { con.register<FenceBaseAssortGenerator>("FenceBaseAssortGenerator", { useClass: FenceBaseAssortGenerator });
useClass: FenceBaseAssortGenerator, useClass: FenceBaseAssortGenerator,
}); });
depContainer.register<BotLevelGenerator>("BotLevelGenerator", { useClass: BotLevelGenerator }); con.register<BotLevelGenerator>("BotLevelGenerator", { useClass: BotLevelGenerator });
depContainer.register<BotEquipmentModGenerator>("BotEquipmentModGenerator", { con.register<BotEquipmentModGenerator>("BotEquipmentModGenerator", { useClass: BotEquipmentModGenerator });
useClass: BotEquipmentModGenerator, useClass: BotEquipmentModGenerator,
}); });
depContainer.register<RepeatableQuestGenerator>("RepeatableQuestGenerator", { con.register<RepeatableQuestGenerator>("RepeatableQuestGenerator", { useClass: RepeatableQuestGenerator });
useClass: RepeatableQuestGenerator,
});
depContainer.register<BarrelInventoryMagGen>("BarrelInventoryMagGen", { useClass: BarrelInventoryMagGen }); con.register<BarrelInventoryMagGen>("BarrelInventoryMagGen", { useClass: BarrelInventoryMagGen });
depContainer.register<ExternalInventoryMagGen>("ExternalInventoryMagGen", { con.register<ExternalInventoryMagGen>("ExternalInventoryMagGen", { useClass: ExternalInventoryMagGen });
useClass: ExternalInventoryMagGen, useClass: ExternalInventoryMagGen,
}); });
depContainer.register<InternalMagazineInventoryMagGen>("InternalMagazineInventoryMagGen", { con.register<InternalMagazineInventoryMagGen>("InternalMagazineInventoryMagGen", {
useClass: InternalMagazineInventoryMagGen, useClass: InternalMagazineInventoryMagGen,
}); });
depContainer.register<UbglExternalMagGen>("UbglExternalMagGen", { useClass: UbglExternalMagGen }); con.register<UbglExternalMagGen>("UbglExternalMagGen", { useClass: UbglExternalMagGen });
depContainer.registerType("InventoryMagGen", "BarrelInventoryMagGen"); con.registerType("InventoryMagGen", "BarrelInventoryMagGen");
depContainer.registerType("InventoryMagGen", "ExternalInventoryMagGen"); con.registerType("InventoryMagGen", "ExternalInventoryMagGen");
depContainer.registerType("InventoryMagGen", "InternalMagazineInventoryMagGen"); con.registerType("InventoryMagGen", "InternalMagazineInventoryMagGen");
depContainer.registerType("InventoryMagGen", "UbglExternalMagGen"); con.registerType("InventoryMagGen", "UbglExternalMagGen");
} }
private static registerHelpers(depContainer: DependencyContainer): void private static registerHelpers(con: DependencyContainer): void
{ {
// Helpers // Helpers
depContainer.register<AssortHelper>("AssortHelper", { useClass: AssortHelper }); con.register<AssortHelper>("AssortHelper", { useClass: AssortHelper });
depContainer.register<BotHelper>("BotHelper", { useClass: BotHelper }); con.register<BotHelper>("BotHelper", { useClass: BotHelper });
depContainer.register<BotGeneratorHelper>("BotGeneratorHelper", { useClass: BotGeneratorHelper }); con.register<BotGeneratorHelper>("BotGeneratorHelper", { useClass: BotGeneratorHelper });
depContainer.register<ContainerHelper>("ContainerHelper", ContainerHelper); con.register<ContainerHelper>("ContainerHelper", ContainerHelper);
depContainer.register<DialogueHelper>("DialogueHelper", { useClass: DialogueHelper }); con.register<DialogueHelper>("DialogueHelper", { useClass: DialogueHelper });
depContainer.register<DurabilityLimitsHelper>("DurabilityLimitsHelper", { useClass: DurabilityLimitsHelper }); con.register<DurabilityLimitsHelper>("DurabilityLimitsHelper", { useClass: DurabilityLimitsHelper });
depContainer.register<GameEventHelper>("GameEventHelper", GameEventHelper); con.register<GameEventHelper>("GameEventHelper", GameEventHelper);
depContainer.register<HandbookHelper>("HandbookHelper", HandbookHelper, { lifecycle: Lifecycle.Singleton }); con.register<HandbookHelper>("HandbookHelper", HandbookHelper, { lifecycle: Lifecycle.Singleton });
depContainer.register<HealthHelper>("HealthHelper", { useClass: HealthHelper }); con.register<HealthHelper>("HealthHelper", { useClass: HealthHelper });
depContainer.register<HideoutHelper>("HideoutHelper", { useClass: HideoutHelper }); con.register<HideoutHelper>("HideoutHelper", { useClass: HideoutHelper });
depContainer.register<InRaidHelper>("InRaidHelper", { useClass: InRaidHelper }); con.register<InRaidHelper>("InRaidHelper", { useClass: InRaidHelper });
depContainer.register<InventoryHelper>("InventoryHelper", { useClass: InventoryHelper }); con.register<InventoryHelper>("InventoryHelper", { useClass: InventoryHelper });
depContainer.register<PaymentHelper>("PaymentHelper", PaymentHelper); con.register<PaymentHelper>("PaymentHelper", PaymentHelper);
depContainer.register<ItemHelper>("ItemHelper", { useClass: ItemHelper }); con.register<ItemHelper>("ItemHelper", { useClass: ItemHelper });
depContainer.register<PresetHelper>("PresetHelper", PresetHelper, { lifecycle: Lifecycle.Singleton }); con.register<PresetHelper>("PresetHelper", PresetHelper, { lifecycle: Lifecycle.Singleton });
depContainer.register<ProfileHelper>("ProfileHelper", { useClass: ProfileHelper }); con.register<ProfileHelper>("ProfileHelper", { useClass: ProfileHelper });
depContainer.register<QuestHelper>("QuestHelper", { useClass: QuestHelper }); con.register<QuestHelper>("QuestHelper", { useClass: QuestHelper });
depContainer.register<QuestConditionHelper>("QuestConditionHelper", QuestConditionHelper); con.register<QuestConditionHelper>("QuestConditionHelper", QuestConditionHelper);
depContainer.register<RagfairHelper>("RagfairHelper", { useClass: RagfairHelper }); con.register<RagfairHelper>("RagfairHelper", { useClass: RagfairHelper });
depContainer.register<RagfairSortHelper>("RagfairSortHelper", { useClass: RagfairSortHelper }); con.register<RagfairSortHelper>("RagfairSortHelper", { useClass: RagfairSortHelper });
depContainer.register<RagfairSellHelper>("RagfairSellHelper", { useClass: RagfairSellHelper }); con.register<RagfairSellHelper>("RagfairSellHelper", { useClass: RagfairSellHelper });
depContainer.register<RagfairOfferHelper>("RagfairOfferHelper", { useClass: RagfairOfferHelper }); con.register<RagfairOfferHelper>("RagfairOfferHelper", { useClass: RagfairOfferHelper });
depContainer.register<RagfairServerHelper>("RagfairServerHelper", { useClass: RagfairServerHelper }); con.register<RagfairServerHelper>("RagfairServerHelper", { useClass: RagfairServerHelper });
depContainer.register<RepairHelper>("RepairHelper", { useClass: RepairHelper }); con.register<RepairHelper>("RepairHelper", { useClass: RepairHelper });
depContainer.register<TraderHelper>("TraderHelper", TraderHelper); con.register<TraderHelper>("TraderHelper", TraderHelper);
depContainer.register<TraderAssortHelper>("TraderAssortHelper", TraderAssortHelper, { con.register<TraderAssortHelper>("TraderAssortHelper", TraderAssortHelper, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<TradeHelper>("TradeHelper", { useClass: TradeHelper }); con.register<TradeHelper>("TradeHelper", { useClass: TradeHelper });
depContainer.register<NotifierHelper>("NotifierHelper", { useClass: NotifierHelper }); con.register<NotifierHelper>("NotifierHelper", { useClass: NotifierHelper });
depContainer.register<UtilityHelper>("UtilityHelper", UtilityHelper); con.register<UtilityHelper>("UtilityHelper", UtilityHelper);
depContainer.register<WeightedRandomHelper>("WeightedRandomHelper", { useClass: WeightedRandomHelper }); con.register<WeightedRandomHelper>("WeightedRandomHelper", { useClass: WeightedRandomHelper });
depContainer.register<HttpServerHelper>("HttpServerHelper", { useClass: HttpServerHelper }); con.register<HttpServerHelper>("HttpServerHelper", { useClass: HttpServerHelper });
depContainer.register<NotificationSendHelper>("NotificationSendHelper", { useClass: NotificationSendHelper }); con.register<NotificationSendHelper>("NotificationSendHelper", { useClass: NotificationSendHelper });
depContainer.register<SecureContainerHelper>("SecureContainerHelper", { useClass: SecureContainerHelper }); con.register<SecureContainerHelper>("SecureContainerHelper", { useClass: SecureContainerHelper });
depContainer.register<ProbabilityHelper>("ProbabilityHelper", { useClass: ProbabilityHelper }); con.register<ProbabilityHelper>("ProbabilityHelper", { useClass: ProbabilityHelper });
depContainer.register<BotWeaponGeneratorHelper>("BotWeaponGeneratorHelper", { con.register<BotWeaponGeneratorHelper>("BotWeaponGeneratorHelper", { useClass: BotWeaponGeneratorHelper });
useClass: BotWeaponGeneratorHelper, useClass: BotWeaponGeneratorHelper,
}); });
depContainer.register<BotDifficultyHelper>("BotDifficultyHelper", { useClass: BotDifficultyHelper }); con.register<BotDifficultyHelper>("BotDifficultyHelper", { useClass: BotDifficultyHelper });
depContainer.register<RepeatableQuestHelper>("RepeatableQuestHelper", { useClass: RepeatableQuestHelper }); con.register<RepeatableQuestHelper>("RepeatableQuestHelper", { useClass: RepeatableQuestHelper });
} }
private static registerLoaders(depContainer: DependencyContainer): void private static registerLoaders(con: DependencyContainer): void
{ {
// Loaders // Loaders
depContainer.register<BundleLoader>("BundleLoader", BundleLoader, { lifecycle: Lifecycle.Singleton }); con.register<BundleLoader>("BundleLoader", BundleLoader, { lifecycle: Lifecycle.Singleton });
depContainer.register<PreAkiModLoader>("PreAkiModLoader", PreAkiModLoader, { lifecycle: Lifecycle.Singleton }); con.register<PreAkiModLoader>("PreAkiModLoader", PreAkiModLoader, { lifecycle: Lifecycle.Singleton });
depContainer.register<PostAkiModLoader>("PostAkiModLoader", PostAkiModLoader, { con.register<PostAkiModLoader>("PostAkiModLoader", PostAkiModLoader, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
} }
private static registerCallbacks(depContainer: DependencyContainer): void private static registerCallbacks(con: DependencyContainer): void
{ {
// Callbacks // Callbacks
depContainer.register<BotCallbacks>("BotCallbacks", { useClass: BotCallbacks }); con.register<BotCallbacks>("BotCallbacks", { useClass: BotCallbacks });
depContainer.register<BundleCallbacks>("BundleCallbacks", { useClass: BundleCallbacks }); con.register<BundleCallbacks>("BundleCallbacks", { useClass: BundleCallbacks });
depContainer.register<ClientLogCallbacks>("ClientLogCallbacks", { useClass: ClientLogCallbacks }); con.register<ClientLogCallbacks>("ClientLogCallbacks", { useClass: ClientLogCallbacks });
depContainer.register<CustomizationCallbacks>("CustomizationCallbacks", { useClass: CustomizationCallbacks }); con.register<CustomizationCallbacks>("CustomizationCallbacks", { useClass: CustomizationCallbacks });
depContainer.register<DataCallbacks>("DataCallbacks", { useClass: DataCallbacks }); con.register<DataCallbacks>("DataCallbacks", { useClass: DataCallbacks });
depContainer.register<DialogueCallbacks>("DialogueCallbacks", { useClass: DialogueCallbacks }); con.register<DialogueCallbacks>("DialogueCallbacks", { useClass: DialogueCallbacks });
depContainer.register<GameCallbacks>("GameCallbacks", { useClass: GameCallbacks }); con.register<GameCallbacks>("GameCallbacks", { useClass: GameCallbacks });
depContainer.register<HandbookCallbacks>("HandbookCallbacks", { useClass: HandbookCallbacks }); con.register<HandbookCallbacks>("HandbookCallbacks", { useClass: HandbookCallbacks });
depContainer.register<HealthCallbacks>("HealthCallbacks", { useClass: HealthCallbacks }); con.register<HealthCallbacks>("HealthCallbacks", { useClass: HealthCallbacks });
depContainer.register<HideoutCallbacks>("HideoutCallbacks", { useClass: HideoutCallbacks }); con.register<HideoutCallbacks>("HideoutCallbacks", { useClass: HideoutCallbacks });
depContainer.register<HttpCallbacks>("HttpCallbacks", { useClass: HttpCallbacks }); con.register<HttpCallbacks>("HttpCallbacks", { useClass: HttpCallbacks });
depContainer.register<InraidCallbacks>("InraidCallbacks", { useClass: InraidCallbacks }); con.register<InraidCallbacks>("InraidCallbacks", { useClass: InraidCallbacks });
depContainer.register<InsuranceCallbacks>("InsuranceCallbacks", { useClass: InsuranceCallbacks }); con.register<InsuranceCallbacks>("InsuranceCallbacks", { useClass: InsuranceCallbacks });
depContainer.register<InventoryCallbacks>("InventoryCallbacks", { useClass: InventoryCallbacks }); con.register<InventoryCallbacks>("InventoryCallbacks", { useClass: InventoryCallbacks });
depContainer.register<ItemEventCallbacks>("ItemEventCallbacks", { useClass: ItemEventCallbacks }); con.register<ItemEventCallbacks>("ItemEventCallbacks", { useClass: ItemEventCallbacks });
depContainer.register<LauncherCallbacks>("LauncherCallbacks", { useClass: LauncherCallbacks }); con.register<LauncherCallbacks>("LauncherCallbacks", { useClass: LauncherCallbacks });
depContainer.register<LocationCallbacks>("LocationCallbacks", { useClass: LocationCallbacks }); con.register<LocationCallbacks>("LocationCallbacks", { useClass: LocationCallbacks });
depContainer.register<MatchCallbacks>("MatchCallbacks", { useClass: MatchCallbacks }); con.register<MatchCallbacks>("MatchCallbacks", { useClass: MatchCallbacks });
depContainer.register<ModCallbacks>("ModCallbacks", { useClass: ModCallbacks }); con.register<ModCallbacks>("ModCallbacks", { useClass: ModCallbacks });
depContainer.register<PostDBModLoader>("PostDBModLoader", { useClass: PostDBModLoader }); con.register<PostDBModLoader>("PostDBModLoader", { useClass: PostDBModLoader });
depContainer.register<NoteCallbacks>("NoteCallbacks", { useClass: NoteCallbacks }); con.register<NoteCallbacks>("NoteCallbacks", { useClass: NoteCallbacks });
depContainer.register<NotifierCallbacks>("NotifierCallbacks", { useClass: NotifierCallbacks }); con.register<NotifierCallbacks>("NotifierCallbacks", { useClass: NotifierCallbacks });
depContainer.register<PresetBuildCallbacks>("PresetBuildCallbacks", { useClass: PresetBuildCallbacks }); con.register<PresetBuildCallbacks>("PresetBuildCallbacks", { useClass: PresetBuildCallbacks });
depContainer.register<PresetCallbacks>("PresetCallbacks", { useClass: PresetCallbacks }); con.register<PresetCallbacks>("PresetCallbacks", { useClass: PresetCallbacks });
depContainer.register<ProfileCallbacks>("ProfileCallbacks", { useClass: ProfileCallbacks }); con.register<ProfileCallbacks>("ProfileCallbacks", { useClass: ProfileCallbacks });
depContainer.register<QuestCallbacks>("QuestCallbacks", { useClass: QuestCallbacks }); con.register<QuestCallbacks>("QuestCallbacks", { useClass: QuestCallbacks });
depContainer.register<RagfairCallbacks>("RagfairCallbacks", { useClass: RagfairCallbacks }); con.register<RagfairCallbacks>("RagfairCallbacks", { useClass: RagfairCallbacks });
depContainer.register<RepairCallbacks>("RepairCallbacks", { useClass: RepairCallbacks }); con.register<RepairCallbacks>("RepairCallbacks", { useClass: RepairCallbacks });
depContainer.register<SaveCallbacks>("SaveCallbacks", { useClass: SaveCallbacks }); con.register<SaveCallbacks>("SaveCallbacks", { useClass: SaveCallbacks });
depContainer.register<TradeCallbacks>("TradeCallbacks", { useClass: TradeCallbacks }); con.register<TradeCallbacks>("TradeCallbacks", { useClass: TradeCallbacks });
depContainer.register<TraderCallbacks>("TraderCallbacks", { useClass: TraderCallbacks }); con.register<TraderCallbacks>("TraderCallbacks", { useClass: TraderCallbacks });
depContainer.register<WeatherCallbacks>("WeatherCallbacks", { useClass: WeatherCallbacks }); con.register<WeatherCallbacks>("WeatherCallbacks", { useClass: WeatherCallbacks });
depContainer.register<WishlistCallbacks>("WishlistCallbacks", { useClass: WishlistCallbacks }); con.register<WishlistCallbacks>("WishlistCallbacks", { useClass: WishlistCallbacks });
} }
private static registerServices(depContainer: DependencyContainer): void private static registerServices(con: DependencyContainer): void
{ {
// Services // Services
depContainer.register<ImageRouteService>("ImageRouteService", ImageRouteService, { con.register<ImageRouteService>("ImageRouteService", ImageRouteService, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<FenceService>("FenceService", FenceService, { lifecycle: Lifecycle.Singleton }); con.register<FenceService>("FenceService", FenceService, { lifecycle: Lifecycle.Singleton });
depContainer.register<PlayerService>("PlayerService", { useClass: PlayerService }); con.register<PlayerService>("PlayerService", { useClass: PlayerService });
depContainer.register<PaymentService>("PaymentService", { useClass: PaymentService }); con.register<PaymentService>("PaymentService", { useClass: PaymentService });
depContainer.register<InsuranceService>("InsuranceService", InsuranceService, { con.register<InsuranceService>("InsuranceService", InsuranceService, { lifecycle: Lifecycle.Singleton });
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<TraderAssortService>("TraderAssortService", TraderAssortService, { con.register<TraderAssortService>("TraderAssortService", TraderAssortService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairPriceService>("RagfairPriceService", RagfairPriceService, { con.register<RagfairPriceService>("RagfairPriceService", RagfairPriceService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairCategoriesService>("RagfairCategoriesService", RagfairCategoriesService, { con.register<RagfairCategoriesService>("RagfairCategoriesService", RagfairCategoriesService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairOfferService>("RagfairOfferService", RagfairOfferService, { con.register<RagfairOfferService>("RagfairOfferService", RagfairOfferService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairLinkedItemService>("RagfairLinkedItemService", RagfairLinkedItemService, { con.register<RagfairLinkedItemService>("RagfairLinkedItemService", RagfairLinkedItemService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairRequiredItemsService>("RagfairRequiredItemsService", RagfairRequiredItemsService, { con.register<RagfairRequiredItemsService>("RagfairRequiredItemsService", RagfairRequiredItemsService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<NotificationService>("NotificationService", NotificationService, { con.register<NotificationService>("NotificationService", NotificationService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<MatchLocationService>("MatchLocationService", MatchLocationService, { depContainer.register<MatchLocationService>("MatchLocationService", MatchLocationService, {
@ -661,95 +652,105 @@ export class Container
depContainer.register<BotLootCacheService>("BotLootCacheService", BotLootCacheService, { depContainer.register<BotLootCacheService>("BotLootCacheService", BotLootCacheService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<CustomItemService>("CustomItemService", CustomItemService); con.register<MatchLocationService>("MatchLocationService", MatchLocationService, {
depContainer.register<BotEquipmentFilterService>("BotEquipmentFilterService", BotEquipmentFilterService); depContainer.register<BotEquipmentFilterService>("BotEquipmentFilterService", BotEquipmentFilterService);
depContainer.register<ProfileSnapshotService>("ProfileSnapshotService", ProfileSnapshotService, { depContainer.register<ProfileSnapshotService>("ProfileSnapshotService", ProfileSnapshotService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<ItemFilterService>("ItemFilterService", ItemFilterService, { con.register<ModCompilerService>("ModCompilerService", ModCompilerService);
con.register<HashCacheService>("HashCacheService", HashCacheService, { lifecycle: Lifecycle.Singleton });
con.register<LocaleService>("LocaleService", LocaleService, { lifecycle: Lifecycle.Singleton });
con.register<ProfileFixerService>("ProfileFixerService", ProfileFixerService);
con.register<RepairService>("RepairService", RepairService);
con.register<BotLootCacheService>("BotLootCacheService", BotLootCacheService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<BotGenerationCacheService>("BotGenerationCacheService", BotGenerationCacheService, { con.register<CustomItemService>("CustomItemService", CustomItemService);
con.register<BotEquipmentFilterService>("BotEquipmentFilterService", BotEquipmentFilterService);
con.register<ProfileSnapshotService>("ProfileSnapshotService", ProfileSnapshotService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<LocalisationService>("LocalisationService", LocalisationService, { con.register<ItemFilterService>("ItemFilterService", ItemFilterService, { lifecycle: Lifecycle.Singleton });
con.register<BotGenerationCacheService>("BotGenerationCacheService", BotGenerationCacheService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<CustomLocationWaveService>("CustomLocationWaveService", CustomLocationWaveService, { con.register<LocalisationService>("LocalisationService", LocalisationService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<OpenZoneService>("OpenZoneService", OpenZoneService, { lifecycle: Lifecycle.Singleton }); con.register<CustomLocationWaveService>("CustomLocationWaveService", CustomLocationWaveService, {
depContainer.register<ItemBaseClassService>("ItemBaseClassService", ItemBaseClassService, { depContainer.register<ItemBaseClassService>("ItemBaseClassService", ItemBaseClassService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<BotEquipmentModPoolService>("BotEquipmentModPoolService", BotEquipmentModPoolService, { con.register<OpenZoneService>("OpenZoneService", OpenZoneService, { lifecycle: Lifecycle.Singleton });
con.register<ItemBaseClassService>("ItemBaseClassService", ItemBaseClassService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<BotWeaponModLimitService>("BotWeaponModLimitService", BotWeaponModLimitService, { con.register<BotEquipmentModPoolService>("BotEquipmentModPoolService", BotEquipmentModPoolService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<SeasonalEventService>("SeasonalEventService", SeasonalEventService, { con.register<BotWeaponModLimitService>("BotWeaponModLimitService", BotWeaponModLimitService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<MatchBotDetailsCacheService>("MatchBotDetailsCacheService", MatchBotDetailsCacheService, { con.register<SeasonalEventService>("SeasonalEventService", SeasonalEventService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<RagfairTaxService>("RagfairTaxService", RagfairTaxService, { con.register<MatchBotDetailsCacheService>("MatchBotDetailsCacheService", MatchBotDetailsCacheService, {
lifecycle: Lifecycle.Singleton, lifecycle: Lifecycle.Singleton,
}); });
depContainer.register<TraderPurchasePersisterService>( con.register<RagfairTaxService>("RagfairTaxService", RagfairTaxService, { lifecycle: Lifecycle.Singleton });
con.register<TraderPurchasePersisterService>("TraderPurchasePersisterService", TraderPurchasePersisterService);
"TraderPurchasePersisterService", "TraderPurchasePersisterService",
TraderPurchasePersisterService, TraderPurchasePersisterService,
); );
depContainer.register<PmcChatResponseService>("PmcChatResponseService", PmcChatResponseService); con.register<PmcChatResponseService>("PmcChatResponseService", PmcChatResponseService);
depContainer.register<GiftService>("GiftService", GiftService); con.register<GiftService>("GiftService", GiftService);
depContainer.register<MailSendService>("MailSendService", MailSendService); con.register<MailSendService>("MailSendService", MailSendService);
} }
private static registerServers(depContainer: DependencyContainer): void private static registerServers(con: DependencyContainer): void
{ {
// Servers // Servers
depContainer.register<DatabaseServer>("DatabaseServer", DatabaseServer, { lifecycle: Lifecycle.Singleton }); con.register<DatabaseServer>("DatabaseServer", DatabaseServer, { lifecycle: Lifecycle.Singleton });
depContainer.register<HttpServer>("HttpServer", HttpServer, { lifecycle: Lifecycle.Singleton }); con.register<HttpServer>("HttpServer", HttpServer, { lifecycle: Lifecycle.Singleton });
depContainer.register<WebSocketServer>("WebSocketServer", WebSocketServer, { lifecycle: Lifecycle.Singleton }); con.register<WebSocketServer>("WebSocketServer", WebSocketServer, { lifecycle: Lifecycle.Singleton });
depContainer.register<RagfairServer>("RagfairServer", RagfairServer); con.register<RagfairServer>("RagfairServer", RagfairServer);
depContainer.register<SaveServer>("SaveServer", SaveServer, { lifecycle: Lifecycle.Singleton }); con.register<SaveServer>("SaveServer", SaveServer, { lifecycle: Lifecycle.Singleton });
depContainer.register<ConfigServer>("ConfigServer", ConfigServer, { lifecycle: Lifecycle.Singleton }); con.register<ConfigServer>("ConfigServer", ConfigServer, { lifecycle: Lifecycle.Singleton });
} }
private static registerControllers(depContainer: DependencyContainer): void private static registerControllers(con: DependencyContainer): void
{ {
// Controllers // Controllers
depContainer.register<BotController>("BotController", { useClass: BotController }); con.register<BotController>("BotController", { useClass: BotController });
depContainer.register<ClientLogController>("ClientLogController", { useClass: ClientLogController }); con.register<ClientLogController>("ClientLogController", { useClass: ClientLogController });
depContainer.register<CustomizationController>("CustomizationController", { con.register<CustomizationController>("CustomizationController", { useClass: CustomizationController });
useClass: CustomizationController, useClass: CustomizationController,
}); });
depContainer.register<DialogueController>("DialogueController", { useClass: DialogueController }); con.register<DialogueController>("DialogueController", { useClass: DialogueController });
depContainer.register<GameController>("GameController", { useClass: GameController }); con.register<GameController>("GameController", { useClass: GameController });
depContainer.register<HandbookController>("HandbookController", { useClass: HandbookController }); con.register<HandbookController>("HandbookController", { useClass: HandbookController });
depContainer.register<HealthController>("HealthController", { useClass: HealthController }); con.register<HealthController>("HealthController", { useClass: HealthController });
depContainer.register<HideoutController>("HideoutController", { useClass: HideoutController }); con.register<HideoutController>("HideoutController", { useClass: HideoutController });
depContainer.register<InraidController>("InraidController", { useClass: InraidController }); con.register<InraidController>("InraidController", { useClass: InraidController });
depContainer.register<InsuranceController>("InsuranceController", { useClass: InsuranceController }); con.register<InsuranceController>("InsuranceController", { useClass: InsuranceController });
depContainer.register<InventoryController>("InventoryController", { useClass: InventoryController }); con.register<InventoryController>("InventoryController", { useClass: InventoryController });
depContainer.register<LauncherController>("LauncherController", { useClass: LauncherController }); con.register<LauncherController>("LauncherController", { useClass: LauncherController });
depContainer.register<LocationController>("LocationController", { useClass: LocationController }); con.register<LocationController>("LocationController", { useClass: LocationController });
depContainer.register<MatchController>("MatchController", MatchController); con.register<MatchController>("MatchController", MatchController);
depContainer.register<NoteController>("NoteController", { useClass: NoteController }); con.register<NoteController>("NoteController", { useClass: NoteController });
depContainer.register<NotifierController>("NotifierController", { useClass: NotifierController }); con.register<NotifierController>("NotifierController", { useClass: NotifierController });
depContainer.register<PresetBuildController>("PresetBuildController", { useClass: PresetBuildController }); con.register<PresetBuildController>("PresetBuildController", { useClass: PresetBuildController });
depContainer.register<PresetController>("PresetController", { useClass: PresetController }); con.register<PresetController>("PresetController", { useClass: PresetController });
depContainer.register<ProfileController>("ProfileController", { useClass: ProfileController }); con.register<ProfileController>("ProfileController", { useClass: ProfileController });
depContainer.register<QuestController>("QuestController", { useClass: QuestController }); con.register<QuestController>("QuestController", { useClass: QuestController });
depContainer.register<RagfairController>("RagfairController", { useClass: RagfairController }); con.register<RagfairController>("RagfairController", { useClass: RagfairController });
depContainer.register<RepairController>("RepairController", { useClass: RepairController }); con.register<RepairController>("RepairController", { useClass: RepairController });
depContainer.register<RepeatableQuestController>("RepeatableQuestController", { con.register<RepeatableQuestController>("RepeatableQuestController", { useClass: RepeatableQuestController });
useClass: RepeatableQuestController, useClass: RepeatableQuestController,
}); });
depContainer.register<TradeController>("TradeController", { useClass: TradeController }); con.register<TradeController>("TradeController", { useClass: TradeController });
depContainer.register<TraderController>("TraderController", { useClass: TraderController }); con.register<TraderController>("TraderController", { useClass: TraderController });
depContainer.register<WeatherController>("WeatherController", { useClass: WeatherController }); con.register<WeatherController>("WeatherController", { useClass: WeatherController });
depContainer.register<WishlistController>("WishlistController", WishlistController); con.register<WishlistController>("WishlistController", WishlistController);
} }
} }

View File

@ -1,6 +1,5 @@
export interface OnUpdate export interface OnUpdate
{ {
onUpdate(timeSinceLastRun: number): Promise<boolean>; onUpdate(timeSinceLastRun: number): Promise<boolean>;
getRoute(): string; getRoute(): string;
} }

View File

@ -78,10 +78,6 @@ export class DynamicRouter extends Router
// So instead I added the definition // So instead I added the definition
export class ItemEventRouterDefinition extends Router export class ItemEventRouterDefinition extends Router
{ {
constructor()
{
super();
}
public handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse public handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse
{ {
throw new Error("This method needs to be overrode by the router classes"); throw new Error("This method needs to be overrode by the router classes");
@ -90,10 +86,6 @@ export class ItemEventRouterDefinition extends Router
export class SaveLoadRouter extends Router export class SaveLoadRouter extends Router
{ {
constructor()
{
super();
}
public handleLoad(profile: IAkiProfile): IAkiProfile public handleLoad(profile: IAkiProfile): IAkiProfile
{ {
throw new Error("This method needs to be overrode by the router classes"); throw new Error("This method needs to be overrode by the router classes");

View File

@ -120,7 +120,7 @@ export class BotEquipmentModGenerator
} }
} }
// Combatible item not found but slot REQUIRES item, get random item from db // Compatible item not found but slot REQUIRES item, get random item from db
const parentSlot = parentTemplate._props.Slots.find((i) => i._name === modSlot); const parentSlot = parentTemplate._props.Slots.find((i) => i._name === modSlot);
if (!found && parentSlot !== undefined && parentSlot._required) if (!found && parentSlot !== undefined && parentSlot._required)
{ {
@ -131,7 +131,7 @@ export class BotEquipmentModGenerator
// Compatible item not found + not required // Compatible item not found + not required
if (!found && parentSlot !== undefined && !parentSlot._required) if (!found && parentSlot !== undefined && !parentSlot._required)
{ {
// Dont add item // Don't add item
continue; continue;
} }
@ -146,7 +146,7 @@ export class BotEquipmentModGenerator
if (Object.keys(modPool).includes(modTpl)) if (Object.keys(modPool).includes(modTpl))
{ {
// Call self recursivly // Call self recursively
this.generateModsForEquipment( this.generateModsForEquipment(
equipment, equipment,
modPool, modPool,
@ -172,8 +172,8 @@ export class BotEquipmentModGenerator
* @param modSpawnChances Mod spawn chances * @param modSpawnChances Mod spawn chances
* @param ammoTpl Ammo tpl to use when generating magazines/cartridges * @param ammoTpl Ammo tpl to use when generating magazines/cartridges
* @param botRole Role of bot weapon is generated for * @param botRole Role of bot weapon is generated for
* @param botLevel lvel of the bot weapon is being generated for * @param botLevel Level of the bot weapon is being generated for
* @param modLimits limits placed on certian mod types per gun * @param modLimits limits placed on certain mod types per gun
* @param botEquipmentRole role of bot when accessing bot.json equipment config settings * @param botEquipmentRole role of bot when accessing bot.json equipment config settings
* @returns Weapon + mods array * @returns Weapon + mods array
*/ */
@ -197,11 +197,9 @@ export class BotEquipmentModGenerator
const compatibleModsPool = modPool[parentTemplate._id]; const compatibleModsPool = modPool[parentTemplate._id];
// Null guard against bad input weapon // Null guard against bad input weapon
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
if ( if (
!parentTemplate._props.Slots.length !((parentTemplate._props.Slots.length || parentTemplate._props.Cartridges?.length)
&& !parentTemplate._props.Cartridges?.length || parentTemplate._props.Chambers?.length)
&& !parentTemplate._props.Chambers?.length
) )
{ {
this.logger.error( this.logger.error(
@ -346,7 +344,7 @@ export class BotEquipmentModGenerator
); );
// I first thought we could use the recursive generateModsForItems as previously for cylinder magazines. // I first thought we could use the recursive generateModsForItems as previously for cylinder magazines.
// However, the recursion doesnt go over the slots of the parent mod but over the modPool which is given by the bot config // However, the recursion doesn't go over the slots of the parent mod but over the modPool which is given by the bot config
// where we decided to keep cartridges instead of camoras. And since a CylinderMagazine only has one cartridge entry and // where we decided to keep cartridges instead of camoras. And since a CylinderMagazine only has one cartridge entry and
// this entry is not to be filled, we need a special handling for the CylinderMagazine // this entry is not to be filled, we need a special handling for the CylinderMagazine
const modParentItem = this.databaseServer.getTables().templates.items[modToAddTemplate._parent]; const modParentItem = this.databaseServer.getTables().templates.items[modToAddTemplate._parent];
@ -372,7 +370,7 @@ export class BotEquipmentModGenerator
} }
if (containsModInPool) if (containsModInPool)
{ {
// Call self recursivly to add mods to this mod // Call self recursively to add mods to this mod
this.generateModsForWeapon( this.generateModsForWeapon(
sessionId, sessionId,
weapon, weapon,
@ -707,7 +705,7 @@ export class BotEquipmentModGenerator
* @param modTpl _tpl * @param modTpl _tpl
* @param parentId parentId * @param parentId parentId
* @param modSlot slotId * @param modSlot slotId
* @param modTemplate Used to add additional properites in the upd object * @param modTemplate Used to add additional properties in the upd object
* @returns Item object * @returns Item object
*/ */
protected createModItem( protected createModItem(
@ -741,14 +739,14 @@ export class BotEquipmentModGenerator
/** /**
* Get a random mod from an items compatible mods Filter array * Get a random mod from an items compatible mods Filter array
* @param modTpl ???? default value to return if nothing found * @param modTpl ???? default value to return if nothing found
* @param parentSlot item mod will go into, used to get combatible items * @param parentSlot item mod will go into, used to get compatible items
* @param modSlot Slot to get mod to fill * @param modSlot Slot to get mod to fill
* @param items items to ensure picked mod is compatible with * @param items items to ensure picked mod is compatible with
* @returns item tpl * @returns item tpl
*/ */
protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string
{ {
// Find combatible mods and make an array of them // Find compatible mods and make an array of them
const allowedItems = parentSlot._props.filters[0].Filter; const allowedItems = parentSlot._props.filters[0].Filter;
// Find mod item that fits slot from sorted mod array // Find mod item that fits slot from sorted mod array
@ -814,7 +812,7 @@ export class BotEquipmentModGenerator
return false; return false;
} }
// If mod id doesnt exist in slots filter list and mod id doesnt have any of the slots filters as a base class, mod isn't valid for the slot // If mod id doesn't exist in slots filter list and mod id doesn't have any of the slots filters as a base class, mod isn't valid for the slot
if ( if (
!(itemSlot._props.filters[0].Filter.includes(modToAdd[1]._id) !(itemSlot._props.filters[0].Filter.includes(modToAdd[1]._id)
|| this.itemHelper.isOfBaseclasses(modToAdd[1]._id, itemSlot._props.filters[0].Filter)) || this.itemHelper.isOfBaseclasses(modToAdd[1]._id, itemSlot._props.filters[0].Filter))
@ -929,7 +927,7 @@ export class BotEquipmentModGenerator
let result: string[] = []; let result: string[] = [];
// Get item blacklist and mod equipmet blackist as one array // Get item blacklist and mod equipment blacklist as one array
const blacklist = this.itemFilterService.getBlacklistedItems().concat( const blacklist = this.itemFilterService.getBlacklistedItems().concat(
botEquipBlacklist.equipment[modSlot] || [], botEquipBlacklist.equipment[modSlot] || [],
); );
@ -1021,9 +1019,9 @@ export class BotEquipmentModGenerator
} }
/** /**
* Take a record of camoras and merge the compatable shells into one array * Take a record of camoras and merge the compatible shells into one array
* @param camorasWithShells camoras we want to merge into one array * @param camorasWithShells camoras we want to merge into one array
* @returns string array of shells fro luitple camora sources * @returns string array of shells for multiple camora sources
*/ */
protected mergeCamoraPoolsTogether(camorasWithShells: Record<string, string[]>): string[] protected mergeCamoraPoolsTogether(camorasWithShells: Record<string, string[]>): string[]
{ {
@ -1113,7 +1111,7 @@ export class BotEquipmentModGenerator
} }
} }
// No mods added to return list after filtering has occured, send back the original mod list // No mods added to return list after filtering has occurred, send back the original mod list
if (!filteredScopesAndMods || filteredScopesAndMods.length === 0) if (!filteredScopesAndMods || filteredScopesAndMods.length === 0)
{ {
this.logger.debug( this.logger.debug(

View File

@ -8,11 +8,11 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { import {
Common, Common,
Health as PmcHealth,
IBaseJsonSkills, IBaseJsonSkills,
IBaseSkill, IBaseSkill,
IBotBase, IBotBase,
Info, Info,
Health as PmcHealth,
Skills as botSkills, Skills as botSkills,
} from "@spt-aki/models/eft/common/tables/IBotBase"; } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
@ -277,8 +277,8 @@ export class BotGenerator
} }
const pmcNames = [ const pmcNames = [
...this.databaseServer.getTables().bots.types["usec"].firstName, ...this.databaseServer.getTables().bots.types.usec.firstName,
...this.databaseServer.getTables().bots.types["bear"].firstName, ...this.databaseServer.getTables().bots.types.bear.firstName,
]; ];
return `${name} (${this.randomUtil.getArrayValue(pmcNames)})`; return `${name} (${this.randomUtil.getArrayValue(pmcNames)})`;

View File

@ -161,7 +161,7 @@ export class BotInventoryGenerator
for (const equipmentSlot in templateInventory.equipment) for (const equipmentSlot in templateInventory.equipment)
{ {
// Weapons have special generation and will be generated seperately; ArmorVest should be generated after TactivalVest // Weapons have special generation and will be generated separately; ArmorVest should be generated after TactivalVest
if (excludedSlots.includes(equipmentSlot)) if (excludedSlots.includes(equipmentSlot))
{ {
continue; continue;
@ -331,7 +331,7 @@ export class BotInventoryGenerator
/** /**
* Get all possible mods for item and filter down based on equipment blacklist from bot.json config * Get all possible mods for item and filter down based on equipment blacklist from bot.json config
* @param itemTpl Item mod pool is being retreived and filtered * @param itemTpl Item mod pool is being retrieved and filtered
* @param equipmentBlacklist blacklist to filter mod pool with * @param equipmentBlacklist blacklist to filter mod pool with
* @returns Filtered pool of mods * @returns Filtered pool of mods
*/ */

View File

@ -59,7 +59,7 @@ export class BotLevelGenerator
} }
/** /**
* Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table * Get the highest level a bot can be relative to the players level, but no further than the max size from globals.exp_table
* @param playerLevel Players current level * @param playerLevel Players current level
* @param relativeDeltaMax max delta above player level to go * @param relativeDeltaMax max delta above player level to go
* @returns highest level possible for bot * @returns highest level possible for bot

View File

@ -466,7 +466,7 @@ export class BotLootGenerator
{ {
this.logger.warning(this.localisationService.getText("bot-unable_to_find_loot_n_value_for_bot", botRole)); this.logger.warning(this.localisationService.getText("bot-unable_to_find_loot_n_value_for_bot", botRole));
return this.botConfig.lootNValue["scav"]; return this.botConfig.lootNValue.scav;
} }
return result; return result;
@ -606,7 +606,7 @@ export class BotLootGenerator
{ {
if (isPmc) if (isPmc)
{ {
return this.botConfig.itemSpawnLimits["pmc"]; return this.botConfig.itemSpawnLimits.pmc;
} }
if (this.botConfig.itemSpawnLimits[botRole.toLowerCase()]) if (this.botConfig.itemSpawnLimits[botRole.toLowerCase()])
@ -618,7 +618,7 @@ export class BotLootGenerator
this.localisationService.getText("bot-unable_to_find_spawn_limits_fallback_to_defaults", botRole), this.localisationService.getText("bot-unable_to_find_spawn_limits_fallback_to_defaults", botRole),
); );
return this.botConfig.itemSpawnLimits["default"]; return this.botConfig.itemSpawnLimits.default;
} }
/** /**

View File

@ -1,4 +1,4 @@
import { inject, injectable, injectAll } from "tsyringe"; import { inject, injectAll, injectable } from "tsyringe";
import { BotEquipmentModGenerator } from "@spt-aki/generators/BotEquipmentModGenerator"; import { BotEquipmentModGenerator } from "@spt-aki/generators/BotEquipmentModGenerator";
import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen"; import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen";

View File

@ -133,8 +133,8 @@ export class LocationGenerator
// randomisation is turned off globally or just turned off for this map // randomisation is turned off globally or just turned off for this map
if ( if (
!this.locationConfig.containerRandomisationSettings.enabled !(this.locationConfig.containerRandomisationSettings.enabled
|| !this.locationConfig.containerRandomisationSettings.maps[locationId] && this.locationConfig.containerRandomisationSettings.maps[locationId])
) )
{ {
this.logger.debug( this.logger.debug(
@ -271,7 +271,7 @@ export class LocationGenerator
} }
/** /**
* Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount * Choose a number of containers based on their probability value to fulfil the desired count in containerData.chosenCount
* @param groupId Name of the group the containers are being collected for * @param groupId Name of the group the containers are being collected for
* @param containerData Containers and probability values for a groupId * @param containerData Containers and probability values for a groupId
* @returns List of chosen container Ids * @returns List of chosen container Ids
@ -289,11 +289,14 @@ export class LocationGenerator
return containerIds; return containerIds;
} }
// Create probability array with all possible container ids in this group and their relataive probability of spawning // Create probability array with all possible container ids in this group and their relative probability of spawning
const containerDistribution = new ProbabilityObjectArray<string>(this.mathUtil, this.jsonUtil); const containerDistribution = new ProbabilityObjectArray<string>(this.mathUtil, this.jsonUtil);
containerIds.forEach((x) => for (const containerId of containerIds)
containerDistribution.push(new ProbabilityObject(x, containerData.containerIdsWithProbability[x])) {
); containerDistribution.push(
new ProbabilityObject(containerId, containerData.containerIdsWithProbability[containerId]),
);
}
chosenContainerIds.push(...containerDistribution.draw(containerData.chosenCount)); chosenContainerIds.push(...containerDistribution.draw(containerData.chosenCount));
@ -489,7 +492,7 @@ export class LocationGenerator
locationName: string, locationName: string,
): number ): number
{ {
// Create probability array to calcualte the total count of lootable items inside container // Create probability array to calculate the total count of lootable items inside container
const itemCountArray = new ProbabilityObjectArray<number>(this.mathUtil, this.jsonUtil); const itemCountArray = new ProbabilityObjectArray<number>(this.mathUtil, this.jsonUtil);
for (const itemCountDistribution of staticLootDist[containerTypeId].itemcountDistribution) for (const itemCountDistribution of staticLootDist[containerTypeId].itemcountDistribution)
{ {
@ -505,9 +508,9 @@ export class LocationGenerator
/** /**
* Get all possible loot items that can be placed into a container * Get all possible loot items that can be placed into a container
* Do not add seasonal items if found + current date is inside seasonal event * Do not add seasonal items if found + current date is inside seasonal event
* @param containerTypeId Contianer to get possible loot for * @param containerTypeId Container to get possible loot for
* @param staticLootDist staticLoot.json * @param staticLootDist staticLoot.json
* @returns ProbabilityObjectArray of item tpls + probabilty * @returns ProbabilityObjectArray of item tpls + probability
*/ */
protected getPossibleLootItemsForContainer( protected getPossibleLootItemsForContainer(
containerTypeId: string, containerTypeId: string,
@ -576,7 +579,7 @@ export class LocationGenerator
for (const spawnpoint of allDynamicSpawnpoints) for (const spawnpoint of allDynamicSpawnpoints)
{ {
// Point is blacklsited, skip // Point is blacklisted, skip
if (blacklistedSpawnpoints?.includes(spawnpoint.template.Id)) if (blacklistedSpawnpoints?.includes(spawnpoint.template.Id))
{ {
this.logger.debug(`Ignoring loose loot location: ${spawnpoint.template.Id}`); this.logger.debug(`Ignoring loose loot location: ${spawnpoint.template.Id}`);
@ -923,7 +926,7 @@ export class LocationGenerator
} }
else else
{ {
// RSP30 (62178be9d0050232da3485d9/624c0b3340357b5f566e8766/6217726288ed9f0845317459) doesnt have any default presets and kills this code below as it has no chidren to reparent // RSP30 (62178be9d0050232da3485d9/624c0b3340357b5f566e8766/6217726288ed9f0845317459) doesn't have any default presets and kills this code below as it has no children to reparent
this.logger.debug(`createItem() No preset found for weapon: ${tpl}`); this.logger.debug(`createItem() No preset found for weapon: ${tpl}`);
} }

View File

@ -51,13 +51,16 @@ export class LootGenerator
const itemTypeCounts = this.initItemLimitCounter(options.itemLimits); const itemTypeCounts = this.initItemLimitCounter(options.itemLimits);
const tables = this.databaseServer.getTables(); const tables = this.databaseServer.getTables();
const itemBlacklist = new Set(this.itemFilterService.getBlacklistedItems()); const itemBlacklist = new Set<string>([
...this.itemFilterService.getBlacklistedItems(),
options.itemBlacklist.forEach(itemBlacklist.add, itemBlacklist); ...options.itemBlacklist,
]);
if (!options.allowBossItems) if (!options.allowBossItems)
{ {
this.itemFilterService.getBossItems().forEach(itemBlacklist.add, itemBlacklist); for (const bossItem of this.itemFilterService.getBossItems())
{
itemBlacklist.add(bossItem);
}
} }
// Handle sealed weapon containers // Handle sealed weapon containers
@ -391,7 +394,7 @@ export class LootGenerator
x._parent === rewardTypeId x._parent === rewardTypeId
&& x._type.toLowerCase() === "item" && x._type.toLowerCase() === "item"
&& !this.itemFilterService.isItemBlacklisted(x._id) && !this.itemFilterService.isItemBlacklisted(x._id)
&& (!containerSettings.allowBossItems && !this.itemFilterService.isBossItem(x._id)) && (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id)))
&& !x._props.QuestItem && !x._props.QuestItem
); );
@ -438,7 +441,7 @@ export class LootGenerator
continue; continue;
} }
// Get items that fulfil reward type critera from items that fit on gun // Get items that fulfil reward type criteria from items that fit on gun
const relatedItems = linkedItemsToWeapon.filter((x) => const relatedItems = linkedItemsToWeapon.filter((x) =>
x._parent === rewardTypeId && !this.itemFilterService.isItemBlacklisted(x._id) x._parent === rewardTypeId && !this.itemFilterService.isItemBlacklisted(x._id)
); );

View File

@ -157,10 +157,10 @@ export class RepeatableQuestGenerator
// a random combination of listed conditions can be required // a random combination of listed conditions can be required
// possible conditions elements and their relative probability can be defined in QuestConfig.js // possible conditions elements and their relative probability can be defined in QuestConfig.js
// We use ProbabilityObjectArray to draw by relative probability. e.g. for targets: // We use ProbabilityObjectArray to draw by relative probability. e.g. for targets:
// "targets": { // targets: {
// "Savage": 7, // Savage: 7,
// "AnyPmc": 2, // AnyPmc: 2,
// "bossBully": 0.5 // bossBully: 0.5
// } // }
// higher is more likely. We define the difficulty to be the inverse of the relative probability. // higher is more likely. We define the difficulty to be the inverse of the relative probability.
@ -517,7 +517,7 @@ export class RepeatableQuestGenerator
itemSelection = itemSelection.filter((x) => this.itemHelper.getItemPrice(x[0]) < roublesBudget); itemSelection = itemSelection.filter((x) => this.itemHelper.getItemPrice(x[0]) < roublesBudget);
// We also have the option to use whitelist and/or blacklist which is defined in repeatableQuests.json as // We also have the option to use whitelist and/or blacklist which is defined in repeatableQuests.json as
// [{"minPlayerLevel": 1, "itemIds": ["id1",...]}, {"minPlayerLevel": 15, "itemIds": ["id3",...]}] // [{minPlayerLevel: 1, itemIds: ["id1",...]}, {minPlayerLevel: 15, itemIds: ["id3",...]}]
if (repeatableConfig.questConfig.Completion.useWhitelist) if (repeatableConfig.questConfig.Completion.useWhitelist)
{ {
const itemWhitelist = const itemWhitelist =
@ -1042,18 +1042,16 @@ export class RepeatableQuestGenerator
// check for specific baseclasses which don't make sense as reward item // check for specific baseclasses which don't make sense as reward item
// also check if the price is greater than 0; there are some items whose price can not be found // also check if the price is greater than 0; there are some items whose price can not be found
// those are not in the game yet (e.g. AGS grenade launcher) // those are not in the game yet (e.g. AGS grenade launcher)
return Object.entries(this.databaseServer.getTables().templates.items).filter( return Object.entries(this.databaseServer.getTables().templates.items).filter(([tpl, itemTemplate]) =>
([tpl, itemTemplate]) => {
// Base "Item" item has no parent, ignore it
if (itemTemplate._parent === "")
{ {
// Base "Item" item has no parent, ignore it return false;
if (itemTemplate._parent === "") }
{
return false;
}
return this.isValidRewardItem(tpl, repeatableQuestConfig); return this.isValidRewardItem(tpl, repeatableQuestConfig);
}, });
);
} }
/** /**
@ -1096,7 +1094,7 @@ export class RepeatableQuestGenerator
} }
// Skip globally blacklisted items + boss items // Skip globally blacklisted items + boss items
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation> // biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
valid = !this.itemFilterService.isItemBlacklisted(tpl) && !this.itemFilterService.isBossItem(tpl); valid = !this.itemFilterService.isItemBlacklisted(tpl) && !this.itemFilterService.isBossItem(tpl);
return valid; return valid;

View File

@ -11,8 +11,7 @@ export class InventoryMagGen
private ammoTemplate: ITemplateItem, private ammoTemplate: ITemplateItem,
private pmcInventory: Inventory, private pmcInventory: Inventory,
) )
{ {}
}
public getMagCount(): GenerationData public getMagCount(): GenerationData
{ {

View File

@ -29,7 +29,8 @@ export class BarrelInventoryMagGen implements IInventoryMagGen
// Can't be done by _props.ammoType as grenade launcher shoots grenades with ammoType of "buckshot" // Can't be done by _props.ammoType as grenade launcher shoots grenades with ammoType of "buckshot"
let randomisedAmmoStackSize: number; let randomisedAmmoStackSize: number;
if (inventoryMagGen.getAmmoTemplate()._props.StackMaxRandom === 1) if (inventoryMagGen.getAmmoTemplate()._props.StackMaxRandom === 1)
{ // doesnt stack {
// doesnt stack
randomisedAmmoStackSize = this.randomUtil.getInt(3, 6); randomisedAmmoStackSize = this.randomUtil.getInt(3, 6);
} }
else else

View File

@ -55,10 +55,9 @@ export class ExternalInventoryMagGen implements IInventoryMagGen
if (ableToFitMagazinesIntoBotInventory === ItemAddedResult.NO_SPACE && i < randomizedMagazineCount) if (ableToFitMagazinesIntoBotInventory === ItemAddedResult.NO_SPACE && i < randomizedMagazineCount)
{ {
/* We were unable to fit at least the minimum amount of magazines, // We were unable to fit at least the minimum amount of magazines, so we fallback to default magazine
* so we fallback to default magazine and try again. // and try again. Temporary workaround to Killa spawning with no extras if he spawns with a drum mag.
* Temporary workaround to Killa spawning with no extras if he spawns with a drum mag */ // TODO: Fix this properly
if ( if (
magazineTpl magazineTpl
=== this.botWeaponGeneratorHelper.getWeaponsDefaultMagazineTpl( === this.botWeaponGeneratorHelper.getWeaponsDefaultMagazineTpl(

View File

@ -22,7 +22,7 @@ export class AssortHelper
{} {}
/** /**
* Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) * Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest)
* @param pmcProfile Player profile * @param pmcProfile Player profile
* @param traderId Traders id the assort belongs to * @param traderId Traders id the assort belongs to
* @param traderAssorts All assort items from same trader * @param traderAssorts All assort items from same trader
@ -138,7 +138,13 @@ export class AssortHelper
if (assort.barter_scheme[itemID] && flea) if (assort.barter_scheme[itemID] && flea)
{ {
assort.barter_scheme[itemID].forEach((b) => b.forEach((br) => br.sptQuestLocked = true)); for (const barterSchemes of assort.barter_scheme[itemID])
{
for (const barterScheme of barterSchemes)
{
barterScheme.sptQuestLocked = true;
}
}
return assort; return assort;
} }
delete assort.barter_scheme[itemID]; delete assort.barter_scheme[itemID];

View File

@ -46,7 +46,7 @@ export class BotGeneratorHelper
* @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items
* @returns Item Upd object with extra properties * @returns Item Upd object with extra properties
*/ */
public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole: string = null): { upd?: Upd; } public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }
{ {
// Get raid settings, if no raid, default to day // Get raid settings, if no raid, default to day
const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue< const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue<

View File

@ -50,10 +50,10 @@ export class BotHelper
{ {
if (this.randomUtil.getChance100(this.pmcConfig.chanceSameSideIsHostilePercent)) if (this.randomUtil.getChance100(this.pmcConfig.chanceSameSideIsHostilePercent))
{ {
difficultySettings.Mind["CAN_RECEIVE_PLAYER_REQUESTS_BEAR"] = false; difficultySettings.Mind.CAN_RECEIVE_PLAYER_REQUESTS_BEAR = false;
difficultySettings.Mind["CAN_RECEIVE_PLAYER_REQUESTS_USEC"] = false; difficultySettings.Mind.CAN_RECEIVE_PLAYER_REQUESTS_USEC = false;
difficultySettings.Mind["DEFAULT_USEC_BEHAVIOUR"] = "Attack"; difficultySettings.Mind.DEFAULT_USEC_BEHAVIOUR = "Attack";
difficultySettings.Mind["DEFAULT_BEAR_BEHAVIOUR"] = "Attack"; difficultySettings.Mind.DEFAULT_BEAR_BEHAVIOUR = "Attack";
} }
} }

View File

@ -139,8 +139,8 @@ export class DurabilityLimitsHelper
protected generateMaxPmcArmorDurability(itemMaxDurability: number): number protected generateMaxPmcArmorDurability(itemMaxDurability: number): number
{ {
const lowestMaxPercent = this.botConfig.durability["pmc"].armor.lowestMaxPercent; const lowestMaxPercent = this.botConfig.durability.pmc.armor.lowestMaxPercent;
const highestMaxPercent = this.botConfig.durability["pmc"].armor.highestMaxPercent; const highestMaxPercent = this.botConfig.durability.pmc.armor.highestMaxPercent;
const multiplier = this.randomUtil.getInt(lowestMaxPercent, highestMaxPercent); const multiplier = this.randomUtil.getInt(lowestMaxPercent, highestMaxPercent);
return itemMaxDurability * (multiplier / 100); return itemMaxDurability * (multiplier / 100);

View File

@ -57,7 +57,7 @@ export class HttpServerHelper
public sendTextJson(resp: any, output: any): void public sendTextJson(resp: any, output: any): void
{ {
resp.writeHead(200, "OK", { "Content-Type": this.mime["json"] }); resp.writeHead(200, "OK", { "Content-Type": this.mime.json });
resp.end(output); resp.end(output);
} }
} }

View File

@ -385,10 +385,10 @@ export class InRaidHelper
&& this.itemHelper.itemIsInsideContainer(x, "SecuredContainer", postRaidProfile.Inventory.items)); && this.itemHelper.itemIsInsideContainer(x, "SecuredContainer", postRaidProfile.Inventory.items));
}); });
itemsToRemovePropertyFrom.forEach((item) => for (const item of itemsToRemovePropertyFrom)
{ {
delete item.upd.SpawnedInSession; delete item.upd.SpawnedInSession;
}); }
return postRaidProfile; return postRaidProfile;
} }
@ -431,10 +431,10 @@ export class InRaidHelper
{ {
// Get inventory item ids to remove from players profile // Get inventory item ids to remove from players profile
const itemIdsToDeleteFromProfile = this.getInventoryItemsLostOnDeath(pmcData).map((x) => x._id); const itemIdsToDeleteFromProfile = this.getInventoryItemsLostOnDeath(pmcData).map((x) => x._id);
itemIdsToDeleteFromProfile.forEach((x) => for (const itemId of itemIdsToDeleteFromProfile)
{ {
this.inventoryHelper.removeItem(pmcData, x, sessionID); this.inventoryHelper.removeItem(pmcData, itemId, sessionID);
}); }
// Remove contents of fast panel // Remove contents of fast panel
pmcData.Inventory.fastPanel = {}; pmcData.Inventory.fastPanel = {};

View File

@ -315,9 +315,9 @@ export class InventoryHelper
const itemLocation = {}; const itemLocation = {};
// Item already has location property, use it // Item already has location property, use it
if (itemLib[tmpKey]["location"] !== undefined) if (itemLib[tmpKey].location !== undefined)
{ {
itemLocation["location"] = itemLib[tmpKey]["location"]; itemLocation.location = itemLib[tmpKey].location;
} }
output.profileChanges[sessionID].items.new.push({ output.profileChanges[sessionID].items.new.push({
@ -887,9 +887,8 @@ export class InventoryHelper
{ {
const inventoryItemHash: InventoryHelper.InventoryItemHash = { byItemId: {}, byParentId: {} }; const inventoryItemHash: InventoryHelper.InventoryItemHash = { byItemId: {}, byParentId: {} };
for (let i = 0; i < inventoryItem.length; i++) for (const item of inventoryItem)
{ {
const item = inventoryItem[i];
inventoryItemHash.byItemId[item._id] = item; inventoryItemHash.byItemId[item._id] = item;
if (!("parentId" in item)) if (!("parentId" in item))

View File

@ -190,27 +190,27 @@ class ItemHelper
* AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content.
* Here's what a filled AmmoBox looks like: * Here's what a filled AmmoBox looks like:
* { * {
* "_id": "b1bbe982daa00ac841d4ae4d", * _id: "b1bbe982daa00ac841d4ae4d",
* "_tpl": "57372c89245977685d4159b1", * _tpl: "57372c89245977685d4159b1",
* "parentId": "5fe49a0e2694b0755a504876", * parentId: "5fe49a0e2694b0755a504876",
* "slotId": "hideout", * slotId: "hideout",
* "location": { * location: {
* "x": 3, * x: 3,
* "y": 4, * y: 4,
* "r": 0 * r: 0
* }, * },
* "upd": { * upd: {
* "StackObjectsCount": 1 * StackObjectsCount: 1
* } * }
* }, * },
* { * {
* "_id": "b997b4117199033afd274a06", * _id: "b997b4117199033afd274a06",
* "_tpl": "56dff061d2720bb5668b4567", * _tpl: "56dff061d2720bb5668b4567",
* "parentId": "b1bbe982daa00ac841d4ae4d", * parentId: "b1bbe982daa00ac841d4ae4d",
* "slotId": "cartridges", * slotId: "cartridges",
* "location": 0, * location: 0,
* "upd": { * upd: {
* "StackObjectsCount": 30 * StackObjectsCount: 30
* } * }
* } * }
* Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it. * Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it.
@ -850,7 +850,7 @@ class ItemHelper
*/ */
public isAttachmentAttached(item: Item): boolean public isAttachmentAttached(item: Item): boolean
{ {
return item.slotId !== "hideout" && item.slotId !== "main" && isNaN(Number(item.slotId)); return item.slotId !== "hideout" && item.slotId !== "main" && Number.isNaN(Number(item.slotId));
} }
/** /**

View File

@ -54,7 +54,6 @@ export class RagfairHelper
case "5449016a4bdc2d6f028b456f": case "5449016a4bdc2d6f028b456f":
return "RUB"; return "RUB";
default: default:
return ""; return "";
} }
@ -214,12 +213,9 @@ export class RagfairHelper
{ {
case Money.EUROS: case Money.EUROS:
return "€"; return "€";
case Money.DOLLARS: case Money.DOLLARS:
return "$"; return "$";
default: // Money.ROUBLES
case Money.ROUBLES:
default:
return "₽"; return "₽";
} }
} }

View File

@ -318,7 +318,7 @@ export class RagfairOfferHelper
public increaseProfileRagfairRating(profile: IAkiProfile, amountToIncrementBy: number): void public increaseProfileRagfairRating(profile: IAkiProfile, amountToIncrementBy: number): void
{ {
profile.characters.pmc.RagfairInfo.isRatingGrowing = true; profile.characters.pmc.RagfairInfo.isRatingGrowing = true;
if (isNaN(amountToIncrementBy)) if (Number.isNaN(amountToIncrementBy))
{ {
this.logger.warning(`Unable to increment ragfair rating, value was not a number: ${amountToIncrementBy}`); this.logger.warning(`Unable to increment ragfair rating, value was not a number: ${amountToIncrementBy}`);
@ -635,7 +635,7 @@ export class RagfairOfferHelper
return false; return false;
} }
if (isNaN(offer.requirementsCost)) if (Number.isNaN(offer.requirementsCost))
{ {
// don't include offers with null or NaN in it // don't include offers with null or NaN in it
return false; return false;

View File

@ -85,7 +85,7 @@ export class RagfairSellHelper
const result: SellResult[] = []; const result: SellResult[] = [];
// Value can sometimes be NaN for whatever reason, default to base chance if that happens // Value can sometimes be NaN for whatever reason, default to base chance if that happens
if (isNaN(sellChancePercent)) if (Number.isNaN(sellChancePercent))
{ {
this.logger.warning( this.logger.warning(
`Sell chance was not a number: ${sellChancePercent}, defaulting to ${this.ragfairConfig.sell.chance.base} %`, `Sell chance was not a number: ${sellChancePercent}, defaulting to ${this.ragfairConfig.sell.chance.base} %`,

View File

@ -61,6 +61,7 @@ export class TradeHelper
const newReq = { const newReq = {
items: [{ items: [{
// eslint-disable-next-line @typescript-eslint/naming-convention
item_id: buyRequestData.item_id, item_id: buyRequestData.item_id,
count: buyRequestData.count, count: buyRequestData.count,
}], }],

View File

@ -95,7 +95,7 @@ export class ModLoadOrder
for (const loadBeforeMod of loadBefore) for (const loadBeforeMod of loadBefore)
{ {
const loadBeforeModConfig = this.modsAvailable.get(loadBeforeMod)!; const loadBeforeModConfig = this.modsAvailable.get(loadBeforeMod);
loadBeforeModConfig.loadAfter ??= []; loadBeforeModConfig.loadAfter ??= [];
loadBeforeModConfig.loadAfter.push(mod); loadBeforeModConfig.loadAfter.push(mod);

View File

@ -42,7 +42,7 @@ export class PostDBModLoader implements OnLoad
const mods = this.preAkiModLoader.sortModsLoadOrder(); const mods = this.preAkiModLoader.sortModsLoadOrder();
for (const modName of mods) for (const modName of mods)
{ {
// // import class // import class
const filepath = `${this.preAkiModLoader.getModPath(modName)}${ const filepath = `${this.preAkiModLoader.getModPath(modName)}${
this.preAkiModLoader.getImportedModDetails()[modName].main this.preAkiModLoader.getImportedModDetails()[modName].main
}`; }`;

View File

@ -146,10 +146,10 @@ export class PreAkiModLoader implements IModLoader
const modOrder = this.vfs.readFile(this.modOrderPath, { encoding: "utf8" }); const modOrder = this.vfs.readFile(this.modOrderPath, { encoding: "utf8" });
try try
{ {
this.jsonUtil.deserialize<any>(modOrder).order.forEach((mod: string, index: number) => for (const [index, mod] of (this.jsonUtil.deserialize<any>(modOrder).order as string[]).entries())
{ {
this.order[mod] = index; this.order[mod] = index;
}); }
} }
catch (error) catch (error)
{ {

View File

@ -1,9 +1,7 @@
// rome-ignore lint/suspicious/noEmptyInterface: <explanation>
export interface IAcceptFriendRequestData extends IBaseFriendRequest export interface IAcceptFriendRequestData extends IBaseFriendRequest
{ {
} }
// rome-ignore lint/suspicious/noEmptyInterface: <explanation>
export interface ICancelFriendRequestData extends IBaseFriendRequest export interface ICancelFriendRequestData extends IBaseFriendRequest
{ {
} }

View File

@ -13,32 +13,32 @@ export interface IGetRaidConfigurationRequestData
} }
// { // {
// "keyId": "", // keyId: "",
// "side": "Pmc", // side: "Pmc",
// "location": "factory4_day", // location: "factory4_day",
// "timeVariant": "CURR", or "PAST" // timeVariant: "CURR", or "PAST"
// "raidMode": "Local", // raidMode: "Local",
// "metabolismDisabled": false, // metabolismDisabled: false,
// "playersSpawnPlace": "SamePlace", // playersSpawnPlace: "SamePlace",
// "timeAndWeatherSettings": { // timeAndWeatherSettings: {
// "isRandomTime": false, // isRandomTime: false,
// "isRandomWeather": false, // isRandomWeather: false,
// "cloudinessType": "Clear", // cloudinessType: "Clear",
// "rainType": "NoRain", // rainType: "NoRain",
// "windType": "Light", // windType: "Light",
// "fogType": "NoFog", // fogType: "NoFog",
// "timeFlowType": "x1", // timeFlowType: "x1",
// "hourOfDay": -1 // hourOfDay: -1
// }, // },
// "botSettings": { // botSettings: {
// "isScavWars": false, // isScavWars: false,
// "botAmount": "AsOnline" // botAmount: "AsOnline"
// }, // },
// "wavesSettings": { // wavesSettings: {
// "botAmount": "AsOnline", // botAmount: "AsOnline",
// "botDifficulty": "AsOnline", // botDifficulty: "AsOnline",
// "isBosses": true, // isBosses: true,
// "isTaggedAndCursed": false // isTaggedAndCursed: false
// } // }
// } // }

View File

@ -28,14 +28,14 @@ export const Listen = (basePath: string) =>
this.handlers = {}; this.handlers = {};
// Retrieve all handlers // Retrieve all handlers
const handlersArray = Base.prototype["handlers"]; const handlersArray = Base.prototype.handlers;
if (!handlersArray) if (!handlersArray)
{ {
return; return;
} }
// Add each flagged handler to the Record // Add each flagged handler to the Record
handlersArray.forEach(({ handlerName, path, httpMethod }) => for (const { handlerName, path, httpMethod } of handlersArray)
{ {
if (!this.handlers[httpMethod]) if (!this.handlers[httpMethod])
{ {
@ -50,10 +50,10 @@ export const Listen = (basePath: string) =>
} }
this.handlers[httpMethod][`/${basePath}/${path}`] = this[handlerName]; this.handlers[httpMethod][`/${basePath}/${path}`] = this[handlerName];
} }
}); }
// Cleanup the handlers list // Cleanup the handlers list
Base.prototype["handlers"] = []; Base.prototype.handlers = [];
} }
// The canHandle method is used to check if the Listener handles a request // The canHandle method is used to check if the Listener handles a request
@ -105,13 +105,13 @@ const createHttpDecorator = (httpMethod: HttpMethods) =>
return (target: any, propertyKey: string) => return (target: any, propertyKey: string) =>
{ {
// If the handlers array has not been initialized yet // If the handlers array has not been initialized yet
if (!target["handlers"]) if (!target.handlers)
{ {
target["handlers"] = []; target.handlers = [];
} }
// Flag the method as a HTTP handler // Flag the method as a HTTP handler
target["handlers"].push({ handlerName: propertyKey, path, httpMethod }); target.handlers.push({ handlerName: propertyKey, path, httpMethod });
}; };
}; };
}; };

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; import type { DependencyContainer } from "tsyringe";
export interface IPostAkiLoadMod export interface IPostAkiLoadMod
{ {

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; import type { DependencyContainer } from "tsyringe";
export interface IPostAkiLoadModAsync export interface IPostAkiLoadModAsync
{ {

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; import type { DependencyContainer } from "tsyringe";
export interface IPostDBLoadMod export interface IPostDBLoadMod
{ {

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; import type { DependencyContainer } from "tsyringe";
export interface IPostDBLoadModAsync export interface IPostDBLoadModAsync
{ {

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; import type { DependencyContainer } from "tsyringe";
export interface IPreAkiLoadMod export interface IPreAkiLoadMod
{ {

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe"; import type { DependencyContainer } from "tsyringe";
export interface IPreAkiLoadModAsync export interface IPreAkiLoadModAsync
{ {

View File

@ -1,5 +1,5 @@
import { IncomingMessage } from "node:http"; import { IncomingMessage } from "node:http";
import { injectable, injectAll } from "tsyringe"; import { injectAll, injectable } from "tsyringe";
import { DynamicRouter, Router, StaticRouter } from "@spt-aki/di/Router"; import { DynamicRouter, Router, StaticRouter } from "@spt-aki/di/Router";
@ -15,7 +15,7 @@ export class HttpRouter
protected groupBy<T>(list: T[], keyGetter: (t: T) => string): Map<string, T[]> protected groupBy<T>(list: T[], keyGetter: (t: T) => string): Map<string, T[]>
{ {
const map: Map<string, T[]> = new Map(); const map: Map<string, T[]> = new Map();
list.forEach((item) => for (const item of list)
{ {
const key = keyGetter(item); const key = keyGetter(item);
const collection = map.get(key); const collection = map.get(key);
@ -27,7 +27,7 @@ export class HttpRouter
{ {
collection.push(item); collection.push(item);
} }
}); }
return map; return map;
} }

View File

@ -1,4 +1,4 @@
import { inject, injectable, injectAll } from "tsyringe"; import { inject, injectAll, injectable } from "tsyringe";
import { ItemEventRouterDefinition } from "@spt-aki/di/Router"; import { ItemEventRouterDefinition } from "@spt-aki/di/Router";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";

View File

@ -9,13 +9,10 @@ export class BundleDynamicRouter extends DynamicRouter
constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks) constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction(".bundle", (url: string, info: any, sessionID: string, output: string): any =>
".bundle", {
(url: string, info: any, sessionID: string, output: string): any => return this.bundleCallbacks.getBundle(url, info, sessionID);
{ }),
return this.bundleCallbacks.getBundle(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -9,27 +9,18 @@ export class DataDynamicRouter extends DynamicRouter
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks) constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/client/menu/locale/", (url: string, info: any, sessionID: string, output: string): any =>
"/client/menu/locale/", {
(url: string, info: any, sessionID: string, output: string): any => return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
{ }),
return this.dataCallbacks.getLocalesMenu(url, info, sessionID); new RouteAction("/client/locale/", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
new RouteAction( }),
"/client/locale/", new RouteAction("/client/items/prices/", (url: string, info: any, sessionID: string, output: string): any =>
(url: string, info: any, sessionID: string, output: string): any => {
{ return this.dataCallbacks.getItemPrices(url, info, sessionID);
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID); }),
},
),
new RouteAction(
"/client/items/prices/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getItemPrices(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -9,27 +9,18 @@ export class HttpDynamicRouter extends DynamicRouter
constructor(@inject("ImageRouter") protected imageRouter: ImageRouter) constructor(@inject("ImageRouter") protected imageRouter: ImageRouter)
{ {
super([ super([
new RouteAction( new RouteAction(".jpg", (url: string, info: any, sessionID: string, output: string): any =>
".jpg", {
(url: string, info: any, sessionID: string, output: string): any => return this.imageRouter.getImage();
{ }),
return this.imageRouter.getImage(); new RouteAction(".png", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.imageRouter.getImage();
new RouteAction( }),
".png", new RouteAction(".ico", (url: string, info: any, sessionID: string, output: string): any =>
(url: string, info: any, sessionID: string, output: string): any => {
{ return this.imageRouter.getImage();
return this.imageRouter.getImage(); }),
},
),
new RouteAction(
".ico",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
]); ]);
} }
} }

View File

@ -9,27 +9,18 @@ export class NotifierDynamicRouter extends DynamicRouter
constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks) constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/?last_id", (url: string, info: any, sessionID: string, output: string): any =>
"/?last_id", {
(url: string, info: any, sessionID: string, output: string): any => return this.notifierCallbacks.notify(url, info, sessionID);
{ }),
return this.notifierCallbacks.notify(url, info, sessionID); new RouteAction("/notifierServer", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.notifierCallbacks.notify(url, info, sessionID);
new RouteAction( }),
"/notifierServer", new RouteAction("/push/notifier/get/", (url: string, info: any, sessionID: string, output: string): any =>
(url: string, info: any, sessionID: string, output: string): any => {
{ return this.notifierCallbacks.getNotifier(url, info, sessionID);
return this.notifierCallbacks.notify(url, info, sessionID); }),
},
),
new RouteAction(
"/push/notifier/get/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.getNotifier(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/push/notifier/getwebsocket/", "/push/notifier/getwebsocket/",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -6,11 +6,6 @@ import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
@injectable() @injectable()
export class HealthSaveLoadRouter extends SaveLoadRouter export class HealthSaveLoadRouter extends SaveLoadRouter
{ {
constructor()
{
super();
}
public override getHandledRoutes(): HandledRoute[] public override getHandledRoutes(): HandledRoute[]
{ {
return [new HandledRoute("aki-health", false)]; return [new HandledRoute("aki-health", false)];

View File

@ -9,13 +9,10 @@ export class BundleStaticRouter extends StaticRouter
constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks) constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/singleplayer/bundles", (url: string, info: any, sessionID: string, output: string): any =>
"/singleplayer/bundles", {
(url: string, info: any, sessionID: string, output: string): any => return this.bundleCallbacks.getBundles(url, info, sessionID);
{ }),
return this.bundleCallbacks.getBundles(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -9,13 +9,10 @@ export class ClientLogStaticRouter extends StaticRouter
constructor(@inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks) constructor(@inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/singleplayer/log", (url: string, info: any, sessionID: string, output: string): any =>
"/singleplayer/log", {
(url: string, info: any, sessionID: string, output: string): any => return this.clientLogCallbacks.clientLog(url, info, sessionID);
{ }),
return this.clientLogCallbacks.clientLog(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -9,27 +9,18 @@ export class DataStaticRouter extends StaticRouter
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks) constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/client/settings", (url: string, info: any, sessionID: string, output: string): any =>
"/client/settings", {
(url: string, info: any, sessionID: string, output: string): any => return this.dataCallbacks.getSettings(url, info, sessionID);
{ }),
return this.dataCallbacks.getSettings(url, info, sessionID); new RouteAction("/client/globals", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.dataCallbacks.getGlobals(url, info, sessionID);
new RouteAction( }),
"/client/globals", new RouteAction("/client/items", (url: string, info: any, sessionID: string, output: string): any =>
(url: string, info: any, sessionID: string, output: string): any => {
{ return this.dataCallbacks.getTemplateItems(url, info, sessionID);
return this.dataCallbacks.getGlobals(url, info, sessionID); }),
},
),
new RouteAction(
"/client/items",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getTemplateItems(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/handbook/templates", "/client/handbook/templates",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -37,13 +28,10 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getTemplateHandbook(url, info, sessionID); return this.dataCallbacks.getTemplateHandbook(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/customization", (url: string, info: any, sessionID: string, output: string): any =>
"/client/customization", {
(url: string, info: any, sessionID: string, output: string): any => return this.dataCallbacks.getTemplateSuits(url, info, sessionID);
{ }),
return this.dataCallbacks.getTemplateSuits(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/account/customization", "/client/account/customization",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -65,13 +53,10 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getHideoutSettings(url, info, sessionID); return this.dataCallbacks.getHideoutSettings(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/hideout/areas", (url: string, info: any, sessionID: string, output: string): any =>
"/client/hideout/areas", {
(url: string, info: any, sessionID: string, output: string): any => return this.dataCallbacks.getHideoutAreas(url, info, sessionID);
{ }),
return this.dataCallbacks.getHideoutAreas(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/hideout/production/scavcase/recipes", "/client/hideout/production/scavcase/recipes",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -79,13 +64,13 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getHideoutScavcase(url, info, sessionID); return this.dataCallbacks.getHideoutScavcase(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/languages", (url: string, info: any, sessionID: string, output: string): any =>
"/client/languages", {
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
{ {
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID); return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
}, }),
),
new RouteAction( new RouteAction(
"/client/hideout/qte/list", "/client/hideout/qte/list",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -79,13 +79,10 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.getAllAttachments(url, info, sessionID); return this.dialogueCallbacks.getAllAttachments(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/mail/msg/send", (url: string, info: any, sessionID: string, output: string): any =>
"/client/mail/msg/send", {
(url: string, info: any, sessionID: string, output: string): any => return this.dialogueCallbacks.sendMessage(url, info, sessionID);
{ }),
return this.dialogueCallbacks.sendMessage(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/mail/dialog/clear", "/client/mail/dialog/clear",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -93,13 +90,10 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.clearMail(url, info, sessionID); return this.dialogueCallbacks.clearMail(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/friend/list", (url: string, info: any, sessionID: string, output: string): any =>
"/client/friend/list", {
(url: string, info: any, sessionID: string, output: string): any => return this.dialogueCallbacks.getFriendList(url, info, sessionID);
{ }),
return this.dialogueCallbacks.getFriendList(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/friend/request/list/outbox", "/client/friend/request/list/outbox",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -135,13 +129,10 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID); return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/friend/delete", (url: string, info: any, sessionID: string, output: string): any =>
"/client/friend/delete", {
(url: string, info: any, sessionID: string, output: string): any => return this.dialogueCallbacks.deleteFriend(url, info, sessionID);
{ }),
return this.dialogueCallbacks.deleteFriend(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/friend/ignore/set", "/client/friend/ignore/set",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -9,20 +9,14 @@ export class GameStaticRouter extends StaticRouter
constructor(@inject("GameCallbacks") protected gameCallbacks: GameCallbacks) constructor(@inject("GameCallbacks") protected gameCallbacks: GameCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/client/game/config", (url: string, info: any, sessionID: string, output: string): any =>
"/client/game/config", {
(url: string, info: any, sessionID: string, output: string): any => return this.gameCallbacks.getGameConfig(url, info, sessionID);
{ }),
return this.gameCallbacks.getGameConfig(url, info, sessionID); new RouteAction("/client/server/list", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.gameCallbacks.getServer(url, info, sessionID);
new RouteAction( }),
"/client/server/list",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.getServer(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/match/group/current", "/client/match/group/current",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -37,27 +31,18 @@ export class GameStaticRouter extends StaticRouter
return this.gameCallbacks.versionValidate(url, info, sessionID); return this.gameCallbacks.versionValidate(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/game/start", (url: string, info: any, sessionID: string, output: string): any =>
"/client/game/start", {
(url: string, info: any, sessionID: string, output: string): any => return this.gameCallbacks.gameStart(url, info, sessionID);
{ }),
return this.gameCallbacks.gameStart(url, info, sessionID); new RouteAction("/client/game/logout", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.gameCallbacks.gameLogout(url, info, sessionID);
new RouteAction( }),
"/client/game/logout", new RouteAction("/client/checkVersion", (url: string, info: any, sessionID: string, output: string): any =>
(url: string, info: any, sessionID: string, output: string): any => {
{ return this.gameCallbacks.validateGameVersion(url, info, sessionID);
return this.gameCallbacks.gameLogout(url, info, sessionID); }),
},
),
new RouteAction(
"/client/checkVersion",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.validateGameVersion(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/game/keepalive", "/client/game/keepalive",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -9,13 +9,10 @@ export class HealthStaticRouter extends StaticRouter
constructor(@inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks) constructor(@inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/player/health/sync", (url: string, info: any, sessionID: string, output: string): any =>
"/player/health/sync", {
(url: string, info: any, sessionID: string, output: string): any => return this.healthCallbacks.syncHealth(url, info, sessionID);
{ }),
return this.healthCallbacks.syncHealth(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/hideout/workout", "/client/hideout/workout",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -9,13 +9,10 @@ export class InraidStaticRouter extends StaticRouter
constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks) constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/raid/profile/save", (url: string, info: any, sessionID: string, output: string): any =>
"/raid/profile/save", {
(url: string, info: any, sessionID: string, output: string): any => return this.inraidCallbacks.saveProgress(url, info, sessionID);
{ }),
return this.inraidCallbacks.saveProgress(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/singleplayer/settings/raid/endstate", "/singleplayer/settings/raid/endstate",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -9,13 +9,10 @@ export class LauncherStaticRouter extends StaticRouter
constructor(@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks) constructor(@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/launcher/ping", (url: string, info: any, sessionID: string, output: string): any =>
"/launcher/ping", {
(url: string, info: any, sessionID: string, output: string): any => return this.launcherCallbacks.ping(url, info, sessionID);
{ }),
return this.launcherCallbacks.ping(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/launcher/server/connect", "/launcher/server/connect",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -37,13 +34,10 @@ export class LauncherStaticRouter extends StaticRouter
return this.launcherCallbacks.register(url, info, sessionID); return this.launcherCallbacks.register(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/launcher/profile/get", (url: string, info: any, sessionID: string, output: string): any =>
"/launcher/profile/get", {
(url: string, info: any, sessionID: string, output: string): any => return this.launcherCallbacks.get(url, info, sessionID);
{ }),
return this.launcherCallbacks.get(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/launcher/profile/change/username", "/launcher/profile/change/username",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -9,13 +9,10 @@ export class LocationStaticRouter extends StaticRouter
constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks) constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/client/locations", (url: string, info: any, sessionID: string, output: string): any =>
"/client/locations", {
(url: string, info: any, sessionID: string, output: string): any => return this.locationCallbacks.getLocationData(url, info, sessionID);
{ }),
return this.locationCallbacks.getLocationData(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/location/getAirdropLoot", "/client/location/getAirdropLoot",
(url: string, info: any, sessionID: string, _output: string): any => (url: string, info: any, sessionID: string, _output: string): any =>

View File

@ -9,13 +9,10 @@ export class MatchStaticRouter extends StaticRouter
constructor(@inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks) constructor(@inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/raid/profile/list", (url: string, info: any, sessionID: string, output: string): any =>
"/raid/profile/list", {
(url: string, info: any, sessionID: string, output: string): any => return this.matchCallbacks.getProfile(url, info, sessionID);
{ }),
return this.matchCallbacks.getProfile(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/match/available", "/client/match/available",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -30,20 +27,14 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.updatePing(url, info, sessionID); return this.matchCallbacks.updatePing(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/match/join", (url: string, info: any, sessionID: string, output: string): any =>
"/client/match/join", {
(url: string, info: any, sessionID: string, output: string): any => return this.matchCallbacks.joinMatch(url, info, sessionID);
{ }),
return this.matchCallbacks.joinMatch(url, info, sessionID); new RouteAction("/client/match/exit", (url: string, info: any, sessionID: string, output: string): any =>
}, {
), return this.matchCallbacks.exitMatch(url, info, sessionID);
new RouteAction( }),
"/client/match/exit",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.exitMatch(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/match/group/create", "/client/match/group/create",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -142,13 +133,10 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.endOfflineRaid(url, info, sessionID); return this.matchCallbacks.endOfflineRaid(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/putMetrics", (url: string, info: any, sessionID: string, output: string): any =>
"/client/putMetrics", {
(url: string, info: any, sessionID: string, output: string): any => return this.matchCallbacks.putMetrics(url, info, sessionID);
{ }),
return this.matchCallbacks.putMetrics(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/getMetricsConfig", "/client/getMetricsConfig",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -86,13 +86,10 @@ export class ProfileStaticRouter extends StaticRouter
return this.profileCallbacks.getMiniProfile(url, info, sessionID); return this.profileCallbacks.getMiniProfile(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/launcher/profiles", (url: string, info: any, sessionID: string, output: string): any =>
"/launcher/profiles", {
(url: string, info: any, sessionID: string, output: string): any => return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID);
{ }),
return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -9,13 +9,10 @@ export class QuestStaticRouter extends StaticRouter
constructor(@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks) constructor(@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/client/quest/list", (url: string, info: any, sessionID: string, output: string): any =>
"/client/quest/list", {
(url: string, info: any, sessionID: string, output: string): any => return this.questCallbacks.listQuests(url, info, sessionID);
{ }),
return this.questCallbacks.listQuests(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/repeatalbeQuests/activityPeriods", "/client/repeatalbeQuests/activityPeriods",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>

View File

@ -16,13 +16,10 @@ export class RagfairStaticRouter extends StaticRouter
return this.ragfairCallbacks.search(url, info, sessionID); return this.ragfairCallbacks.search(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/ragfair/find", (url: string, info: any, sessionID: string, output: string): any =>
"/client/ragfair/find", {
(url: string, info: any, sessionID: string, output: string): any => return this.ragfairCallbacks.search(url, info, sessionID);
{ }),
return this.ragfairCallbacks.search(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/ragfair/itemMarketPrice", "/client/ragfair/itemMarketPrice",
(url: string, info: any, sessionID: string, output: string): any => (url: string, info: any, sessionID: string, output: string): any =>
@ -44,13 +41,10 @@ export class RagfairStaticRouter extends StaticRouter
return this.ragfairCallbacks.sendReport(url, info, sessionID); return this.ragfairCallbacks.sendReport(url, info, sessionID);
}, },
), ),
new RouteAction( new RouteAction("/client/items/prices", (url: string, info: any, sessionID: string, output: string): any =>
"/client/items/prices", {
(url: string, info: any, sessionID: string, output: string): any => return this.ragfairCallbacks.getFleaPrices(url, info, sessionID);
{ }),
return this.ragfairCallbacks.getFleaPrices(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -9,13 +9,10 @@ export class WeatherStaticRouter extends StaticRouter
constructor(@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks) constructor(@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks)
{ {
super([ super([
new RouteAction( new RouteAction("/client/weather", (url: string, info: any, sessionID: string, output: string): any =>
"/client/weather", {
(url: string, info: any, sessionID: string, output: string): any => return this.weatherCallbacks.getWeather(url, info, sessionID);
{ }),
return this.weatherCallbacks.getWeather(url, info, sessionID);
},
),
]); ]);
} }
} }

View File

@ -74,7 +74,7 @@ export class HttpServer
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void protected handleRequest(req: IncomingMessage, resp: ServerResponse): void
{ {
// Pull sessionId out of cookies and store inside app context // Pull sessionId out of cookies and store inside app context
const sessionId = this.getCookies(req)["PHPSESSID"]; const sessionId = this.getCookies(req).PHPSESSID;
this.applicationContext.addValue(ContextVariableType.SESSION_ID, sessionId); this.applicationContext.addValue(ContextVariableType.SESSION_ID, sessionId);
// http.json logRequests boolean option to allow the user/server to choose to not log requests // http.json logRequests boolean option to allow the user/server to choose to not log requests

View File

@ -1,4 +1,4 @@
import { inject, injectable, injectAll } from "tsyringe"; import { inject, injectAll, injectable } from "tsyringe";
import { SaveLoadRouter } from "@spt-aki/di/Router"; import { SaveLoadRouter } from "@spt-aki/di/Router";
import { IAkiProfile, Info } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile, Info } from "@spt-aki/models/eft/profile/IAkiProfile";

View File

@ -64,10 +64,10 @@ export class AkiHttpListener implements IHttpListener
// determine if the payload is compressed. All PUT requests are, and POST requests without // determine if the payload is compressed. All PUT requests are, and POST requests without
// debug = 1 are as well. This should be fixed. // debug = 1 are as well. This should be fixed.
// let compressed = req.headers["content-encoding"] === "deflate"; // let compressed = req.headers["content-encoding"] === "deflate";
const compressed = req.method === "PUT" || req.headers["debug"] !== "1"; const compressed = req.method === "PUT" || req.headers.debug !== "1";
const value = compressed ? zlib.inflateSync(buffer) : buffer; const value = compressed ? zlib.inflateSync(buffer) : buffer;
if (req.headers["debug"] === "1") if (req.headers.debug === "1")
{ {
this.logger.debug(value.toString(), true); this.logger.debug(value.toString(), true);
} }
@ -107,7 +107,7 @@ export class AkiHttpListener implements IHttpListener
let handled = false; let handled = false;
// Check if this is a debug request, if so just send the raw response without transformation // Check if this is a debug request, if so just send the raw response without transformation
if (req.headers["debug"] === "1") if (req.headers.debug === "1")
{ {
this.sendJson(resp, output, sessionID); this.sendJson(resp, output, sessionID);
} }

View File

@ -27,17 +27,17 @@ export class BotGenerationCacheService
*/ */
public storeBots(key: string, botsToStore: IBotBase[]): void public storeBots(key: string, botsToStore: IBotBase[]): void
{ {
botsToStore.forEach((e) => for (const bot of botsToStore)
{ {
if (this.storedBots.has(key)) if (this.storedBots.has(key))
{ {
this.storedBots.get(key).unshift(e); this.storedBots.get(key).unshift(bot);
} }
else else
{ {
this.storedBots.set(key, [e]); this.storedBots.set(key, [bot]);
} }
}); }
} }
/** /**

View File

@ -197,14 +197,14 @@ export class BotLootCacheService
// Get loot items (excluding magazines, bullets, grenades and healing items) // Get loot items (excluding magazines, bullets, grenades and healing items)
const backpackLootItems = backpackLootTemplates.filter((template) => const backpackLootItems = backpackLootTemplates.filter((template) =>
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation> // biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
!this.isBulletOrGrenade(template._props) && !this.isMagazine(template._props) // && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot !this.isBulletOrGrenade(template._props) && !this.isMagazine(template._props) // && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot
&& !this.isGrenade(template._props) && !this.isGrenade(template._props)
); );
// Get pocket loot // Get pocket loot
const pocketLootItems = pocketLootTemplates.filter((template) => const pocketLootItems = pocketLootTemplates.filter((template) =>
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation> // biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
!this.isBulletOrGrenade(template._props) !this.isBulletOrGrenade(template._props)
&& !this.isMagazine(template._props) && !this.isMagazine(template._props)
&& !this.isMedicalItem(template._props) && !this.isMedicalItem(template._props)
@ -215,7 +215,7 @@ export class BotLootCacheService
// Get vest loot items // Get vest loot items
const vestLootItems = vestLootTemplates.filter((template) => const vestLootItems = vestLootTemplates.filter((template) =>
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation> // biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
!this.isBulletOrGrenade(template._props) !this.isBulletOrGrenade(template._props)
&& !this.isMagazine(template._props) && !this.isMagazine(template._props)
&& !this.isMedicalItem(template._props) && !this.isMedicalItem(template._props)

View File

@ -148,8 +148,8 @@ export class InsuranceService
{ {
const dialogueTemplates = this.databaseServer.getTables().traders[Traders.PRAPOR].dialogue; // todo: get trader id instead of hard coded prapor const dialogueTemplates = this.databaseServer.getTables().traders[Traders.PRAPOR].dialogue; // todo: get trader id instead of hard coded prapor
const randomResponseId = locationName?.toLowerCase() === "laboratory" const randomResponseId = locationName?.toLowerCase() === "laboratory"
? this.randomUtil.getArrayValue(dialogueTemplates["insuranceFailedLabs"]) ? this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailedLabs)
: this.randomUtil.getArrayValue(dialogueTemplates["insuranceFailed"]); : this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailed);
this.mailSendService.sendLocalisedNpcMessageToPlayer( this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionId, sessionId,

View File

@ -39,7 +39,7 @@ export class LocaleService
`Unable to find desired locale file using locale ${this.getDesiredGameLocale()} from config/locale.json, falling back to 'en'`, `Unable to find desired locale file using locale ${this.getDesiredGameLocale()} from config/locale.json, falling back to 'en'`,
); );
return this.databaseServer.getTables().locales.global["en"]; return this.databaseServer.getTables().locales.global.en;
} }
/** /**

View File

@ -1,5 +1,5 @@
import { I18n } from "i18n";
import path from "node:path"; import path from "node:path";
import { I18n } from "i18n";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig"; import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig";
@ -57,7 +57,7 @@ export class LocalisationService
*/ */
public getKeys(): string[] public getKeys(): string[]
{ {
return Object.keys(this.databaseServer.getTables().locales.server["en"]); return Object.keys(this.databaseServer.getTables().locales.server.en);
} }
/** /**
@ -67,7 +67,7 @@ export class LocalisationService
*/ */
public getRandomTextThatMatchesPartialKey(partialKey: string): string public getRandomTextThatMatchesPartialKey(partialKey: string): string
{ {
const filteredKeys = Object.keys(this.databaseServer.getTables().locales.server["en"]).filter((x) => const filteredKeys = Object.keys(this.databaseServer.getTables().locales.server.en).filter((x) =>
x.startsWith(partialKey) x.startsWith(partialKey)
); );
const chosenKey = this.randomUtil.getArrayValue(filteredKeys); const chosenKey = this.randomUtil.getArrayValue(filteredKeys);

View File

@ -417,7 +417,7 @@ export class ProfileFixerService
const existsInQuests = pmcProfile.Quests.some((q) => q.qid === backendCounter.qid); const existsInQuests = pmcProfile.Quests.some((q) => q.qid === backendCounter.qid);
// if BackendCounter's quest is neither in activeQuests nor Quests it's stale // if BackendCounter's quest is neither in activeQuests nor Quests it's stale
if (!existsInActiveRepeatableQuests && !existsInQuests) if (!(existsInActiveRepeatableQuests || existsInQuests))
{ {
counterKeysToRemove.push(key); counterKeysToRemove.push(key);
} }
@ -435,14 +435,14 @@ export class ProfileFixerService
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[] protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]
{ {
let activeQuests = []; let activeQuests = [];
repeatableQuests?.forEach((x) => for (const repeatableQuest of repeatableQuests)
{ {
if (x.activeQuests.length > 0) if (repeatableQuest.activeQuests.length > 0)
{ {
// daily/weekly collection has active quests in them, add to array and return // daily/weekly collection has active quests in them, add to array and return
activeQuests = activeQuests.concat(x.activeQuests); activeQuests = activeQuests.concat(repeatableQuest.activeQuests);
} }
}); }
return activeQuests; return activeQuests;
} }
@ -462,9 +462,9 @@ export class ProfileFixerService
protected addMissingBonusesProperty(pmcProfile: IPmcData): void protected addMissingBonusesProperty(pmcProfile: IPmcData): void
{ {
if (typeof pmcProfile["Bonuses"] === "undefined") if (typeof pmcProfile.Bonuses === "undefined")
{ {
pmcProfile["Bonuses"] = []; pmcProfile.Bonuses = [];
this.logger.debug("Missing Bonuses property added to profile"); this.logger.debug("Missing Bonuses property added to profile");
} }
} }
@ -1006,7 +1006,7 @@ export class ProfileFixerService
*/ */
public addMissingHideoutAreasToProfile(fullProfile: IAkiProfile): void public addMissingHideoutAreasToProfile(fullProfile: IAkiProfile): void
{ {
const pmcProfile = fullProfile.characters["pmc"]; const pmcProfile = fullProfile.characters.pmc;
// No profile, probably new account being created // No profile, probably new account being created
if (!pmcProfile?.Hideout) if (!pmcProfile?.Hideout)
{ {
@ -1059,7 +1059,7 @@ export class ProfileFixerService
public fixIncorrectAidValue(fullProfile: IAkiProfile): void public fixIncorrectAidValue(fullProfile: IAkiProfile): void
{ {
// Not a number, regenerate // Not a number, regenerate
if (isNaN(fullProfile.characters.pmc.aid)) if (Number.isNaN(fullProfile.characters.pmc.aid))
{ {
fullProfile.characters.pmc.sessionId = <string><unknown>fullProfile.characters.pmc.aid; fullProfile.characters.pmc.sessionId = <string><unknown>fullProfile.characters.pmc.aid;
fullProfile.characters.pmc.aid = this.hashUtil.generateAccountId(); fullProfile.characters.pmc.aid = this.hashUtil.generateAccountId();
@ -1145,11 +1145,11 @@ export class ProfileFixerService
*/ */
protected migrateImprovements(pmcProfile: IPmcData): void protected migrateImprovements(pmcProfile: IPmcData): void
{ {
if (pmcProfile.Hideout["Improvements"]) if (pmcProfile.Hideout.Improvements)
{ {
// Correct name is `Improvement` // Correct name is `Improvement`
pmcProfile.Hideout.Improvement = this.jsonUtil.clone(pmcProfile.Hideout["Improvements"]); pmcProfile.Hideout.Improvement = this.jsonUtil.clone(pmcProfile.Hideout.Improvements);
delete pmcProfile.Hideout["Improvements"]; delete pmcProfile.Hideout.Improvements;
this.logger.success("Successfully migrated hideout Improvements data to new location, deleted old data"); this.logger.success("Successfully migrated hideout Improvements data to new location, deleted old data");
} }
} }

View File

@ -189,7 +189,10 @@ export class RagfairOfferService
public expireStaleOffers(): void public expireStaleOffers(): void
{ {
const time = this.timeUtil.getTimestamp(); const time = this.timeUtil.getTimestamp();
this.ragfairOfferHandler.getStaleOffers(time).forEach((o) => this.processStaleOffer(o)); for (const staleOffer of this.ragfairOfferHandler.getStaleOffers(time))
{
this.processStaleOffer(staleOffer);
}
} }
/** /**

View File

@ -70,15 +70,15 @@ export class RagfairTaxService
if (requirementsPrice >= itemWorth) if (requirementsPrice >= itemWorth)
{ {
requirementPriceMult = Math.pow(requirementPriceMult, 1.08); requirementPriceMult = requirementPriceMult ** 1.08;
} }
else else
{ {
itemPriceMult = Math.pow(itemPriceMult, 1.08); itemPriceMult = itemPriceMult ** 1.08;
} }
itemPriceMult = Math.pow(4, itemPriceMult); itemPriceMult = 4 ** itemPriceMult;
requirementPriceMult = Math.pow(4, requirementPriceMult); requirementPriceMult = 4 ** requirementPriceMult;
const hideoutFleaTaxDiscountBonus = pmcData.Bonuses.find((b) => b.type === "RagfairCommission"); const hideoutFleaTaxDiscountBonus = pmcData.Bonuses.find((b) => b.type === "RagfairCommission");
const taxDiscountPercent = hideoutFleaTaxDiscountBonus ? Math.abs(hideoutFleaTaxDiscountBonus.value) : 0; const taxDiscountPercent = hideoutFleaTaxDiscountBonus ? Math.abs(hideoutFleaTaxDiscountBonus.value) : 0;
@ -170,7 +170,7 @@ export class RagfairTaxService
if ("Repairable" in item.upd && <number>itemTemplate._props.armorClass > 0) if ("Repairable" in item.upd && <number>itemTemplate._props.armorClass > 0)
{ {
const num2 = 0.01 * Math.pow(0.0, item.upd.Repairable.MaxDurability); const num2 = 0.01 * (0.0 ** item.upd.Repairable.MaxDurability);
worth = worth * ((item.upd.Repairable.MaxDurability / itemTemplate._props.Durability) - num2) worth = worth * ((item.upd.Repairable.MaxDurability / itemTemplate._props.Durability) - num2)
- Math.floor( - Math.floor(
itemTemplate._props.RepairCost itemTemplate._props.RepairCost

View File

@ -415,10 +415,10 @@ export class SeasonalEventService
*/ */
protected addLootItemsToGifterDropItemsList(): void protected addLootItemsToGifterDropItemsList(): void
{ {
const gifterBot = this.databaseServer.getTables().bots.types["gifter"]; const gifterBot = this.databaseServer.getTables().bots.types.gifter;
for (const difficulty in gifterBot.difficulty) for (const difficulty in gifterBot.difficulty)
{ {
gifterBot.difficulty[difficulty].Patrol["ITEMS_TO_DROP"] = gifterBot.inventory.items.Backpack.join(", "); gifterBot.difficulty[difficulty].Patrol.ITEMS_TO_DROP = gifterBot.inventory.items.Backpack.join(", ");
} }
} }
@ -468,7 +468,7 @@ export class SeasonalEventService
protected addPumpkinsToScavBackpacks(): void protected addPumpkinsToScavBackpacks(): void
{ {
const assaultBackpack = this.databaseServer.getTables().bots.types["assault"].inventory.items.Backpack; const assaultBackpack = this.databaseServer.getTables().bots.types.assault.inventory.items.Backpack;
assaultBackpack.push("634959225289190e5e773b3b"); assaultBackpack.push("634959225289190e5e773b3b");
assaultBackpack.push("634959225289190e5e773b3b"); assaultBackpack.push("634959225289190e5e773b3b");
assaultBackpack.push("634959225289190e5e773b3b"); assaultBackpack.push("634959225289190e5e773b3b");

View File

@ -206,8 +206,8 @@ export class DatabaseImporter implements OnLoad
enum VaildationResult enum VaildationResult
{ {
SUCCESS, SUCCESS = 0,
FAILED, FAILED = 1,
NOT_FOUND, NOT_FOUND = 2,
UNDEFINED, UNDEFINED = 3,
} }

View File

@ -1,8 +1,8 @@
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
import { Queue } from "@spt-aki/utils/collections/queue/Queue";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
import { Queue } from "@spt-aki/utils/collections/queue/Queue";
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/brace-style */ /* eslint-disable @typescript-eslint/brace-style */

View File

@ -51,7 +51,10 @@ export class RagfairOfferHolder
public addOffers(offers: Array<IRagfairOffer>): void public addOffers(offers: Array<IRagfairOffer>): void
{ {
offers.forEach((o) => this.addOffer(o)); for (const offer of offers)
{
this.addOffer(offer);
}
} }
public addOffer(offer: IRagfairOffer): void public addOffer(offer: IRagfairOffer): void
@ -76,7 +79,10 @@ export class RagfairOfferHolder
public removeOffers(offers: Array<IRagfairOffer>): void public removeOffers(offers: Array<IRagfairOffer>): void
{ {
offers.forEach((o) => this.removeOffer(o)); for (const offer of offers)
{
this.removeOffer(offer);
}
} }
public removeOfferByTrader(traderId: string): void public removeOfferByTrader(traderId: string): void

View File

@ -1,5 +1,5 @@
import { injectable } from "tsyringe";
import { formatInTimeZone } from "date-fns-tz"; import { formatInTimeZone } from "date-fns-tz";
import { injectable } from "tsyringe";
/** /**
* Utility class to handle time related operations. * Utility class to handle time related operations.

View File

@ -1,13 +1,13 @@
import "reflect-metadata"; import "reflect-metadata";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
import fs from "node:fs";
import crypto from "node:crypto"; import crypto from "node:crypto";
import { promisify } from "node:util"; import fs from "node:fs";
import path, { resolve } from "node:path"; import path, { resolve } from "node:path";
import { promisify } from "node:util";
import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue";
import { writeFileSync } from "atomically"; import { writeFileSync } from "atomically";
import lockfile from "proper-lockfile"; import lockfile from "proper-lockfile";
import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue";
@injectable() @injectable()
export class VFS export class VFS

View File

@ -18,7 +18,10 @@ export class Queue<T>
public enqueueAll(elements: T[]): void public enqueueAll(elements: T[]): void
{ {
elements.forEach((e) => this.enqueue(e)); for (const element of elements)
{
this.enqueue(element);
}
} }
public dequeue(): T public dequeue(): T

View File

@ -1,5 +1,5 @@
import fs from "node:fs";
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs";
import { promisify } from "node:util"; import { promisify } from "node:util";
import winston, { createLogger, format, transports } from "winston"; import winston, { createLogger, format, transports } from "winston";
import DailyRotateFile from "winston-daily-rotate-file"; import DailyRotateFile from "winston-daily-rotate-file";

View File

@ -1,17 +1,14 @@
import "reflect-metadata"; import "reflect-metadata";
import { container, DependencyContainer, Lifecycle } from "tsyringe"; import { DependencyContainer, Lifecycle, container } from "tsyringe";
// For the Vitest Custom Environment.
import type { Environment } from "vitest";
import { Container } from "@spt-aki/di/Container";
// Required for importing the database.
import path from "node:path"; import path from "node:path";
import { Container } from "@spt-aki/di/Container";
import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables"; import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil"; import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
import type { Environment } from "vitest";
// Manually mock for the logger. // Manually mock the logger.
import { WinstonLogger } from "@tests/__mocks__/WinstonLogger.mock"; import { WinstonLogger } from "@tests/__mocks__/WinstonLogger.mock";
export default <Environment>{ export default <Environment>{

View File

@ -1,9 +1,10 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { format } from "date-fns";
import { profileInsuranceFixture } from "@tests/__fixture__/profileInsurance.fixture";
import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile";
import { profileInsuranceFixture } from "@tests/__fixture__/profileInsurance.fixture";
import { format } from "date-fns";
type DateInput = number | number[] | { [index: number]: number; }; type DateInput = number | number[] | { [index: number]: number; };
@ -79,7 +80,6 @@ export class ProfileInsuranceFactory
this.profileInsuranceFixture = this.profileInsuranceFixture.map((insurance) => this.profileInsuranceFixture = this.profileInsuranceFixture.map((insurance) =>
{ {
insurance.items = insurance.items.filter((item) => itemHelper.isAttachmentAttached(item)); insurance.items = insurance.items.filter((item) => itemHelper.isAttachmentAttached(item));
return insurance; return insurance;
}); });

View File

@ -1,16 +1,16 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, afterEach, describe, expect, it, beforeEach } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { InsuranceController } from "@spt-aki/controllers/InsuranceController"; import { InsuranceController } from "@spt-aki/controllers/InsuranceController";
import { ProfileInsuranceFactory } from "@tests/__factories__/ProfileInsurance.factory"; import { ProfileInsuranceFactory } from "@tests/__factories__/ProfileInsurance.factory";
import { MessageType } from "@spt-aki/models/enums/MessageType"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { MessageType } from "@spt-aki/models/enums/MessageType";
describe("InsuranceController", () => describe("InsuranceController", () =>
{ {
@ -1382,13 +1382,13 @@ describe("InsuranceController", () =>
describe("insure", () => describe("insure", () =>
{ {
let pmcData: any, let pmcData: any;
body: any, let body: any;
sessionId: string, let sessionId: string;
insuranceController: any, let insuranceController: any;
mockGetPremium: any, let mockGetPremium: any;
mockPayMoney: any, let mockPayMoney: any;
mockGetOutput: any; let mockGetOutput: any;
beforeEach(() => beforeEach(() =>
{ {

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { BotGenerator } from "@spt-aki/generators/BotGenerator"; import { BotGenerator } from "@spt-aki/generators/BotGenerator";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
@ -129,8 +129,8 @@ describe("BotGenerator", () =>
it("should return name `test (usec)` for player scav bot", () => it("should return name `test (usec)` for player scav bot", () =>
{ {
botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100; botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100;
botGenerator.databaseServer.getTables().bots.types["usec"].firstName = ["usec"]; botGenerator.databaseServer.getTables().bots.types.usec.firstName = ["usec"];
botGenerator.databaseServer.getTables().bots.types["bear"].firstName = []; botGenerator.databaseServer.getTables().bots.types.bear.firstName = [];
const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } }; const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile); vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);

View File

@ -1,6 +1,6 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { BotLevelGenerator } from "@spt-aki/generators/BotLevelGenerator"; import { BotLevelGenerator } from "@spt-aki/generators/BotLevelGenerator";
import { MinMax } from "@spt-aki/models/common/MinMax"; import { MinMax } from "@spt-aki/models/common/MinMax";

View File

@ -1,6 +1,6 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper";

View File

@ -1,6 +1,6 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper"; import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { Money } from "@spt-aki/models/enums/Money"; import { Money } from "@spt-aki/models/enums/Money";

View File

@ -1,6 +1,6 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { InRaidHelper } from "@spt-aki/helpers/InRaidHelper"; import { InRaidHelper } from "@spt-aki/helpers/InRaidHelper";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";

View File

@ -1,12 +1,12 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
describe("ItemHelper", () => describe("ItemHelper", () =>
{ {
@ -253,7 +253,7 @@ describe("ItemHelper", () =>
const fixedItem = itemHelper.fixItemStackCount(initialItem); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
expect(fixedItem.upd!.StackObjectsCount).toBe(1); expect(fixedItem.upd?.StackObjectsCount).toBe(1);
}); });
it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () => it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () =>
@ -262,7 +262,7 @@ describe("ItemHelper", () =>
const fixedItem = itemHelper.fixItemStackCount(initialItem); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
expect(fixedItem.upd!.StackObjectsCount).toBe(1); expect(fixedItem.upd?.StackObjectsCount).toBe(1);
}); });
it("should not change upd.StackObjectsCount if it is already defined", () => it("should not change upd.StackObjectsCount if it is already defined", () =>
@ -271,7 +271,7 @@ describe("ItemHelper", () =>
const fixedItem = itemHelper.fixItemStackCount(initialItem); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
expect(fixedItem.upd!.StackObjectsCount).toBe(5); expect(fixedItem.upd?.StackObjectsCount).toBe(5);
}); });
}); });
@ -446,7 +446,7 @@ describe("ItemHelper", () =>
expect(result).toBe(0.5); expect(result).toBe(0.5);
}); });
it("should return correct value for a reparable helmet", () => it("should return correct value for a repairable helmet", () =>
{ {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const item: Item = { const item: Item = {
@ -815,7 +815,7 @@ describe("ItemHelper", () =>
describe("addCartridgesToAmmoBox", () => describe("addCartridgesToAmmoBox", () =>
{ {
it("should return an array with 1xammoBox and 1xcartridge item", () => it("should return an array with 1x ammoBox and 1x cartridge item", () =>
{ {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [{ const ammoBox: Item[] = [{
@ -831,7 +831,7 @@ describe("ItemHelper", () =>
expect(ammoBox[1].upd.StackObjectsCount).toBe(8); expect(ammoBox[1].upd.StackObjectsCount).toBe(8);
}); });
it("should return an array with 1xammoBox and 2xcartridge items", () => it("should return an array with 1x ammoBox and 2x cartridge items", () =>
{ {
const itemId = container.resolve<HashUtil>("HashUtil").generate(); const itemId = container.resolve<HashUtil>("HashUtil").generate();
const ammoBox: Item[] = [{ const ammoBox: Item[] = [{

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService"; import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService";
describe("ItemBaseClassService", () => describe("ItemBaseClassService", () =>

View File

@ -1,16 +1,16 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader";
import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData";
import { HashUtil } from "@spt-aki/utils/HashUtil";
describe("PaymentService", () => describe("PaymentService", () =>
{ {

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, beforeEach, afterEach, describe, expect, it } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { PlayerService } from "@spt-aki/services/PlayerService"; import { PlayerService } from "@spt-aki/services/PlayerService";

View File

@ -1,6 +1,6 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe"; import { container } from "tsyringe";
import { vi, afterEach, describe, expect, it, beforeEach } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path"; import path from "node:path";
import { defineConfig } from "vitest/config"; import { defineConfig } from "vitest/config";