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.
###############################################################################
* text=auto
* text=auto eol=lf
###############################################################################
# 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",
"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 fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import gulp from "gulp";
import { exec } from "gulp-execa";
import rename from "gulp-rename";
import pkg from "pkg";
import pkgfetch from "pkg-fetch";
import * as ResEdit from "resedit";
@ -27,7 +25,7 @@ const entries = {
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 });

View File

@ -72,7 +72,6 @@
"pkg": "5.8.1",
"pkg-fetch": "3.5.2",
"resedit": "2.0.0",
"rome": "12.1.3",
"ts-node-dev": "2.0.0",
"tsconfig-paths": "4.2.0",
"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.getBotDifficulty(type, difficulty));
}

View File

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

View File

@ -41,8 +41,7 @@ export class DialogueCallbacks implements OnUpdate
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("DialogueController") protected dialogueController: DialogueController,
)
{
}
{}
/**
* Handle client/friend/list
@ -73,7 +72,7 @@ export class DialogueCallbacks implements OnUpdate
DateTime: this.timeUtil.getTimestamp(),
IsDeveloper: true,
Regions: ["EUR"],
VersionId: "bgkidft87ddd",
VersionId: "bgkidft87ddd", // TODO: Is this... correct?
Ip: "",
Port: 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";
@injectable()
class GameCallbacks implements OnLoad
export class GameCallbacks implements OnLoad
{
constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@ -58,9 +58,7 @@ class GameCallbacks implements OnLoad
const today = new Date().toUTCString();
const startTimeStampMS = Date.parse(today);
this.gameController.gameStart(url, info, sessionID, startTimeStampMS);
return this.httpResponse.getBody({
utc_time: startTimeStampMS / 1000,
});
return this.httpResponse.getBody({ utc_time: startTimeStampMS / 1000 });
}
/**
@ -150,5 +148,3 @@ class GameCallbacks implements OnLoad
return this.httpResponse.nullResponse();
}
}
export {GameCallbacks};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -91,6 +91,7 @@ export class MatchCallbacks
{
return this.httpResponse.getBody(true);
}
/** Handle client/match/group/transfer */
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";
@injectable()
class ModCallbacks implements OnLoad
export class ModCallbacks implements OnLoad
{
protected httpConfig: IHttpConfig;
@ -40,5 +40,3 @@ class ModCallbacks implements OnLoad
return "aki-mods";
}
}
export {ModCallbacks};

View File

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

View File

@ -46,7 +46,6 @@ export class QuestCallbacks
{
return this.questController.acceptRepeatableQuest(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 false;
}
@ -96,7 +95,7 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
return this.ragfairController.addPlayerOffer(pmcData, info, sessionID);
}
/** \Handle RagFairRemoveOffer event */
/** Handle RagFairRemoveOffer event */
public removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse
{
return this.ragfairController.removeOffer(info.offerId, sessionID);

View File

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

View File

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

View File

@ -11,13 +11,16 @@ export class ApplicationContext
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
* @returns
*/
@ -27,7 +30,6 @@ export class ApplicationContext
{
return this.variables.get(type)?.getTail()?.getValue();
}
return undefined;
}
@ -37,7 +39,6 @@ export class ApplicationContext
{
return this.variables.get(type).toList();
}
return undefined;
}

View File

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

View File

@ -51,8 +51,8 @@ export class BotController
}
/**
* Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for
* Return the number of bot load-out varieties to be generated
* @param type bot Type we want the load-out gen count for
* @returns number of bots to generate
*/
public getBotPresetGenerationLimit(type: string): number
@ -62,16 +62,14 @@ export class BotController
if (!value)
{
this.logger.warning(`No value found for bot type ${type}, defaulting to 30`);
return value;
}
return value;
}
/**
* 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
*/
public getBotCoreDifficulty(): IBotCore
@ -130,7 +128,7 @@ export class BotController
break;
default:
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()))
{
this.botHelper.addBotToEnemyList(difficultySettings, [
@ -138,7 +136,6 @@ export class BotController
this.pmcConfig.usecType,
], lowercasedBotType);
}
break;
}
@ -211,6 +208,7 @@ export class BotController
}
cacheKey = `${botRole}${details.botDifficulty}`;
// Check for bot in cache, add if not
if (!this.botGenerationCacheService.cacheHasBotOfRole(cacheKey))
{
@ -219,6 +217,7 @@ export class BotController
this.botGenerationCacheService.storeBots(cacheKey, botsToAddToCache);
}
}
// Get bot from cache, add to return array
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
* @returns
*/
public getPMCDifficulty(requestedDifficulty: string): string
{
// maybe retrun a random difficulty...
// Maybe return a random difficulty...
if (this.pmcConfig.difficulty.toLowerCase() === "asonline")
{
return requestedDifficulty;

View File

@ -42,7 +42,7 @@ export class CustomizationController
const templates = this.databaseServer.getTables().templates.customization;
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);
// 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 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
* for the specified dialogue.
* @param request Get dialog request
@ -173,7 +173,7 @@ export class DialogueController
/**
* Get dialog from player profile, create if doesn't exist
* @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
*/
protected getDialogByIdFromProfile(profile: IAkiProfile, request: IGetMailDialogViewRequestData): Dialogue
@ -211,7 +211,7 @@ export class DialogueController
{
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))
{
const pmcProfile = fullProfile.characters.pmc;
@ -274,7 +274,6 @@ export class DialogueController
if (!dialog)
{
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
return;
}
@ -288,7 +287,6 @@ export class DialogueController
if (!dialog)
{
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
return;
}
@ -307,7 +305,6 @@ export class DialogueController
if (!dialogs)
{
this.logger.error(`No dialog object in profile: ${sessionId}`);
return;
}
@ -332,7 +329,6 @@ export class DialogueController
if (!dialog)
{
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
return;
}
@ -371,9 +367,7 @@ export class DialogueController
protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void
{
const sender = this.profileHelper.getPmcProfile(sessionId);
const sptFriendUser = this.getSptFriendData();
const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text);
if (giftSent === GiftSentResult.SUCCESS)
@ -387,7 +381,6 @@ export class DialogueController
"You found a gift code!",
]),
);
return;
}
@ -398,7 +391,6 @@ export class DialogueController
sptFriendUser,
this.randomUtil.getArrayValue(["Looks like you already used that code", "You already have that!!"]),
);
return;
}
@ -435,7 +427,7 @@ export class DialogueController
"Hi",
"Greetings",
"Hello",
"bonjor",
"Bonjour",
"Yo",
"Sup",
"Heyyyyy",

View File

@ -83,9 +83,9 @@ export class GameController
public load(): void
{
// 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.addCustomLooseLootPositions();
}
@ -121,9 +121,9 @@ export class GameController
this.checkTraderRepairValuesExist();
// repeatableQuests are stored by in profile.Quests due to the responses of the client (e.g. Quests in offraidData)
// Since we don't want to clutter the Quests list, we need to remove all completed (failed / successful) repeatable quests.
// We also have to remove the Counters from the repeatableQuests
// repeatableQuests are stored by in profile.Quests due to the responses of the client (e.g. Quests in
// offraidData). Since we don't want to clutter the Quests list, we need to remove all completed (failed or
// successful) repeatable quests. We also have to remove the Counters from the repeatableQuests
if (sessionID)
{
const fullProfile = this.profileHelper.getFullProfile(sessionID);
@ -253,6 +253,9 @@ export class GameController
this.logger.warning(
`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;
}
}
@ -289,7 +292,7 @@ export class GameController
continue;
}
// new postion, add entire object
// New position, add entire object
mapLooseLoot.spawnpoints.push(positionToAdd);
}
}
@ -386,6 +389,7 @@ export class GameController
}
else
{
// Bot type not found, add new object
map.base.MinMaxBots.push({
// Bot type not found, add new object
WildSpawnType: botToLimit.type,
@ -457,10 +461,7 @@ export class GameController
*/
public getKeepAlive(sessionId: string): IGameKeepAliveResponse
{
return {
msg: "OK",
utc_time: new Date().getTime() / 1000,
};
return { 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
* TODO - add body part HP regen
* // TODO: Add body part HP regeneration
* @param pmcProfile
*/
protected updateProfileHealthValues(pmcProfile: IPmcData): void
@ -641,7 +642,7 @@ export class GameController
*/
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)
{
// 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
{
@ -724,12 +726,12 @@ export class GameController
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);
wavesAddedCount++;
}
// Update subsequent wave number property to accomodate the new waves
// Update subsequent wave number property to accommodate the new waves
for (
let index = indexOfWaveToSplit + wavesAddedCount + 1;
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
{
@ -802,18 +804,18 @@ export class GameController
// Merge started/success/fail quest assorts into one dictionary
const mergedQuestAssorts = {
...traderData.questassort["started"],
...traderData.questassort["success"],
...traderData.questassort["fail"],
...traderData.questassort.started,
...traderData.questassort.success,
...traderData.questassort.fail,
};
// loop over all assorts for trader
// Loop over all assorts for trader
for (const [assortKey, questKey] of Object.entries(mergedQuestAssorts))
{
// Does assort key exist in trader assort file
if (!traderAssorts.loyal_level_items[assortKey])
{
// reverse lookup of enum key by value
// Reverse lookup of enum key by value
const messageValues = {
traderName: Object.keys(Traders)[Object.values(Traders).indexOf(traderId)],
questName: quests[questKey]?.QuestName ?? "UNKNOWN",
@ -837,14 +839,14 @@ export class GameController
{
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
{
const undefinedDialog = fullProfile.dialogues["undefined"];
const undefinedDialog = fullProfile.dialogues.undefined;
if (undefinedDialog)
{
delete fullProfile.dialogues["undefined"];
delete fullProfile.dialogues.undefined;
}
}
@ -867,7 +869,7 @@ export class GameController
*/
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)
{
this.databaseServer.getTables().locales.global[localeKey]["61687e2c3e526901fa76baf9"] = "";

View File

@ -91,8 +91,8 @@ export class HealthController
else
{
// Get max healing from db
const maxhp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource;
healingItemToUse.upd.MedKit = { HpResource: maxhp - request.count }; // Subtract amout used from max
const maxHp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource;
healingItemToUse.upd.MedKit = { HpResource: maxHp - request.count }; // Subtract amount used from max
}
// Resource in medkit is spent, delete it

View File

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

View File

@ -205,7 +205,8 @@ export class InraidController
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 activeQuestIdsInProfile = pmcData.Quests.filter((x) =>
![QuestStatus.AvailableForStart, QuestStatus.Success, QuestStatus.Expired].includes(x.status)
@ -257,13 +258,13 @@ export class InraidController
/**
* Reduce body part hp to % of max
* @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))
{
(<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 profile.ConditionCounters.Counters.length > 0;
}
@ -365,7 +365,6 @@ export class InraidController
{
// Doesn't exist yet, push it straight in
pmcProfile.ConditionCounters.Counters.push(scavCounter);
continue;
}
@ -400,7 +399,7 @@ export class InraidController
{
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);
}
}

View File

@ -24,9 +24,9 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { PaymentService } from "@spt-aki/services/PaymentService";
import { MathUtil } from "@spt-aki/utils/MathUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil";
@injectable()
export class InsuranceController
@ -124,7 +124,7 @@ export class InsuranceController
);
// 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.
const itemsToDelete = this.findItemsToDelete(insured);
@ -140,7 +140,7 @@ export class InsuranceController
// Remove the fully processed insurance package from the profile.
this.removeInsurancePackageFromProfile(sessionID, insured.messageContent.systemData);
});
}
}
/**
@ -224,7 +224,10 @@ export class InsuranceController
protected populateItemsMap(insured: Insurance): 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;
}
@ -325,7 +328,10 @@ export class InsuranceController
);
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>,
): void
{
mainParentToAttachmentsMap.forEach((attachmentItems, parentId) =>
for (const [parentId, attachmentItems] of mainParentToAttachmentsMap)
{
// Log the parent item's name.
const parentItem = itemsMap.get(parentId);
@ -355,7 +361,7 @@ export class InsuranceController
// Process the attachments for this individual parent item.
this.processAttachmentByParent(attachmentItems, traderId, toDelete);
});
}
}
/**
@ -402,10 +408,10 @@ export class InsuranceController
*/
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);
valuableToDelete.forEach((attachmentsId) =>
for (const attachmentsId of valuableToDelete)
{
const valuableChild = attachments.find(({ _id }) => _id === attachmentsId);
if (valuableChild)
@ -445,7 +451,7 @@ export class InsuranceController
this.logger.debug(`Marked for removal - Child Item: ${name}, Max Price: ${maxPrice}`);
toDelete.add(attachmentsId);
}
});
}
}
/**
@ -471,7 +477,7 @@ export class InsuranceController
{
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.
const parentExists = insured.items.some((parentItem) => parentItem._id === item.parentId);
@ -483,7 +489,7 @@ export class InsuranceController
item.slotId = "hideout";
delete item.location;
}
});
}
}
/**

View File

@ -93,7 +93,7 @@ export class InventoryController
const ownerInventoryItems = this.inventoryHelper.getOwnerInventoryItems(moveRequest, sessionID);
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)
{
return this.getTraderExploitErrorResponse(output);
@ -182,7 +182,7 @@ export class InventoryController
/**
* Split Item
* spliting 1 stack into 2
* splitting 1 stack into 2
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
* @param request Split request
* @param sessionID Session/player id
@ -206,7 +206,8 @@ export class InventoryController
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);
if (!itemToSplit)
{
@ -311,8 +312,8 @@ export class InventoryController
}
/**
* 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: 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
* 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"
* @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}`);
}
// to.id is the parentid
// to.id is the parentId
itemOne.parentId = request.to.id;
// to.container is the slotid
// to.container is the slotId
itemOne.slotId = request.to.container;
// 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 body Toggle request
* @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
* Handle bind event
* @param pmcData Player profile
* @param bindRequest Reqeust object
* @param bindRequest Request object
* @param sessionID Session id
* @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
* @returns tplid
* @returns string
*/
protected getExaminedItemTpl(body: IInventoryExamineRequestData): string
{
@ -675,40 +676,41 @@ export class InventoryController
}
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;
}
else if (body.fromOwner.type === "Trader")
{ // 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) =>
item._id === body.item
)._tpl;
}
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];
if (item)
{
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);
if (!offer)
{
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);
if (matchingItem)
{
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));
}
}
@ -723,7 +725,6 @@ export class InventoryController
{
pmcData.Encyclopedia[id] = true;
}
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
*/
protected getProfileDescriptions(): Record<string, string>
{
return {
/* eslint-disable @typescript-eslint/naming-convention */
Standard: this.localisationService.getText("launcher-profile_standard"),
"Left Behind": this.localisationService.getText("launcher-profile_leftbehind"),
"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 Zero to hero": this.localisationService.getText("launcher-profile_sptzerotohero"),
"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.saveProfile(sessionID);
return sessionID;
}

View File

@ -89,7 +89,7 @@ export class LocationController
const staticLoot = this.locationGenerator.generateStaticContainers(location.base, staticAmmoDist);
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 dynamicSpawnPoints: SpawnpointTemplate[] = this.locationGenerator.generateDynamicLoot(
dynamicLootDist,
@ -140,7 +140,7 @@ export class LocationController
/**
* 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
* @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
// 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)
{
this.pmcConfig.difficulty = this.convertDifficultyDropdownIntoBotDifficulty(
@ -299,8 +299,8 @@ export class MatchController
{
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
// Not exact replica of Live behaviour
// Simplified for now, no real reason to do the whole (unconfirmed) extra 0.01 standing per day regeneration mechanic
// Not exact replica of Live behaviour... Simplified for now. No real reason to do the whole (unconfirmed)
// extra 0.01 standing per day regeneration mechanic.
const baseGain: number = this.inraidConfig.carExtractBaseStandingGain;
const extractCount: number = pmcData.CarExtractCounts[extractName];

View File

@ -48,7 +48,7 @@ export class PresetBuildController
);
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)
{
// Find presets secure container
@ -74,7 +74,7 @@ export class PresetBuildController
sessionId: string,
): IItemEventRouterResponse
{
// TODO - could be merged into saveBuild, maybe
// TODO: Could be merged into saveBuild, maybe
const output = this.eventOutputHolder.getOutput(sessionId);
// Replace duplicate Id's. The first item is the base item.
@ -182,7 +182,7 @@ export class PresetBuildController
sessionID: string,
): IItemEventRouterResponse
{
// todo - does this get called?
// TODO: Does this get called?
return this.removePlayerBuild(pmcData, body.id, sessionID);
}
@ -193,7 +193,7 @@ export class PresetBuildController
sessionID: string,
): IItemEventRouterResponse
{
// todo - does this get called?
// TODO: Does this get called?
return this.removePlayerBuild(pmcData, body.id, sessionID);
}

View File

@ -133,7 +133,7 @@ export class QuestController
break;
}
// Prereq does not have its status requirement fulfilled
// Prerequisite does not have its status requirement fulfilled
if (!conditionToFulfil._props.status.includes(prerequisiteQuest.status))
{
haveCompletedPreviousQuest = false;
@ -402,15 +402,15 @@ export class QuestController
// Can be started text or description text based on above function result
let questStartedMessageText = locale[questStartedMessageKey];
// TODO: remove this whole if statement, possibly not required?
// TODO: Remove this whole if statement, possibly not required?
if (!questStartedMessageText)
{
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`,
);
// For some reason non-en locales dont have repeatable quest ids, fall back to en and grab it if possible
const enLocale = this.databaseServer.getTables().locales.global["en"];
// 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;
questStartedMessageText = enLocale[repeatableQuestProfile.startedMessageText];
if (!questStartedMessageText)
@ -593,12 +593,12 @@ export class QuestController
/**
* Return quests that have different statuses
* @param preQuestStatusus Quests before
* @param preQuestStatuses Quests before
* @param postQuestStatuses Quests after
* @returns QuestStatusChange array
*/
protected getQuestsWithDifferentStatuses(
preQuestStatusus: IQuestStatus[],
preQuestStatuses: IQuestStatus[],
postQuestStatuses: IQuestStatus[],
): IQuestStatus[]
{
@ -607,7 +607,7 @@ export class QuestController
for (const quest of postQuestStatuses)
{
// 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)
{
result.push(quest);
@ -659,7 +659,7 @@ export class QuestController
// Iterate over quests, look for quests with right criteria
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) =>
x._props.target === completedQuestId && x._props.availableAfter > 0
);
@ -686,7 +686,7 @@ export class QuestController
startTime: 0,
status: QuestStatus.AvailableAfter,
statusTimers: {
"9": this.timeUtil.getTimestamp(),
"9": this.timeUtil.getTimestamp(), // eslint-disable-line @typescript-eslint/naming-convention
},
availableAfter: availableAfterTimestamp,
});
@ -832,7 +832,7 @@ export class QuestController
const matchingItemInProfile = pmcData.Inventory.items.find((x) => x._id === itemHandover.id);
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(
handoverQuestRequest,
matchingItemInProfile,

View File

@ -118,8 +118,8 @@ export class RagfairController
{
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
// is not completed yet
// for the items, check the barter schemes. The method getDisplayableAssorts sets a flag sptQuestLocked
// to true if the quest is not completed yet
if (this.ragfairOfferHelper.traderOfferItemQuestLocked(offer, traderAssorts))
{
offer.locked = true;
@ -174,7 +174,7 @@ export class RagfairController
* Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data
* @param offers ragfair offers to get categories for
* @returns record with tpls + counts
* @returns record with templates + counts
*/
protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number>
{
@ -228,7 +228,7 @@ export class RagfairController
for (const offer of offers)
{
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 itemIdsFromFleaOfferRequest Ids from request
* @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();
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();
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
* are still valid. This ischecked by endTime persisted in profile accordning to the resetTime configured for each repeatable kind (daily, weekly)
* in QuestCondig.js
* are still valid. This is checked by endTime persisted in profile according to the resetTime configured for each repeatable kind (daily, weekly)
* in QuestConfig.js
*
* 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
@ -82,7 +82,7 @@ export class RepeatableQuestController
* The new quests generated are again persisted in profile.RepeatableQuests
*
* @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[]
{
@ -304,7 +304,7 @@ export class RepeatableQuestController
}
// 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 targetsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.targets);
@ -394,7 +394,8 @@ export class RepeatableQuestController
// Get cost to replace existing quest
changeRequirement = this.jsonUtil.clone(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) =>
x.name === currentRepeatablePool.name
@ -484,7 +485,6 @@ export class RepeatableQuestController
break;
}
}
return newRepeatableQuest;
}
}

View File

@ -29,7 +29,7 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
@injectable()
class TradeController
export class TradeController
{
protected ragfairConfig: IRagfairConfig;
protected traderConfig: ITraderConfig;
@ -119,7 +119,8 @@ class TradeController
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(
pmcData,
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
* @param sessionId Session id
* @param profileWithItemsToSell Profile with items to be sold to trader
@ -173,7 +174,7 @@ class TradeController
): IItemEventRouterResponse
{
const handbookPrices = this.ragfairPriceService.getAllStaticPrices();
// TODO, apply trader sell bonuses?
// TODO: apply trader sell bonuses?
const traderDetails = this.traderHelper.getTrader(trader, sessionId);
// Prep request object
@ -237,7 +238,7 @@ class TradeController
&& 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;
}
@ -273,5 +274,3 @@ class TradeController
return null;
}
}
export {TradeController};

View File

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

View File

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

View File

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

View File

@ -78,10 +78,6 @@ export class DynamicRouter extends Router
// So instead I added the definition
export class ItemEventRouterDefinition extends Router
{
constructor()
{
super();
}
public handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse
{
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
{
constructor()
{
super();
}
public handleLoad(profile: IAkiProfile): IAkiProfile
{
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);
if (!found && parentSlot !== undefined && parentSlot._required)
{
@ -131,7 +131,7 @@ export class BotEquipmentModGenerator
// Compatible item not found + not required
if (!found && parentSlot !== undefined && !parentSlot._required)
{
// Dont add item
// Don't add item
continue;
}
@ -146,7 +146,7 @@ export class BotEquipmentModGenerator
if (Object.keys(modPool).includes(modTpl))
{
// Call self recursivly
// Call self recursively
this.generateModsForEquipment(
equipment,
modPool,
@ -172,8 +172,8 @@ export class BotEquipmentModGenerator
* @param modSpawnChances Mod spawn chances
* @param ammoTpl Ammo tpl to use when generating magazines/cartridges
* @param botRole Role of bot weapon is generated for
* @param botLevel lvel of the bot weapon is being generated for
* @param modLimits limits placed on certian mod types per gun
* @param botLevel Level of the bot weapon is being generated for
* @param modLimits limits placed on certain mod types per gun
* @param botEquipmentRole role of bot when accessing bot.json equipment config settings
* @returns Weapon + mods array
*/
@ -197,11 +197,9 @@ export class BotEquipmentModGenerator
const compatibleModsPool = modPool[parentTemplate._id];
// Null guard against bad input weapon
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
if (
!parentTemplate._props.Slots.length
&& !parentTemplate._props.Cartridges?.length
&& !parentTemplate._props.Chambers?.length
!((parentTemplate._props.Slots.length || parentTemplate._props.Cartridges?.length)
|| parentTemplate._props.Chambers?.length)
)
{
this.logger.error(
@ -346,7 +344,7 @@ export class BotEquipmentModGenerator
);
// 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
// this entry is not to be filled, we need a special handling for the CylinderMagazine
const modParentItem = this.databaseServer.getTables().templates.items[modToAddTemplate._parent];
@ -372,7 +370,7 @@ export class BotEquipmentModGenerator
}
if (containsModInPool)
{
// Call self recursivly to add mods to this mod
// Call self recursively to add mods to this mod
this.generateModsForWeapon(
sessionId,
weapon,
@ -707,7 +705,7 @@ export class BotEquipmentModGenerator
* @param modTpl _tpl
* @param parentId parentId
* @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
*/
protected createModItem(
@ -741,14 +739,14 @@ export class BotEquipmentModGenerator
/**
* Get a random mod from an items compatible mods Filter array
* @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 items items to ensure picked mod is compatible with
* @returns item tpl
*/
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;
// Find mod item that fits slot from sorted mod array
@ -814,7 +812,7 @@ export class BotEquipmentModGenerator
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 (
!(itemSlot._props.filters[0].Filter.includes(modToAdd[1]._id)
|| this.itemHelper.isOfBaseclasses(modToAdd[1]._id, itemSlot._props.filters[0].Filter))
@ -929,7 +927,7 @@ export class BotEquipmentModGenerator
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(
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
* @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[]
{
@ -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)
{
this.logger.debug(

View File

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

View File

@ -161,7 +161,7 @@ export class BotInventoryGenerator
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))
{
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
* @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
* @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 relativeDeltaMax max delta above player level to go
* @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));
return this.botConfig.lootNValue["scav"];
return this.botConfig.lootNValue.scav;
}
return result;
@ -606,7 +606,7 @@ export class BotLootGenerator
{
if (isPmc)
{
return this.botConfig.itemSpawnLimits["pmc"];
return this.botConfig.itemSpawnLimits.pmc;
}
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),
);
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 { 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
if (
!this.locationConfig.containerRandomisationSettings.enabled
|| !this.locationConfig.containerRandomisationSettings.maps[locationId]
!(this.locationConfig.containerRandomisationSettings.enabled
&& this.locationConfig.containerRandomisationSettings.maps[locationId])
)
{
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 containerData Containers and probability values for a groupId
* @returns List of chosen container Ids
@ -289,11 +289,14 @@ export class LocationGenerator
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);
containerIds.forEach((x) =>
containerDistribution.push(new ProbabilityObject(x, containerData.containerIdsWithProbability[x]))
for (const containerId of containerIds)
{
containerDistribution.push(
new ProbabilityObject(containerId, containerData.containerIdsWithProbability[containerId]),
);
}
chosenContainerIds.push(...containerDistribution.draw(containerData.chosenCount));
@ -489,7 +492,7 @@ export class LocationGenerator
locationName: string,
): 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);
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
* 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
* @returns ProbabilityObjectArray of item tpls + probabilty
* @returns ProbabilityObjectArray of item tpls + probability
*/
protected getPossibleLootItemsForContainer(
containerTypeId: string,
@ -576,7 +579,7 @@ export class LocationGenerator
for (const spawnpoint of allDynamicSpawnpoints)
{
// Point is blacklsited, skip
// Point is blacklisted, skip
if (blacklistedSpawnpoints?.includes(spawnpoint.template.Id))
{
this.logger.debug(`Ignoring loose loot location: ${spawnpoint.template.Id}`);
@ -923,7 +926,7 @@ export class LocationGenerator
}
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}`);
}

View File

@ -51,13 +51,16 @@ export class LootGenerator
const itemTypeCounts = this.initItemLimitCounter(options.itemLimits);
const tables = this.databaseServer.getTables();
const itemBlacklist = new Set(this.itemFilterService.getBlacklistedItems());
options.itemBlacklist.forEach(itemBlacklist.add, itemBlacklist);
const itemBlacklist = new Set<string>([
...this.itemFilterService.getBlacklistedItems(),
...options.itemBlacklist,
]);
if (!options.allowBossItems)
{
this.itemFilterService.getBossItems().forEach(itemBlacklist.add, itemBlacklist);
for (const bossItem of this.itemFilterService.getBossItems())
{
itemBlacklist.add(bossItem);
}
}
// Handle sealed weapon containers
@ -391,7 +394,7 @@ export class LootGenerator
x._parent === rewardTypeId
&& x._type.toLowerCase() === "item"
&& !this.itemFilterService.isItemBlacklisted(x._id)
&& (!containerSettings.allowBossItems && !this.itemFilterService.isBossItem(x._id))
&& (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id)))
&& !x._props.QuestItem
);
@ -438,7 +441,7 @@ export class LootGenerator
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) =>
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
// 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:
// "targets": {
// "Savage": 7,
// "AnyPmc": 2,
// "bossBully": 0.5
// targets: {
// Savage: 7,
// AnyPmc: 2,
// bossBully: 0.5
// }
// 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);
// 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)
{
const itemWhitelist =
@ -1042,8 +1042,7 @@ export class RepeatableQuestGenerator
// 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
// those are not in the game yet (e.g. AGS grenade launcher)
return Object.entries(this.databaseServer.getTables().templates.items).filter(
([tpl, itemTemplate]) =>
return Object.entries(this.databaseServer.getTables().templates.items).filter(([tpl, itemTemplate]) =>
{
// Base "Item" item has no parent, ignore it
if (itemTemplate._parent === "")
@ -1052,8 +1051,7 @@ export class RepeatableQuestGenerator
}
return this.isValidRewardItem(tpl, repeatableQuestConfig);
},
);
});
}
/**
@ -1096,7 +1094,7 @@ export class RepeatableQuestGenerator
}
// 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);
return valid;

View File

@ -11,8 +11,7 @@ export class InventoryMagGen
private ammoTemplate: ITemplateItem,
private pmcInventory: Inventory,
)
{
}
{}
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"
let randomisedAmmoStackSize: number;
if (inventoryMagGen.getAmmoTemplate()._props.StackMaxRandom === 1)
{ // doesnt stack
{
// doesnt stack
randomisedAmmoStackSize = this.randomUtil.getInt(3, 6);
}
else

View File

@ -55,10 +55,9 @@ export class ExternalInventoryMagGen implements IInventoryMagGen
if (ableToFitMagazinesIntoBotInventory === ItemAddedResult.NO_SPACE && i < randomizedMagazineCount)
{
/* We were unable to fit at least the minimum amount of magazines,
* so we fallback to default magazine and try again.
* Temporary workaround to Killa spawning with no extras if he spawns with a drum mag */
// We were unable to fit at least the minimum amount of magazines, so we fallback to default magazine
// and try again. Temporary workaround to Killa spawning with no extras if he spawns with a drum mag.
// TODO: Fix this properly
if (
magazineTpl
=== 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 traderId Traders id the assort belongs to
* @param traderAssorts All assort items from same trader
@ -138,7 +138,13 @@ export class AssortHelper
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;
}
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
* @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
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))
{
difficultySettings.Mind["CAN_RECEIVE_PLAYER_REQUESTS_BEAR"] = false;
difficultySettings.Mind["CAN_RECEIVE_PLAYER_REQUESTS_USEC"] = false;
difficultySettings.Mind["DEFAULT_USEC_BEHAVIOUR"] = "Attack";
difficultySettings.Mind["DEFAULT_BEAR_BEHAVIOUR"] = "Attack";
difficultySettings.Mind.CAN_RECEIVE_PLAYER_REQUESTS_BEAR = false;
difficultySettings.Mind.CAN_RECEIVE_PLAYER_REQUESTS_USEC = false;
difficultySettings.Mind.DEFAULT_USEC_BEHAVIOUR = "Attack";
difficultySettings.Mind.DEFAULT_BEAR_BEHAVIOUR = "Attack";
}
}

View File

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

View File

@ -57,7 +57,7 @@ export class HttpServerHelper
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);
}
}

View File

@ -385,10 +385,10 @@ export class InRaidHelper
&& this.itemHelper.itemIsInsideContainer(x, "SecuredContainer", postRaidProfile.Inventory.items));
});
itemsToRemovePropertyFrom.forEach((item) =>
for (const item of itemsToRemovePropertyFrom)
{
delete item.upd.SpawnedInSession;
});
}
return postRaidProfile;
}
@ -431,10 +431,10 @@ export class InRaidHelper
{
// Get inventory item ids to remove from players profile
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
pmcData.Inventory.fastPanel = {};

View File

@ -315,9 +315,9 @@ export class InventoryHelper
const itemLocation = {};
// 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({
@ -887,9 +887,8 @@ export class InventoryHelper
{
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;
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.
* Here's what a filled AmmoBox looks like:
* {
* "_id": "b1bbe982daa00ac841d4ae4d",
* "_tpl": "57372c89245977685d4159b1",
* "parentId": "5fe49a0e2694b0755a504876",
* "slotId": "hideout",
* "location": {
* "x": 3,
* "y": 4,
* "r": 0
* _id: "b1bbe982daa00ac841d4ae4d",
* _tpl: "57372c89245977685d4159b1",
* parentId: "5fe49a0e2694b0755a504876",
* slotId: "hideout",
* location: {
* x: 3,
* y: 4,
* r: 0
* },
* "upd": {
* "StackObjectsCount": 1
* upd: {
* StackObjectsCount: 1
* }
* },
* {
* "_id": "b997b4117199033afd274a06",
* "_tpl": "56dff061d2720bb5668b4567",
* "parentId": "b1bbe982daa00ac841d4ae4d",
* "slotId": "cartridges",
* "location": 0,
* "upd": {
* "StackObjectsCount": 30
* _id: "b997b4117199033afd274a06",
* _tpl: "56dff061d2720bb5668b4567",
* parentId: "b1bbe982daa00ac841d4ae4d",
* slotId: "cartridges",
* location: 0,
* upd: {
* StackObjectsCount: 30
* }
* }
* 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
{
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":
return "RUB";
default:
return "";
}
@ -214,12 +213,9 @@ export class RagfairHelper
{
case Money.EUROS:
return "€";
case Money.DOLLARS:
return "$";
case Money.ROUBLES:
default:
default: // Money.ROUBLES
return "₽";
}
}

View File

@ -318,7 +318,7 @@ export class RagfairOfferHelper
public increaseProfileRagfairRating(profile: IAkiProfile, amountToIncrementBy: number): void
{
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}`);
@ -635,7 +635,7 @@ export class RagfairOfferHelper
return false;
}
if (isNaN(offer.requirementsCost))
if (Number.isNaN(offer.requirementsCost))
{
// don't include offers with null or NaN in it
return false;

View File

@ -85,7 +85,7 @@ export class RagfairSellHelper
const result: SellResult[] = [];
// 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(
`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 = {
items: [{
// eslint-disable-next-line @typescript-eslint/naming-convention
item_id: buyRequestData.item_id,
count: buyRequestData.count,
}],

View File

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

View File

@ -42,7 +42,7 @@ export class PostDBModLoader implements OnLoad
const mods = this.preAkiModLoader.sortModsLoadOrder();
for (const modName of mods)
{
// // import class
// import class
const filepath = `${this.preAkiModLoader.getModPath(modName)}${
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" });
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;
});
}
}
catch (error)
{

View File

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

View File

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

View File

@ -28,14 +28,14 @@ export const Listen = (basePath: string) =>
this.handlers = {};
// Retrieve all handlers
const handlersArray = Base.prototype["handlers"];
const handlersArray = Base.prototype.handlers;
if (!handlersArray)
{
return;
}
// Add each flagged handler to the Record
handlersArray.forEach(({ handlerName, path, httpMethod }) =>
for (const { handlerName, path, httpMethod } of handlersArray)
{
if (!this.handlers[httpMethod])
{
@ -50,10 +50,10 @@ export const Listen = (basePath: string) =>
}
this.handlers[httpMethod][`/${basePath}/${path}`] = this[handlerName];
}
});
}
// Cleanup the handlers list
Base.prototype["handlers"] = [];
Base.prototype.handlers = [];
}
// 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) =>
{
// 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
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
{

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe";
import type { DependencyContainer } from "tsyringe";
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
{

View File

@ -1,4 +1,4 @@
import { DependencyContainer } from "@spt-aki/models/external/tsyringe";
import type { DependencyContainer } from "tsyringe";
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
{

View File

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

View File

@ -1,5 +1,5 @@
import { IncomingMessage } from "node:http";
import { injectable, injectAll } from "tsyringe";
import { injectAll, injectable } from "tsyringe";
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[]>
{
const map: Map<string, T[]> = new Map();
list.forEach((item) =>
for (const item of list)
{
const key = keyGetter(item);
const collection = map.get(key);
@ -27,7 +27,7 @@ export class HttpRouter
{
collection.push(item);
}
});
}
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 { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";

View File

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

View File

@ -9,27 +9,18 @@ export class DataDynamicRouter extends DynamicRouter
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
{
super([
new RouteAction(
"/client/menu/locale/",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/menu/locale/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
},
),
new RouteAction(
"/client/locale/",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/locale/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
},
),
new RouteAction(
"/client/items/prices/",
(url: string, info: any, sessionID: string, output: string): any =>
}),
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)
{
super([
new RouteAction(
".jpg",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction(".jpg", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
new RouteAction(
".png",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction(".png", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
new RouteAction(
".ico",
(url: string, info: any, sessionID: string, output: string): any =>
}),
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)
{
super([
new RouteAction(
"/?last_id",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/?last_id", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.notify(url, info, sessionID);
},
),
new RouteAction(
"/notifierServer",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/notifierServer", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.notify(url, info, sessionID);
},
),
new RouteAction(
"/push/notifier/get/",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/push/notifier/get/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.getNotifier(url, info, sessionID);
},
),
}),
new RouteAction(
"/push/notifier/getwebsocket/",
(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()
export class HealthSaveLoadRouter extends SaveLoadRouter
{
constructor()
{
super();
}
public override getHandledRoutes(): HandledRoute[]
{
return [new HandledRoute("aki-health", false)];

View File

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

View File

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

View File

@ -9,27 +9,18 @@ export class DataStaticRouter extends StaticRouter
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
{
super([
new RouteAction(
"/client/settings",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/settings", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getSettings(url, info, sessionID);
},
),
new RouteAction(
"/client/globals",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/globals", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getGlobals(url, info, sessionID);
},
),
new RouteAction(
"/client/items",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/items", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getTemplateItems(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/handbook/templates",
(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);
},
),
new RouteAction(
"/client/customization",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/customization", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getTemplateSuits(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/account/customization",
(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);
},
),
new RouteAction(
"/client/hideout/areas",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/hideout/areas", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getHideoutAreas(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/hideout/production/scavcase/recipes",
(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);
},
),
new RouteAction(
"/client/languages",
new RouteAction("/client/languages", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/hideout/qte/list",
(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);
},
),
new RouteAction(
"/client/mail/msg/send",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/mail/msg/send", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.sendMessage(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/mail/dialog/clear",
(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);
},
),
new RouteAction(
"/client/friend/list",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/friend/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.getFriendList(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/friend/request/list/outbox",
(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);
},
),
new RouteAction(
"/client/friend/delete",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/friend/delete", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.deleteFriend(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/friend/ignore/set",
(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)
{
super([
new RouteAction(
"/client/game/config",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/game/config", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.getGameConfig(url, info, sessionID);
},
),
new RouteAction(
"/client/server/list",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/server/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.getServer(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/match/group/current",
(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);
},
),
new RouteAction(
"/client/game/start",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/game/start", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.gameStart(url, info, sessionID);
},
),
new RouteAction(
"/client/game/logout",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/game/logout", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.gameLogout(url, info, sessionID);
},
),
new RouteAction(
"/client/checkVersion",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/checkVersion", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.validateGameVersion(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/game/keepalive",
(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)
{
super([
new RouteAction(
"/player/health/sync",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/player/health/sync", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.healthCallbacks.syncHealth(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/hideout/workout",
(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)
{
super([
new RouteAction(
"/raid/profile/save",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/raid/profile/save", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.inraidCallbacks.saveProgress(url, info, sessionID);
},
),
}),
new RouteAction(
"/singleplayer/settings/raid/endstate",
(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)
{
super([
new RouteAction(
"/launcher/ping",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/launcher/ping", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.launcherCallbacks.ping(url, info, sessionID);
},
),
}),
new RouteAction(
"/launcher/server/connect",
(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);
},
),
new RouteAction(
"/launcher/profile/get",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/launcher/profile/get", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.launcherCallbacks.get(url, info, sessionID);
},
),
}),
new RouteAction(
"/launcher/profile/change/username",
(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)
{
super([
new RouteAction(
"/client/locations",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/locations", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.locationCallbacks.getLocationData(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/location/getAirdropLoot",
(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)
{
super([
new RouteAction(
"/raid/profile/list",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/raid/profile/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.getProfile(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/match/available",
(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);
},
),
new RouteAction(
"/client/match/join",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/match/join", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
},
),
new RouteAction(
"/client/match/exit",
(url: string, info: any, sessionID: string, output: string): any =>
}),
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/group/create",
(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);
},
),
new RouteAction(
"/client/putMetrics",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/putMetrics", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.putMetrics(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/getMetricsConfig",
(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);
},
),
new RouteAction(
"/launcher/profiles",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/launcher/profiles", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID);
},
),
}),
]);
}
}

View File

@ -9,13 +9,10 @@ export class QuestStaticRouter extends StaticRouter
constructor(@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks)
{
super([
new RouteAction(
"/client/quest/list",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/quest/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.questCallbacks.listQuests(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/repeatalbeQuests/activityPeriods",
(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);
},
),
new RouteAction(
"/client/ragfair/find",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/ragfair/find", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.search(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/ragfair/itemMarketPrice",
(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);
},
),
new RouteAction(
"/client/items/prices",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/items/prices", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.getFleaPrices(url, info, sessionID);
},
),
}),
]);
}
}

View File

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

View File

@ -74,7 +74,7 @@ export class HttpServer
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void
{
// 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);
// 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 { 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
// debug = 1 are as well. This should be fixed.
// 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;
if (req.headers["debug"] === "1")
if (req.headers.debug === "1")
{
this.logger.debug(value.toString(), true);
}
@ -107,7 +107,7 @@ export class AkiHttpListener implements IHttpListener
let handled = false;
// 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);
}

View File

@ -27,17 +27,17 @@ export class BotGenerationCacheService
*/
public storeBots(key: string, botsToStore: IBotBase[]): void
{
botsToStore.forEach((e) =>
for (const bot of botsToStore)
{
if (this.storedBots.has(key))
{
this.storedBots.get(key).unshift(e);
this.storedBots.get(key).unshift(bot);
}
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)
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.isGrenade(template._props)
);
// Get pocket loot
const pocketLootItems = pocketLootTemplates.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)
@ -215,7 +215,7 @@ export class BotLootCacheService
// Get vest loot items
const vestLootItems = vestLootTemplates.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)

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 randomResponseId = locationName?.toLowerCase() === "laboratory"
? this.randomUtil.getArrayValue(dialogueTemplates["insuranceFailedLabs"])
: this.randomUtil.getArrayValue(dialogueTemplates["insuranceFailed"]);
? this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailedLabs)
: this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailed);
this.mailSendService.sendLocalisedNpcMessageToPlayer(
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'`,
);
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 { I18n } from "i18n";
import { inject, injectable } from "tsyringe";
import { ILocaleConfig } from "@spt-aki/models/spt/config/ILocaleConfig";
@ -57,7 +57,7 @@ export class LocalisationService
*/
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
{
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)
);
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);
// if BackendCounter's quest is neither in activeQuests nor Quests it's stale
if (!existsInActiveRepeatableQuests && !existsInQuests)
if (!(existsInActiveRepeatableQuests || existsInQuests))
{
counterKeysToRemove.push(key);
}
@ -435,14 +435,14 @@ export class ProfileFixerService
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[]
{
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
activeQuests = activeQuests.concat(x.activeQuests);
activeQuests = activeQuests.concat(repeatableQuest.activeQuests);
}
}
});
return activeQuests;
}
@ -462,9 +462,9 @@ export class ProfileFixerService
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");
}
}
@ -1006,7 +1006,7 @@ export class ProfileFixerService
*/
public addMissingHideoutAreasToProfile(fullProfile: IAkiProfile): void
{
const pmcProfile = fullProfile.characters["pmc"];
const pmcProfile = fullProfile.characters.pmc;
// No profile, probably new account being created
if (!pmcProfile?.Hideout)
{
@ -1059,7 +1059,7 @@ export class ProfileFixerService
public fixIncorrectAidValue(fullProfile: IAkiProfile): void
{
// 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.aid = this.hashUtil.generateAccountId();
@ -1145,11 +1145,11 @@ export class ProfileFixerService
*/
protected migrateImprovements(pmcProfile: IPmcData): void
{
if (pmcProfile.Hideout["Improvements"])
if (pmcProfile.Hideout.Improvements)
{
// Correct name is `Improvement`
pmcProfile.Hideout.Improvement = this.jsonUtil.clone(pmcProfile.Hideout["Improvements"]);
delete pmcProfile.Hideout["Improvements"];
pmcProfile.Hideout.Improvement = this.jsonUtil.clone(pmcProfile.Hideout.Improvements);
delete pmcProfile.Hideout.Improvements;
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
{
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)
{
requirementPriceMult = Math.pow(requirementPriceMult, 1.08);
requirementPriceMult = requirementPriceMult ** 1.08;
}
else
{
itemPriceMult = Math.pow(itemPriceMult, 1.08);
itemPriceMult = itemPriceMult ** 1.08;
}
itemPriceMult = Math.pow(4, itemPriceMult);
requirementPriceMult = Math.pow(4, requirementPriceMult);
itemPriceMult = 4 ** itemPriceMult;
requirementPriceMult = 4 ** requirementPriceMult;
const hideoutFleaTaxDiscountBonus = pmcData.Bonuses.find((b) => b.type === "RagfairCommission");
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)
{
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)
- Math.floor(
itemTemplate._props.RepairCost

View File

@ -415,10 +415,10 @@ export class SeasonalEventService
*/
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)
{
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
{
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");

View File

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

View File

@ -1,8 +1,8 @@
import { inject, injectable } from "tsyringe";
import { Queue } from "@spt-aki/utils/collections/queue/Queue";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
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/brace-style */

View File

@ -51,7 +51,10 @@ export class RagfairOfferHolder
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
@ -76,7 +79,10 @@ export class RagfairOfferHolder
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

View File

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

View File

@ -1,13 +1,13 @@
import "reflect-metadata";
import { inject, injectable } from "tsyringe";
import fs from "node:fs";
import crypto from "node:crypto";
import { promisify } from "node:util";
import fs from "node:fs";
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 lockfile from "proper-lockfile";
import { IAsyncQueue } from "@spt-aki/models/spt/utils/IAsyncQueue";
@injectable()
export class VFS

View File

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

View File

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

View File

@ -1,17 +1,14 @@
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 { Container } from "@spt-aki/di/Container";
import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
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";
export default <Environment>{

View File

@ -1,9 +1,10 @@
import "reflect-metadata";
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 { 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; };
@ -79,7 +80,6 @@ export class ProfileInsuranceFactory
this.profileInsuranceFixture = this.profileInsuranceFixture.map((insurance) =>
{
insurance.items = insurance.items.filter((item) => itemHelper.isAttachmentAttached(item));
return insurance;
});

View File

@ -1,16 +1,16 @@
/* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata";
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 { 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 { Item } from "@spt-aki/models/eft/common/tables/IItem";
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", () =>
{
@ -1382,13 +1382,13 @@ describe("InsuranceController", () =>
describe("insure", () =>
{
let pmcData: any,
body: any,
sessionId: string,
insuranceController: any,
mockGetPremium: any,
mockPayMoney: any,
mockGetOutput: any;
let pmcData: any;
let body: any;
let sessionId: string;
let insuranceController: any;
let mockGetPremium: any;
let mockPayMoney: any;
let mockGetOutput: any;
beforeEach(() =>
{

View File

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

View File

@ -1,6 +1,6 @@
import "reflect-metadata";
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 { MinMax } from "@spt-aki/models/common/MinMax";

View File

@ -1,6 +1,6 @@
import "reflect-metadata";
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";

View File

@ -1,6 +1,6 @@
import "reflect-metadata";
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 { Money } from "@spt-aki/models/enums/Money";

View File

@ -1,6 +1,6 @@
import "reflect-metadata";
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 { DatabaseServer } from "@spt-aki/servers/DatabaseServer";

View File

@ -1,12 +1,12 @@
import "reflect-metadata";
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 { 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 { HashUtil } from "@spt-aki/utils/HashUtil";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
describe("ItemHelper", () =>
{
@ -253,7 +253,7 @@ describe("ItemHelper", () =>
const fixedItem = itemHelper.fixItemStackCount(initialItem);
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", () =>
@ -262,7 +262,7 @@ describe("ItemHelper", () =>
const fixedItem = itemHelper.fixItemStackCount(initialItem);
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", () =>
@ -271,7 +271,7 @@ describe("ItemHelper", () =>
const fixedItem = itemHelper.fixItemStackCount(initialItem);
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);
});
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 item: Item = {

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata";
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";
describe("ItemBaseClassService", () =>

View File

@ -1,16 +1,16 @@
/* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata";
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 { 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 { 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", () =>
{

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import "reflect-metadata";
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 { PlayerService } from "@spt-aki/services/PlayerService";

View File

@ -1,6 +1,6 @@
import "reflect-metadata";
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";

View File

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