From 32b47bdc186c88f53a7c136453b35c6eba84bcc9 Mon Sep 17 00:00:00 2001 From: Refringe Date: Mon, 13 Nov 2023 12:31:52 -0500 Subject: [PATCH] Formatting Change - When a statement can be moved into a single line and still be under the maximum line length, it is. --- project/dprint.json | 2 +- project/gulpfile.mjs | 15 +- project/src/ErrorHandler.ts | 5 +- .../src/callbacks/CustomizationCallbacks.ts | 5 +- project/src/callbacks/DialogueCallbacks.ts | 7 +- project/src/callbacks/GameCallbacks.ts | 12 +- project/src/callbacks/HandbookCallbacks.ts | 4 +- project/src/callbacks/HealthCallbacks.ts | 6 +- project/src/callbacks/HttpCallbacks.ts | 4 +- project/src/callbacks/InventoryCallbacks.ts | 4 +- project/src/callbacks/NoteCallbacks.ts | 4 +- project/src/callbacks/NotifierCallbacks.ts | 10 +- project/src/callbacks/PresetCallbacks.ts | 4 +- project/src/callbacks/ProfileCallbacks.ts | 41 +- project/src/callbacks/RepairCallbacks.ts | 4 +- project/src/callbacks/TradeCallbacks.ts | 4 +- project/src/callbacks/WishlistCallbacks.ts | 4 +- project/src/controllers/BotController.ts | 15 +- .../src/controllers/ClientLogController.ts | 4 +- project/src/controllers/DialogueController.ts | 6 +- project/src/controllers/GameController.ts | 23 +- project/src/controllers/HideoutController.ts | 51 +- .../src/controllers/InsuranceController.ts | 5 +- .../src/controllers/InventoryController.ts | 30 +- project/src/controllers/LocationController.ts | 5 +- project/src/controllers/MatchController.ts | 29 +- project/src/controllers/NoteController.ts | 9 +- .../src/controllers/PresetBuildController.ts | 13 +- project/src/controllers/ProfileController.ts | 14 +- project/src/controllers/QuestController.ts | 14 +- project/src/controllers/RagfairController.ts | 29 +- .../controllers/RepeatableQuestController.ts | 18 +- project/src/controllers/WeatherController.ts | 7 +- project/src/controllers/WishlistController.ts | 4 +- project/src/di/Container.ts | 4 +- project/src/di/Router.ts | 10 +- .../generators/BotEquipmentModGenerator.ts | 31 +- project/src/generators/BotGenerator.ts | 22 +- .../src/generators/BotInventoryGenerator.ts | 54 +- project/src/generators/BotLootGenerator.ts | 44 +- project/src/generators/BotWeaponGenerator.ts | 28 +- .../generators/FenceBaseAssortGenerator.ts | 5 +- project/src/generators/LocationGenerator.ts | 71 +- project/src/generators/LootGenerator.ts | 36 +- project/src/generators/PlayerScavGenerator.ts | 10 +- .../src/generators/RagfairAssortGenerator.ts | 5 +- .../src/generators/RagfairOfferGenerator.ts | 47 +- .../generators/RepeatableQuestGenerator.ts | 137 +- .../src/generators/ScavCaseRewardGenerator.ts | 15 +- project/src/generators/WeatherGenerator.ts | 4 +- .../InternalMagazineInventoryMagGen.ts | 4 +- .../implementations/UbglExternalMagGen.ts | 4 +- project/src/helpers/BotDifficultyHelper.ts | 8 +- project/src/helpers/BotGeneratorHelper.ts | 20 +- project/src/helpers/BotHelper.ts | 4 +- .../src/helpers/BotWeaponGeneratorHelper.ts | 15 +- project/src/helpers/DialogueHelper.ts | 19 +- project/src/helpers/DurabilityLimitsHelper.ts | 8 +- project/src/helpers/HandbookHelper.ts | 8 +- project/src/helpers/HealthHelper.ts | 5 +- project/src/helpers/HideoutHelper.ts | 25 +- project/src/helpers/HttpServerHelper.ts | 4 +- project/src/helpers/InRaidHelper.ts | 5 +- project/src/helpers/InventoryHelper.ts | 47 +- project/src/helpers/ItemHelper.ts | 35 +- project/src/helpers/NotifierHelper.ts | 9 +- project/src/helpers/PaymentHelper.ts | 4 +- project/src/helpers/PresetHelper.ts | 14 +- project/src/helpers/ProfileHelper.ts | 10 +- project/src/helpers/QuestHelper.ts | 31 +- project/src/helpers/RagfairHelper.ts | 4 +- project/src/helpers/RagfairSellHelper.ts | 9 +- project/src/helpers/RagfairSortHelper.ts | 6 +- project/src/helpers/RepairHelper.ts | 13 +- project/src/helpers/SecureContainerHelper.ts | 4 +- project/src/helpers/TradeHelper.ts | 12 +- project/src/helpers/TraderAssortHelper.ts | 6 +- project/src/helpers/TraderHelper.ts | 12 +- project/src/helpers/WeightedRandomHelper.ts | 5 +- project/src/models/external/HttpFramework.ts | 6 +- .../src/models/spt/server/IDatabaseTables.ts | 6 +- project/src/routers/EventOutputHolder.ts | 17 +- project/src/routers/HttpRouter.ts | 4 +- .../src/routers/dynamic/BotDynamicRouter.ts | 66 +- .../routers/dynamic/BundleDynamicRouter.ts | 21 +- .../dynamic/CustomizationDynamicRouter.ts | 24 +- .../src/routers/dynamic/DataDynamicRouter.ts | 43 +- .../src/routers/dynamic/HttpDynamicRouter.ts | 43 +- .../routers/dynamic/InraidDynamicRouter.ts | 24 +- .../routers/dynamic/LocationDynamicRouter.ts | 24 +- .../routers/dynamic/NotifierDynamicRouter.ts | 57 +- .../routers/dynamic/TraderDynamicRouter.ts | 38 +- .../CustomizationItemEventRouter.ts | 5 +- .../item_events/HideoutItemEventRouter.ts | 4 +- .../item_events/InsuranceItemEventRouter.ts | 4 +- .../item_events/PresetBuildItemEventRouter.ts | 4 +- .../item_events/RagfairItemEventRouter.ts | 4 +- .../item_events/RepairItemEventRouter.ts | 9 +- .../item_events/TradeItemEventRouter.ts | 4 +- .../item_events/WishlistItemEventRouter.ts | 9 +- .../routers/save_load/HealthSaveLoadRouter.ts | 9 +- .../routers/save_load/InraidSaveLoadRouter.ts | 9 +- .../save_load/InsuranceSaveLoadRouter.ts | 4 +- .../save_load/ProfileSaveLoadRouter.ts | 9 +- .../routers/serializers/ImageSerializer.ts | 4 +- .../routers/serializers/NotifySerializer.ts | 6 +- project/src/routers/static/BotStaticRouter.ts | 24 +- .../src/routers/static/BundleStaticRouter.ts | 21 +- .../routers/static/ClientLogStaticRouter.ts | 21 +- .../static/CustomizationStaticRouter.ts | 24 +- .../src/routers/static/DataStaticRouter.ts | 160 +- .../src/routers/static/DialogStaticRouter.ts | 295 ++- .../src/routers/static/GameStaticRouter.ts | 135 +- .../src/routers/static/HealthStaticRouter.ts | 35 +- .../src/routers/static/InraidStaticRouter.ts | 77 +- .../routers/static/InsuranceStaticRouter.ts | 24 +- .../routers/static/ItemEventStaticRouter.ts | 24 +- .../routers/static/LauncherStaticRouter.ts | 186 +- .../routers/static/LocationStaticRouter.ts | 35 +- .../src/routers/static/MatchStaticRouter.ts | 320 ++- .../routers/static/NotifierStaticRouter.ts | 38 +- .../src/routers/static/PresetStaticRouter.ts | 24 +- .../src/routers/static/ProfileStaticRouter.ts | 175 +- .../src/routers/static/QuestStaticRouter.ts | 35 +- .../src/routers/static/RagfairStaticRouter.ts | 88 +- .../src/routers/static/TraderStaticRouter.ts | 24 +- .../src/routers/static/WeatherStaticRouter.ts | 21 +- project/src/servers/ConfigServer.ts | 4 +- project/src/servers/SaveServer.ts | 5 +- project/src/servers/WebSocketServer.ts | 9 +- project/src/servers/http/AkiHttpListener.ts | 20 +- .../src/services/BotEquipmentFilterService.ts | 4 +- project/src/services/BotLootCacheService.ts | 13 +- project/src/services/FenceService.ts | 43 +- project/src/services/InsuranceService.ts | 16 +- project/src/services/LocalisationService.ts | 14 +- project/src/services/MailSendService.ts | 5 +- project/src/services/MatchLocationService.ts | 20 +- project/src/services/ProfileFixerService.ts | 81 +- .../src/services/ProfileSnapshotService.ts | 4 +- .../src/services/RagfairCategoriesService.ts | 8 +- project/src/services/RagfairPriceService.ts | 18 +- project/src/services/RepairService.ts | 35 +- project/src/services/SeasonalEventService.ts | 5 +- project/src/services/mod/CustomItemService.ts | 12 +- .../mod/dynamicRouter/DynamicRouterMod.ts | 5 +- .../dynamicRouter/DynamicRouterModService.ts | 6 +- project/src/services/mod/onLoad/OnLoadMod.ts | 5 +- .../services/mod/onLoad/OnLoadModService.ts | 6 +- .../mod/onUpdate/OnUpdateModService.ts | 6 +- .../mod/staticRouter/StaticRouterMod.ts | 5 +- .../staticRouter/StaticRouterModService.ts | 6 +- project/src/utils/DatabaseImporter.ts | 4 +- project/src/utils/HashUtil.ts | 4 +- project/src/utils/HttpFileUtil.ts | 4 +- project/src/utils/HttpResponseUtil.ts | 22 +- project/src/utils/ImporterUtil.ts | 42 +- project/src/utils/JsonUtil.ts | 12 +- project/src/utils/ObjectId.ts | 4 +- project/src/utils/RandomUtil.ts | 21 +- project/src/utils/VFS.ts | 14 +- project/src/utils/Watermark.ts | 4 +- .../utils/logging/AbstractWinstonLogger.ts | 62 +- .../src/utils/logging/WinstonMainLogger.ts | 4 +- .../src/utils/logging/WinstonRequestLogger.ts | 4 +- .../__fixture__/profileInsurance.fixture.ts | 2151 ++++++----------- .../controllers/InsuranceController.test.ts | 250 +- project/tests/generators/BotGenerator.test.ts | 60 +- .../generators/BotLevelGenerator.test.ts | 15 +- project/tests/helpers/InRaidHelper.test.ts | 51 +- project/tests/helpers/ItemHelper.test.ts | 149 +- project/tests/services/PaymentService.test.ts | 46 +- project/vitest.config.ts | 16 +- 173 files changed, 2320 insertions(+), 4501 deletions(-) diff --git a/project/dprint.json b/project/dprint.json index 60c34ce2..d264a421 100644 --- a/project/dprint.json +++ b/project/dprint.json @@ -15,7 +15,7 @@ "trailingCommas": "onlyMultiLine", "operatorPosition": "nextLine", "preferHanging": false, - "preferSingleLine": false, + "preferSingleLine": true, "arrowFunction.useParentheses": "force", "binaryExpression.linePerExpression": false, "memberExpression.linePerExpression": false, diff --git a/project/gulpfile.mjs b/project/gulpfile.mjs index 613e916c..c856b25f 100644 --- a/project/gulpfile.mjs +++ b/project/gulpfile.mjs @@ -74,15 +74,12 @@ const updateBuildProperties = async () => const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0]; - vi.setStringValues( - {lang: 1033, codepage: 1200}, - { - ProductName: manifest.author, - FileDescription: manifest.description, - CompanyName: manifest.name, - LegalCopyright: manifest.license, - }, - ); + vi.setStringValues({lang: 1033, codepage: 1200}, { + ProductName: manifest.author, + FileDescription: manifest.description, + CompanyName: manifest.name, + LegalCopyright: manifest.license, + }); vi.removeStringValue({lang: 1033, codepage: 1200}, "OriginalFilename"); vi.removeStringValue({lang: 1033, codepage: 1200}, "InternalName"); vi.setFileVersion(...manifest.version.split(".").map(Number)); diff --git a/project/src/ErrorHandler.ts b/project/src/ErrorHandler.ts index 81c1576d..afb88de9 100644 --- a/project/src/ErrorHandler.ts +++ b/project/src/ErrorHandler.ts @@ -12,10 +12,7 @@ export class ErrorHandler constructor() { this.logger = new WinstonMainLogger(new AsyncQueue()); - this.readLine = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }); + this.readLine = readline.createInterface({input: process.stdin, output: process.stdout}); } public handleCriticalError(err: Error): void diff --git a/project/src/callbacks/CustomizationCallbacks.ts b/project/src/callbacks/CustomizationCallbacks.ts index 35c85210..9d4cec90 100644 --- a/project/src/callbacks/CustomizationCallbacks.ts +++ b/project/src/callbacks/CustomizationCallbacks.ts @@ -28,10 +28,7 @@ export class CustomizationCallbacks */ public getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { - const result: IGetSuitsResponse = { - _id: `pmc${sessionID}`, - suites: this.saveServer.getProfile(sessionID).suits, - }; + const result: IGetSuitsResponse = {_id: `pmc${sessionID}`, suites: this.saveServer.getProfile(sessionID).suits}; return this.httpResponse.getBody(result); } diff --git a/project/src/callbacks/DialogueCallbacks.ts b/project/src/callbacks/DialogueCallbacks.ts index 881a1fb3..a1298527 100644 --- a/project/src/callbacks/DialogueCallbacks.ts +++ b/project/src/callbacks/DialogueCallbacks.ts @@ -75,12 +75,7 @@ export class DialogueCallbacks implements OnUpdate VersionId: "bgkidft87ddd", // TODO: Is this... correct? Ip: "", Port: 0, - Chats: [ - { - _id: "0", - Members: 0, - }, - ], + Chats: [{_id: "0", Members: 0}], }; return this.httpResponse.getBody([chatServer]); diff --git a/project/src/callbacks/GameCallbacks.ts b/project/src/callbacks/GameCallbacks.ts index 780c5aa7..0b712181 100644 --- a/project/src/callbacks/GameCallbacks.ts +++ b/project/src/callbacks/GameCallbacks.ts @@ -58,9 +58,7 @@ export 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}); } /** @@ -75,9 +73,7 @@ export class GameCallbacks implements OnLoad ): IGetBodyResponseData { this.saveServer.save(); - return this.httpResponse.getBody({ - status: "ok", - }); + return this.httpResponse.getBody({status: "ok"}); } /** @@ -144,9 +140,7 @@ export class GameCallbacks implements OnLoad */ public getVersion(url: string, info: IEmptyRequestData, sessionID: string): string { - return this.httpResponse.noBody({ - Version: this.watermark.getInGameVersionLabel(), - }); + return this.httpResponse.noBody({Version: this.watermark.getInGameVersionLabel()}); } public reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData diff --git a/project/src/callbacks/HandbookCallbacks.ts b/project/src/callbacks/HandbookCallbacks.ts index 7f60703c..588fb04a 100644 --- a/project/src/callbacks/HandbookCallbacks.ts +++ b/project/src/callbacks/HandbookCallbacks.ts @@ -6,9 +6,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad"; @injectable() export class HandbookCallbacks implements OnLoad { - constructor( - @inject("HandbookController") protected handbookController: HandbookController, - ) + constructor(@inject("HandbookController") protected handbookController: HandbookController) {} public async onLoad(): Promise diff --git a/project/src/callbacks/HealthCallbacks.ts b/project/src/callbacks/HealthCallbacks.ts index 9fb41cb6..1cbaaf49 100644 --- a/project/src/callbacks/HealthCallbacks.ts +++ b/project/src/callbacks/HealthCallbacks.ts @@ -44,11 +44,7 @@ export class HealthCallbacks */ public handleWorkoutEffects(url: string, info: IWorkoutData, sessionID: string): IGetBodyResponseData { - this.healthController.applyWorkoutChanges( - this.profileHelper.getPmcProfile(sessionID), - info, - sessionID, - ); + this.healthController.applyWorkoutChanges(this.profileHelper.getPmcProfile(sessionID), info, sessionID); return this.httpResponse.emptyResponse(); } diff --git a/project/src/callbacks/HttpCallbacks.ts b/project/src/callbacks/HttpCallbacks.ts index 0012f67c..ef34a6ea 100644 --- a/project/src/callbacks/HttpCallbacks.ts +++ b/project/src/callbacks/HttpCallbacks.ts @@ -6,9 +6,7 @@ import { HttpServer } from "@spt-aki/servers/HttpServer"; @injectable() export class HttpCallbacks implements OnLoad { - constructor( - @inject("HttpServer") protected httpServer: HttpServer, - ) + constructor(@inject("HttpServer") protected httpServer: HttpServer) {} public async onLoad(): Promise diff --git a/project/src/callbacks/InventoryCallbacks.ts b/project/src/callbacks/InventoryCallbacks.ts index 876a20a1..262001ea 100644 --- a/project/src/callbacks/InventoryCallbacks.ts +++ b/project/src/callbacks/InventoryCallbacks.ts @@ -24,9 +24,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve @injectable() export class InventoryCallbacks { - constructor( - @inject("InventoryController") protected inventoryController: InventoryController, - ) + constructor(@inject("InventoryController") protected inventoryController: InventoryController) {} /** Handle Move event */ diff --git a/project/src/callbacks/NoteCallbacks.ts b/project/src/callbacks/NoteCallbacks.ts index 0e3499ce..95e450ec 100644 --- a/project/src/callbacks/NoteCallbacks.ts +++ b/project/src/callbacks/NoteCallbacks.ts @@ -8,9 +8,7 @@ import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData"; @injectable() export class NoteCallbacks { - constructor( - @inject("NoteController") protected noteController: NoteController, - ) + constructor(@inject("NoteController") protected noteController: NoteController) {} /** Handle AddNote event */ diff --git a/project/src/callbacks/NotifierCallbacks.ts b/project/src/callbacks/NotifierCallbacks.ts index 244846c8..61df5e1a 100644 --- a/project/src/callbacks/NotifierCallbacks.ts +++ b/project/src/callbacks/NotifierCallbacks.ts @@ -36,9 +36,9 @@ export class NotifierCallbacks * Take our array of JSON message objects and cast them to JSON strings, so that they can then * be sent to client as NEWLINE separated strings... yup. */ - this.notifierController.notifyAsync(tmpSessionID) - .then((messages: any) => messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n")) - .then((text) => this.httpServerHelper.sendTextJson(resp, text)); + this.notifierController.notifyAsync(tmpSessionID).then((messages: any) => + messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n") + ).then((text) => this.httpServerHelper.sendTextJson(resp, text)); } /** Handle push/notifier/get */ @@ -68,9 +68,7 @@ export class NotifierCallbacks sessionID: string, ): IGetBodyResponseData { - return this.httpResponse.getBody({ - status: "ok", - }); + return this.httpResponse.getBody({status: "ok"}); } public notify(url: string, info: any, sessionID: string): string diff --git a/project/src/callbacks/PresetCallbacks.ts b/project/src/callbacks/PresetCallbacks.ts index 3ded09d4..23b11de8 100644 --- a/project/src/callbacks/PresetCallbacks.ts +++ b/project/src/callbacks/PresetCallbacks.ts @@ -6,9 +6,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad"; @injectable() export class PresetCallbacks implements OnLoad { - constructor( - @inject("PresetController") protected presetController: PresetController, - ) + constructor(@inject("PresetController") protected presetController: PresetController) {} public async onLoad(): Promise diff --git a/project/src/callbacks/ProfileCallbacks.ts b/project/src/callbacks/ProfileCallbacks.ts index 591f4e35..7ba9eac8 100644 --- a/project/src/callbacks/ProfileCallbacks.ts +++ b/project/src/callbacks/ProfileCallbacks.ts @@ -91,10 +91,7 @@ export class ProfileCallbacks return this.httpResponse.getBody(null, 1, "The nickname is too short"); } - return this.httpResponse.getBody({ - status: 0, - nicknamechangedate: this.timeUtil.getTimestamp(), - }); + return this.httpResponse.getBody({status: 0, nicknamechangedate: this.timeUtil.getTimestamp()}); } /** @@ -141,29 +138,19 @@ export class ProfileCallbacks { const response: GetProfileStatusResponseData = { maxPveCountExceeded: false, - profiles: [ - { - profileid: `scav${sessionID}`, - profileToken: null, - status: "Free", - sid: "", - ip: "", - port: 0, - version: "live", - location: "bigmap", - raidMode: "Online", - mode: "deathmatch", - shortId: "xxx1x1", - }, - { - profileid: `pmc${sessionID}`, - profileToken: null, - status: "Free", - sid: "", - ip: "", - port: 0, - }, - ], + profiles: [{ + profileid: `scav${sessionID}`, + profileToken: null, + status: "Free", + sid: "", + ip: "", + port: 0, + version: "live", + location: "bigmap", + raidMode: "Online", + mode: "deathmatch", + shortId: "xxx1x1", + }, {profileid: `pmc${sessionID}`, profileToken: null, status: "Free", sid: "", ip: "", port: 0}], }; return this.httpResponse.getBody(response); diff --git a/project/src/callbacks/RepairCallbacks.ts b/project/src/callbacks/RepairCallbacks.ts index 034f1d2f..d5514850 100644 --- a/project/src/callbacks/RepairCallbacks.ts +++ b/project/src/callbacks/RepairCallbacks.ts @@ -9,9 +9,7 @@ import { ITraderRepairActionDataRequest } from "@spt-aki/models/eft/repair/ITrad @injectable() export class RepairCallbacks { - constructor( - @inject("RepairController") protected repairController: RepairController, - ) + constructor(@inject("RepairController") protected repairController: RepairController) {} /** diff --git a/project/src/callbacks/TradeCallbacks.ts b/project/src/callbacks/TradeCallbacks.ts index 9b9b8ce8..3fad61eb 100644 --- a/project/src/callbacks/TradeCallbacks.ts +++ b/project/src/callbacks/TradeCallbacks.ts @@ -10,9 +10,7 @@ import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISel @injectable() export class TradeCallbacks { - constructor( - @inject("TradeController") protected tradeController: TradeController, - ) + constructor(@inject("TradeController") protected tradeController: TradeController) {} /** diff --git a/project/src/callbacks/WishlistCallbacks.ts b/project/src/callbacks/WishlistCallbacks.ts index c4b659d7..550e59d5 100644 --- a/project/src/callbacks/WishlistCallbacks.ts +++ b/project/src/callbacks/WishlistCallbacks.ts @@ -8,9 +8,7 @@ import { IWishlistActionData } from "@spt-aki/models/eft/wishlist/IWishlistActio @injectable() export class WishlistCallbacks { - constructor( - @inject("WishlistController") protected wishlistController: WishlistController, - ) + constructor(@inject("WishlistController") protected wishlistController: WishlistController) {} /** Handle AddToWishList event */ diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index 98753c00..5de94655 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -57,11 +57,7 @@ export class BotController */ public getBotPresetGenerationLimit(type: string): number { - const value = this.botConfig.presetBatch[ - (type === "assaultGroup") - ? "assault" - : type - ]; + const value = this.botConfig.presetBatch[(type === "assaultGroup") ? "assault" : type]; if (!value) { @@ -275,9 +271,7 @@ export class BotController this.logger.warning(this.localisationService.getText("bot-missing_saved_match_info")); } - const mapName = raidConfig - ? raidConfig.location - : defaultMapCapId; + const mapName = raidConfig ? raidConfig.location : defaultMapCapId; let botCap = this.botConfig.maxBotCap[mapName.toLowerCase()]; if (!botCap) @@ -296,9 +290,6 @@ export class BotController public getAiBotBrainTypes(): any { - return { - pmc: this.pmcConfig.pmcType, - assault: this.botConfig.assaultBrainType, - }; + return {pmc: this.pmcConfig.pmcType, assault: this.botConfig.assaultBrainType}; } } diff --git a/project/src/controllers/ClientLogController.ts b/project/src/controllers/ClientLogController.ts index 0db5d170..988f6442 100644 --- a/project/src/controllers/ClientLogController.ts +++ b/project/src/controllers/ClientLogController.ts @@ -8,9 +8,7 @@ import { inject, injectable } from "tsyringe"; @injectable() export class ClientLogController { - constructor( - @inject("WinstonLogger") protected logger: ILogger, - ) + constructor(@inject("WinstonLogger") protected logger: ILogger) {} /** diff --git a/project/src/controllers/DialogueController.ts b/project/src/controllers/DialogueController.ts index 76bc8c09..6e085fe5 100644 --- a/project/src/controllers/DialogueController.ts +++ b/project/src/controllers/DialogueController.ts @@ -60,11 +60,7 @@ export class DialogueController public getFriendList(sessionID: string): IGetFriendListDataResponse { // Force a fake friend called SPT into friend list - return { - Friends: [this.getSptFriendData()], - Ignore: [], - InIgnoreList: [], - }; + return {Friends: [this.getSptFriendData()], Ignore: [], InIgnoreList: []}; } /** diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index ddf296ff..22146dcf 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -435,10 +435,7 @@ export class GameController */ public getServer(sessionId: string): IServerDetails[] { - return [{ - ip: this.httpConfig.ip, - port: this.httpConfig.port, - }]; + return [{ip: this.httpConfig.ip, port: this.httpConfig.port}]; } /** @@ -446,9 +443,7 @@ export class GameController */ public getCurrentGroup(sessionId: string): ICurrentGroupResponse { - return { - squad: [], - }; + return {squad: []}; } /** @@ -456,10 +451,7 @@ export class GameController */ public getValidGameVersion(sessionId: string): ICheckVersionResponse { - return { - isvalid: true, - latestVersion: this.coreConfig.compatibleTarkovVersion, - }; + return {isvalid: true, latestVersion: this.coreConfig.compatibleTarkovVersion}; } /** @@ -467,10 +459,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}; } /** @@ -777,9 +766,7 @@ export class GameController const modDetails = activeMods[modKey]; if ( fullProfile.aki.mods.some((x) => - x.author === modDetails.author - && x.name === modDetails.name - && x.version === modDetails.version + x.author === modDetails.author && x.name === modDetails.name && x.version === modDetails.version ) ) { diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 449b1865..d31021bf 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -93,10 +93,7 @@ export class HideoutController const items = request.items.map((reqItem) => { const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id); - return { - inventoryItem: item, - requestedItem: reqItem, - }; + return {inventoryItem: item, requestedItem: reqItem}; }); // If it's not money, its construction / barter items @@ -375,11 +372,7 @@ export class HideoutController const itemsToAdd = Object.entries(addItemToHideoutRequest.items).map((kvp) => { const item = pmcData.Inventory.items.find((invItem) => invItem._id === kvp[1].id); - return { - inventoryItem: item, - requestedItem: kvp[1], - slot: kvp[0], - }; + return {inventoryItem: item, requestedItem: kvp[1], slot: kvp[0]}; }); const hideoutArea = pmcData.Hideout.Areas.find((area) => area.type === addItemToHideoutRequest.areaType); @@ -631,10 +624,7 @@ export class HideoutController return this.httpResponse.appendErrorToOutput(output); } - if ( - inventoryItem.upd?.StackObjectsCount - && inventoryItem.upd.StackObjectsCount > requestedItem.count - ) + if (inventoryItem.upd?.StackObjectsCount && inventoryItem.upd.StackObjectsCount > requestedItem.count) { inventoryItem.upd.StackObjectsCount -= requestedItem.count; } @@ -693,9 +683,7 @@ export class HideoutController */ protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void { - pmcData.Hideout.Production[`ScavCase${recipeId}`] = { - Products: rewards, - }; + pmcData.Hideout.Production[`ScavCase${recipeId}`] = {Products: rewards}; } /** @@ -799,13 +787,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; @@ -889,9 +871,7 @@ export class HideoutController // Handle the isEncoded flag from recipe if (recipe.isEncoded) { - const upd: Upd = { - RecodableComponent: {IsEncoded: true}, - }; + const upd: Upd = {RecodableComponent: {IsEncoded: true}}; return this.inventoryHelper.addItem(pmcData, newReq, output, sessionID, callback, true, upd); } @@ -957,18 +937,13 @@ export class HideoutController { id = this.presetHelper.getDefaultPreset(id)._id; } - const numOfItems = !x.upd?.StackObjectsCount - ? 1 - : x.upd.StackObjectsCount; + const numOfItems = !x.upd?.StackObjectsCount ? 1 : x.upd.StackObjectsCount; return {item_id: id, count: numOfItems}; }, ); - const newReq = { - items: itemsToAdd, - tid: "ragfair", - }; + const newReq = {items: itemsToAdd, tid: "ragfair"}; const callback = () => { @@ -1060,10 +1035,7 @@ export class HideoutController // 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, - }); + pmcData.Stats.Eft.OverallCounters.Items.push({Key: ["ShootingRangePoints"], Value: 0}); } // Find counter by key and update value @@ -1094,10 +1066,7 @@ export class HideoutController const items = request.items.map((reqItem) => { const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id); - return { - inventoryItem: item, - requestedItem: reqItem, - }; + return {inventoryItem: item, requestedItem: reqItem}; }); // If it's not money, its construction / barter items diff --git a/project/src/controllers/InsuranceController.ts b/project/src/controllers/InsuranceController.ts index b2d2720c..5552fd36 100644 --- a/project/src/controllers/InsuranceController.ts +++ b/project/src/controllers/InsuranceController.ts @@ -625,10 +625,7 @@ export class InsuranceController // add items to InsuredItems list once money has been paid for (const key of body.items) { - pmcData.InsuredItems.push({ - tid: body.tid, - itemId: inventoryItemsHash[key]._id, - }); + pmcData.InsuredItems.push({tid: body.tid, itemId: inventoryItemsHash[key]._id}); } this.profileHelper.addSkillPointsToPlayer(pmcData, SkillTypes.CHARISMA, itemsToInsureCount * 0.01); diff --git a/project/src/controllers/InventoryController.ts b/project/src/controllers/InventoryController.ts index e921f893..7885b1e1 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -287,9 +287,7 @@ export class InventoryController if (!sourceItem.upd) { - sourceItem.upd = { - StackObjectsCount: 1, - }; + sourceItem.upd = {StackObjectsCount: 1}; } else if (!sourceItem.upd.StackObjectsCount) { @@ -458,11 +456,7 @@ export class InventoryController public foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse { // Fix for folding weapons while on they're in the Scav inventory - if ( - body.fromOwner - && body.fromOwner.type === "Profile" - && body.fromOwner.id !== pmcData._id - ) + if (body.fromOwner && body.fromOwner.type === "Profile" && body.fromOwner.id !== pmcData._id) { pmcData = this.profileHelper.getScavProfile(sessionID); } @@ -476,10 +470,7 @@ export class InventoryController } } - return { - warnings: [], - profileChanges: {}, - }; + return {warnings: [], profileChanges: {}}; } /** @@ -519,10 +510,7 @@ export class InventoryController ); } - return { - warnings: [], - profileChanges: {}, - }; + return {warnings: [], profileChanges: {}}; } /** @@ -551,10 +539,7 @@ export class InventoryController } } - return { - warnings: [], - profileChanges: {}, - }; + return {warnings: [], profileChanges: {}}; } /** @@ -872,10 +857,7 @@ export class InventoryController const containerDetails = this.itemHelper.getItem(openedItem._tpl); const isSealedWeaponBox = containerDetails[1]._name.includes("event_container_airdrop"); - const newItemRequest: IAddItemRequestData = { - tid: "RandomLootContainer", - items: [], - }; + const newItemRequest: IAddItemRequestData = {tid: "RandomLootContainer", items: []}; let foundInRaid = false; if (isSealedWeaponBox) diff --git a/project/src/controllers/LocationController.ts b/project/src/controllers/LocationController.ts index df0c5671..00fd78f7 100644 --- a/project/src/controllers/LocationController.ts +++ b/project/src/controllers/LocationController.ts @@ -135,10 +135,7 @@ export class LocationController locations[mapBase._Id] = mapBase; } - return { - locations: locations, - paths: locationsFromDb.base.paths, - }; + return {locations: locations, paths: locationsFromDb.base.paths}; } /** diff --git a/project/src/controllers/MatchController.ts b/project/src/controllers/MatchController.ts index 0baefa00..436f7082 100644 --- a/project/src/controllers/MatchController.ts +++ b/project/src/controllers/MatchController.ts @@ -101,10 +101,7 @@ export class MatchController /** Handle match/group/start_game */ public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult { - const output: IJoinMatchResult = { - maxPveCountExceeded: false, - profiles: [], - }; + const output: IJoinMatchResult = {maxPveCountExceeded: false, profiles: []}; // get list of players joining into the match output.profiles.push({ @@ -128,10 +125,7 @@ export class MatchController /** Handle client/match/group/status */ public getGroupStatus(info: IGetGroupStatusRequestData): any { - return { - players: [], - maxPveCountExceeded: false, - }; + return {players: [], maxPveCountExceeded: false}; } /** @@ -226,18 +220,13 @@ export class MatchController const parentId = this.hashUtil.generate(); for (const item of loot) { - mailableLoot.push( - { - _id: item.id, - _tpl: item.tpl, - slotId: "main", - parentId: parentId, - upd: { - StackObjectsCount: item.stackCount, - SpawnedInSession: true, - }, - }, - ); + mailableLoot.push({ + _id: item.id, + _tpl: item.tpl, + slotId: "main", + parentId: parentId, + upd: {StackObjectsCount: item.stackCount, SpawnedInSession: true}, + }); } // Send message from fence giving player reward generated above diff --git a/project/src/controllers/NoteController.ts b/project/src/controllers/NoteController.ts index 4f6fcc16..bc56a5a0 100644 --- a/project/src/controllers/NoteController.ts +++ b/project/src/controllers/NoteController.ts @@ -9,17 +9,12 @@ import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @injectable() export class NoteController { - constructor( - @inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder, - ) + constructor(@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder) {} public addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse { - const newNote: Note = { - Time: body.note.Time, - Text: body.note.Text, - }; + const newNote: Note = {Time: body.note.Time, Text: body.note.Text}; pmcData.Notes.Notes.push(newNote); return this.eventOutputHolder.getOutput(sessionID); diff --git a/project/src/controllers/PresetBuildController.ts b/project/src/controllers/PresetBuildController.ts index 9a42b95f..7e44a0b0 100644 --- a/project/src/controllers/PresetBuildController.ts +++ b/project/src/controllers/PresetBuildController.ts @@ -33,10 +33,7 @@ export class PresetBuildController const profile = this.saveServer.getProfile(sessionID); if (!profile.userbuilds) { - profile.userbuilds = { - equipmentBuilds: [], - weaponBuilds: [], - }; + profile.userbuilds = {equipmentBuilds: [], weaponBuilds: []}; } // Ensure the secure container in the default presets match what the player has equipped @@ -87,13 +84,7 @@ export class PresetBuildController // Create new object ready to save into profile userbuilds.weaponBuilds const newId = this.hashUtil.generate(); // Id is empty, generate it - const newBuild: IWeaponBuild = { - id: newId, - name: body.name, - root: body.root, - items: body.items, - type: "weapon", - }; + const newBuild: IWeaponBuild = {id: newId, name: body.name, root: body.root, items: body.items, type: "weapon"}; const savedWeaponBuilds = this.saveServer.getProfile(sessionId).userbuilds.weaponBuilds; const existingBuild = savedWeaponBuilds.find((x) => x.id === body.id); diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index 521e5f0c..ec391eaf 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -164,10 +164,7 @@ export class ProfileController // Create profile const profileDetails: IAkiProfile = { info: account, - characters: { - pmc: pmcData, - scav: {} as IPmcData, - }, + characters: {pmc: pmcData, scav: {} as IPmcData}, suits: profile.suits, userbuilds: profile.userbuilds, dialogues: profile.dialogues, @@ -351,13 +348,6 @@ export class ProfileController */ public getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[] { - return [{ - _id: this.hashUtil.generate(), - Info: { - Level: 1, - Side: "Bear", - Nickname: info.nickname, - }, - }]; + return [{_id: this.hashUtil.generate(), Info: {Level: 1, Side: "Bear", Nickname: info.nickname}}]; } } diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index bf57a1d8..ce96a841 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -448,11 +448,9 @@ export class QuestController const change = {}; change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id]; const responseData: IPmcDataRepeatableQuest = { - id: repeatableSettings.id - ?? this.questConfig.repeatableQuests.find((x) => - x.name === repeatableQuestProfile.sptRepatableGroupName - ) - .id, + id: repeatableSettings.id ?? this.questConfig.repeatableQuests.find((x) => + x.name === repeatableQuestProfile.sptRepatableGroupName + ).id, name: repeatableSettings.name, endTime: repeatableSettings.endTime, changeRequirement: change, @@ -957,10 +955,6 @@ export class QuestController return; } - pmcData.BackendCounters[conditionId] = { - id: conditionId, - qid: questId, - value: counterValue, - }; + pmcData.BackendCounters[conditionId] = {id: conditionId, qid: questId, value: counterValue}; } } diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index 74188ccc..bf4a4902 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -326,11 +326,7 @@ export class RagfairController const min = offers[0].requirementsCost; // Get first item from array as its pre-sorted const max = offers.at(-1).requirementsCost; // Get last item from array as its pre-sorted - return { - avg: (min + max) / 2, - min: min, - max: max, - }; + return {avg: (min + max) / 2, min: min, max: max}; } // No offers listed, get price from live ragfair price list prices.json else @@ -344,11 +340,7 @@ export class RagfairController tplPrice = this.handbookHelper.getTemplatePrice(getPriceRequest.templateId); } - return { - avg: tplPrice, - min: tplPrice, - max: tplPrice, - }; + return {avg: tplPrice, min: tplPrice, max: tplPrice}; } } @@ -399,9 +391,7 @@ export class RagfairController const qualityMultiplier = this.itemHelper.getItemQualityModifier(rootItem); const averageOfferPrice = this.ragfairPriceService.getFleaPriceForItem(rootItem._tpl) * rootItem.upd.StackObjectsCount * qualityMultiplier; - const itemStackCount = (offerRequest.sellInOnePiece) - ? 1 - : rootItem.upd.StackObjectsCount; + const itemStackCount = (offerRequest.sellInOnePiece) ? 1 : rootItem.upd.StackObjectsCount; // Get averaged price of a single item being listed const averageSingleItemPrice = (offerRequest.sellInOnePiece) @@ -623,11 +613,7 @@ export class RagfairController const formattedRequirements: IBarterScheme[] = requirements.map((item) => { - return { - _tpl: item._tpl, - count: item.count, - onlyFunctional: item.onlyFunctional, - }; + return {_tpl: item._tpl, count: item.count, onlyFunctional: item.onlyFunctional}; }); return this.ragfairOfferGenerator.createFleaOffer( @@ -756,12 +742,7 @@ export class RagfairController return { tid: "ragfair", Action: "TradingConfirm", - scheme_items: [ - { - id: this.paymentHelper.getCurrency(currency), - count: Math.round(value), - }, - ], + scheme_items: [{id: this.paymentHelper.getCurrency(currency), count: Math.round(value)}], type: "", item_id: "", count: 0, diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index d40b81ad..94fd56b8 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -99,8 +99,7 @@ export class RepeatableQuestController const currentRepeatableQuestType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData); if ( - repeatableConfig.side === "Pmc" - && pmcData.Info.Level >= repeatableConfig.minPlayerLevel + repeatableConfig.side === "Pmc" && pmcData.Info.Level >= repeatableConfig.minPlayerLevel || repeatableConfig.side === "Scav" && scavQuestUnlocked ) { @@ -216,8 +215,7 @@ export class RepeatableQuestController // Elite charisma skill gives extra daily quest(s) return repeatableConfig.numQuests + this.databaseServer.getTables().globals.config.SkillsSettings.Charisma.BonusSettings - .EliteBonusSettings - .RepeatableQuestExtraCount; + .EliteBonusSettings.RepeatableQuestExtraCount; } return repeatableConfig.numQuests; @@ -335,17 +333,7 @@ export class RepeatableQuestController { return { types: repeatableConfig.types.slice(), - pool: { - Exploration: { - locations: {}, - }, - Elimination: { - targets: {}, - }, - Pickup: { - locations: {}, - }, - }, + pool: {Exploration: {locations: {}}, Elimination: {targets: {}}, Pickup: {locations: {}}}, }; } diff --git a/project/src/controllers/WeatherController.ts b/project/src/controllers/WeatherController.ts index eca193db..90350ea9 100644 --- a/project/src/controllers/WeatherController.ts +++ b/project/src/controllers/WeatherController.ts @@ -24,12 +24,7 @@ export class WeatherController /** Handle client/weather */ public generate(): IWeatherData { - let result: IWeatherData = { - acceleration: 0, - time: "", - date: "", - weather: null, - }; + let result: IWeatherData = {acceleration: 0, time: "", date: "", weather: null}; result = this.weatherGenerator.calculateGameTime(result); result.weather = this.weatherGenerator.generateWeather(); diff --git a/project/src/controllers/WishlistController.ts b/project/src/controllers/WishlistController.ts index aae3f9e5..eefa8c9b 100644 --- a/project/src/controllers/WishlistController.ts +++ b/project/src/controllers/WishlistController.ts @@ -8,9 +8,7 @@ import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; @injectable() export class WishlistController { - constructor( - @inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder, - ) + constructor(@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder) {} /** Handle AddToWishList */ diff --git a/project/src/di/Container.ts b/project/src/di/Container.ts index e80d5579..a6d45798 100644 --- a/project/src/di/Container.ts +++ b/project/src/di/Container.ts @@ -608,9 +608,7 @@ export class Container con.register("BotGenerationCacheService", BotGenerationCacheService, { lifecycle: Lifecycle.Singleton, }); - con.register("LocalisationService", LocalisationService, { - lifecycle: Lifecycle.Singleton, - }); + con.register("LocalisationService", LocalisationService, {lifecycle: Lifecycle.Singleton}); con.register("CustomLocationWaveService", CustomLocationWaveService, { lifecycle: Lifecycle.Singleton, }); diff --git a/project/src/di/Router.ts b/project/src/di/Router.ts index ae36542e..c575500f 100644 --- a/project/src/di/Router.ts +++ b/project/src/di/Router.ts @@ -94,18 +94,12 @@ export class SaveLoadRouter extends Router export class HandledRoute { - constructor( - public route: string, - public dynamic: boolean, - ) + constructor(public route: string, public dynamic: boolean) {} } export class RouteAction { - constructor( - public url: string, - public action: (url: string, info: any, sessionID: string, output: string) => any, - ) + constructor(public url: string, public action: (url: string, info: any, sessionID: string, output: string) => any) {} } diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index 06f49c89..658938b4 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -97,9 +97,7 @@ export class BotEquipmentModGenerator } // Ensure submods for nvgs all spawn together - forceSpawn = (modSlot === "mod_nvg") - ? true - : false; + forceSpawn = (modSlot === "mod_nvg") ? true : false; let modTpl: string; let found = false; @@ -290,13 +288,7 @@ export class BotEquipmentModGenerator if (this.modSlotCanHoldScope(modSlot, modToAddTemplate._parent)) { // mod_mount was picked to be added to weapon, force scope chance to ensure its filled - const scopeSlots = [ - "mod_scope", - "mod_scope_000", - "mod_scope_001", - "mod_scope_002", - "mod_scope_003", - ]; + const scopeSlots = ["mod_scope", "mod_scope_000", "mod_scope_001", "mod_scope_002", "mod_scope_003"]; this.adjustSlotSpawnChances(modSpawnChances, scopeSlots, 100); // Hydrate pool of mods that fit into mount as its a randomisable slot @@ -310,11 +302,7 @@ export class BotEquipmentModGenerator // If picked item is muzzle adapter that can hold a child, adjust spawn chance if (this.modSlotCanHoldMuzzleDevices(modSlot, modToAddTemplate._parent)) { - const muzzleSlots = [ - "mod_muzzle", - "mod_muzzle_000", - "mod_muzzle_001", - ]; + const muzzleSlots = ["mod_muzzle", "mod_muzzle_000", "mod_muzzle_001"]; // Make chance of muzzle devices 95%, nearly certain but not guaranteed this.adjustSlotSpawnChances(modSpawnChances, muzzleSlots, 95); } @@ -340,8 +328,7 @@ export class BotEquipmentModGenerator // If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure sub-stock gets added // Or if mod_stock is configured to be forced on if ( - modSlot === "mod_stock" - && (modToAddTemplate._props.Slots.find((x) => + modSlot === "mod_stock" && (modToAddTemplate._props.Slots.find((x) => x._name.includes("mod_stock") || botEquipConfig.forceStock )) ) @@ -435,8 +422,7 @@ export class BotEquipmentModGenerator "mod_scope_001", "mod_scope_002", "mod_scope_003", - ].includes(modSlot.toLowerCase()) - && modsParentId === BaseClasses.MOUNT; + ].includes(modSlot.toLowerCase()) && modsParentId === BaseClasses.MOUNT; } /** @@ -1025,12 +1011,7 @@ export class BotEquipmentModGenerator { const modSlotId = slot._name; const modId = this.hashUtil.generate(); - items.push({ - _id: modId, - _tpl: modTpl, - parentId: parentId, - slotId: modSlotId, - }); + items.push({_id: modId, _tpl: modTpl, parentId: parentId, slotId: modSlotId}); } } diff --git a/project/src/generators/BotGenerator.ts b/project/src/generators/BotGenerator.ts index 22d6aa52..a8c3f794 100644 --- a/project/src/generators/BotGenerator.ts +++ b/project/src/generators/BotGenerator.ts @@ -99,10 +99,7 @@ export class BotGenerator * @param botGenerationDetails details on how to generate bots * @returns array of bots */ - public prepareAndGenerateBots( - sessionId: string, - botGenerationDetails: BotGenerationDetails, - ): IBotBase[] + public prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[] { const output: IBotBase[] = []; for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++) @@ -114,11 +111,9 @@ export class BotGenerator bot.Info.Settings.BotDifficulty = botGenerationDetails.botDifficulty; // Get raw json data for bot (Cloned) - const botJsonTemplate = this.jsonUtil.clone(this.botHelper.getBotTemplate( - (botGenerationDetails.isPmc) - ? bot.Info.Side - : botGenerationDetails.role, - )); + const botJsonTemplate = this.jsonUtil.clone( + this.botHelper.getBotTemplate((botGenerationDetails.isPmc) ? bot.Info.Side : botGenerationDetails.role), + ); bot = this.generateBot(sessionId, bot, botJsonTemplate, botGenerationDetails); @@ -328,9 +323,7 @@ export class BotGenerator */ protected generateHealth(healthObj: Health, playerScav = false): PmcHealth { - const bodyParts = playerScav - ? healthObj.BodyParts[0] - : this.randomUtil.getArrayValue(healthObj.BodyParts); + const bodyParts = playerScav ? healthObj.BodyParts[0] : this.randomUtil.getArrayValue(healthObj.BodyParts); const newHealth: PmcHealth = { Hydration: { @@ -437,10 +430,7 @@ export class BotGenerator } // All skills have id and progress props - const skillToAdd: IBaseSkill = { - Id: skillKey, - Progress: this.randomUtil.getInt(skill.min, skill.max), - }; + const skillToAdd: IBaseSkill = {Id: skillKey, Progress: this.randomUtil.getInt(skill.min, skill.max)}; // Common skills have additional props if (isCommonSkills) diff --git a/project/src/generators/BotInventoryGenerator.ts b/project/src/generators/BotInventoryGenerator.ts index a6c81361..6128e349 100644 --- a/project/src/generators/BotInventoryGenerator.ts +++ b/project/src/generators/BotInventoryGenerator.ts @@ -112,26 +112,11 @@ export class BotInventoryGenerator return { items: [ - { - _id: equipmentId, - _tpl: equipmentTpl, - }, - { - _id: stashId, - _tpl: stashTpl, - }, - { - _id: questRaidItemsId, - _tpl: questRaidItemsTpl, - }, - { - _id: questStashItemsId, - _tpl: questStashItemsTpl, - }, - { - _id: sortingTableId, - _tpl: sortingTableTpl, - }, + {_id: equipmentId, _tpl: equipmentTpl}, + {_id: stashId, _tpl: stashTpl}, + {_id: questRaidItemsId, _tpl: questRaidItemsTpl}, + {_id: questStashItemsId, _tpl: questStashItemsTpl}, + {_id: sortingTableId, _tpl: sortingTableTpl}, ], equipment: equipmentId, stash: stashId, @@ -421,24 +406,17 @@ export class BotInventoryGenerator protected getDesiredWeaponsForBot(equipmentChances: Chances): {slot: EquipmentSlots; shouldSpawn: boolean;}[] { const shouldSpawnPrimary = this.randomUtil.getChance100(equipmentChances.equipment.FirstPrimaryWeapon); - return [ - { - slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, - shouldSpawn: shouldSpawnPrimary, - }, - { - slot: EquipmentSlots.SECOND_PRIMARY_WEAPON, - shouldSpawn: shouldSpawnPrimary - ? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon) - : false, - }, - { - slot: EquipmentSlots.HOLSTER, - shouldSpawn: shouldSpawnPrimary - ? this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol - : true, // No primary = force pistol - }, - ]; + return [{slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary}, { + slot: EquipmentSlots.SECOND_PRIMARY_WEAPON, + shouldSpawn: shouldSpawnPrimary + ? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon) + : false, + }, { + slot: EquipmentSlots.HOLSTER, + shouldSpawn: shouldSpawnPrimary + ? this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol + : true, // No primary = force pistol + }]; } /** diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index 54f6a28b..8bd4d68f 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -237,52 +237,16 @@ export class BotLootGenerator protected addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void { const grizzly = this.itemHelper.getItem("590c657e86f77412b013051d")[1]; - this.addLootFromPool( - [grizzly], - [EquipmentSlots.SECURED_CONTAINER], - 2, - botInventory, - botRole, - false, - 0, - true, - ); + this.addLootFromPool([grizzly], [EquipmentSlots.SECURED_CONTAINER], 2, botInventory, botRole, false, 0, true); const surv12 = this.itemHelper.getItem("5d02797c86f774203f38e30a")[1]; - this.addLootFromPool( - [surv12], - [EquipmentSlots.SECURED_CONTAINER], - 1, - botInventory, - botRole, - false, - 0, - true, - ); + this.addLootFromPool([surv12], [EquipmentSlots.SECURED_CONTAINER], 1, botInventory, botRole, false, 0, true); const morphine = this.itemHelper.getItem("544fb3f34bdc2d03748b456a")[1]; - this.addLootFromPool( - [morphine], - [EquipmentSlots.SECURED_CONTAINER], - 3, - botInventory, - botRole, - false, - 0, - true, - ); + this.addLootFromPool([morphine], [EquipmentSlots.SECURED_CONTAINER], 3, botInventory, botRole, false, 0, true); const afak = this.itemHelper.getItem("60098ad7c2240c0fe85c570a")[1]; - this.addLootFromPool( - [afak], - [EquipmentSlots.SECURED_CONTAINER], - 2, - botInventory, - botRole, - false, - 0, - true, - ); + this.addLootFromPool([afak], [EquipmentSlots.SECURED_CONTAINER], 2, botInventory, botRole, false, 0, true); } /** diff --git a/project/src/generators/BotWeaponGenerator.ts b/project/src/generators/BotWeaponGenerator.ts index 7f5e946a..854399f7 100644 --- a/project/src/generators/BotWeaponGenerator.ts +++ b/project/src/generators/BotWeaponGenerator.ts @@ -258,9 +258,7 @@ export class BotWeaponGenerator else { // Already exists, update values - existingItemWithSlot.upd = { - StackObjectsCount: 1, - }; + existingItemWithSlot.upd = {StackObjectsCount: 1}; existingItemWithSlot._tpl = ammoTpl; } } @@ -532,11 +530,7 @@ export class BotWeaponGenerator [EquipmentSlots.SECURED_CONTAINER], id, ammoTpl, - [{ - _id: id, - _tpl: ammoTpl, - upd: {StackObjectsCount: stackSize}, - }], + [{_id: id, _tpl: ammoTpl, upd: {StackObjectsCount: stackSize}}], inventory, ); } @@ -705,17 +699,13 @@ export class BotWeaponGenerator */ protected fillUbgl(weaponMods: Item[], ubglMod: Item, ubglAmmoTpl: string): void { - weaponMods.push( - { - _id: this.hashUtil.generate(), - _tpl: ubglAmmoTpl, - parentId: ubglMod._id, - slotId: "patron_in_weapon", - upd: { - StackObjectsCount: 1, - }, - }, - ); + weaponMods.push({ + _id: this.hashUtil.generate(), + _tpl: ubglAmmoTpl, + parentId: ubglMod._id, + slotId: "patron_in_weapon", + upd: {StackObjectsCount: 1}, + }); } /** diff --git a/project/src/generators/FenceBaseAssortGenerator.ts b/project/src/generators/FenceBaseAssortGenerator.ts index f2418d1b..30c50dce 100644 --- a/project/src/generators/FenceBaseAssortGenerator.ts +++ b/project/src/generators/FenceBaseAssortGenerator.ts @@ -97,10 +97,7 @@ export class FenceBaseAssortGenerator _tpl: item._id, parentId: "hideout", slotId: "hideout", - upd: { - StackObjectsCount: 9999999, - UnlimitedCount: true, - }, + upd: {StackObjectsCount: 9999999, UnlimitedCount: true}, }; // Add item to base diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationGenerator.ts index 36d7c9a3..6f5f5316 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -247,13 +247,12 @@ export class LocationGenerator */ protected getRandomisableContainersOnMap(staticContainers: IStaticContainerData[]): IStaticContainerData[] { - return staticContainers - .filter((x) => - x.probability !== 1 && !x.template.IsAlwaysSpawn - && !this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes( - x.template.Items[0]._tpl, - ) - ); + return staticContainers.filter((x) => + x.probability !== 1 && !x.template.IsAlwaysSpawn + && !this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes( + x.template.Items[0]._tpl, + ) + ); } /** @@ -530,9 +529,7 @@ export class LocationGenerator continue; } - itemDistribution.push( - new ProbabilityObject(icd.tpl, icd.relativeProbability), - ); + itemDistribution.push(new ProbabilityObject(icd.tpl, icd.relativeProbability)); } return itemDistribution; @@ -571,10 +568,7 @@ export class LocationGenerator // Draw from random distribution const desiredSpawnpointCount = Math.round( this.getLooseLootMultiplerForLocation(locationName) - * this.randomUtil.randn( - dynamicLootDist.spawnpointCount.mean, - dynamicLootDist.spawnpointCount.std, - ), + * this.randomUtil.randn(dynamicLootDist.spawnpointCount.mean, dynamicLootDist.spawnpointCount.std), ); // Positions not in forced but have 100% chance to spawn @@ -598,9 +592,7 @@ export class LocationGenerator continue; } - spawnpointArray.push( - new ProbabilityObject(spawnpoint.template.Id, spawnpoint.probability, spawnpoint), - ); + spawnpointArray.push(new ProbabilityObject(spawnpoint.template.Id, spawnpoint.probability, spawnpoint)); } // Select a number of spawn points to add loot to @@ -665,9 +657,7 @@ export class LocationGenerator continue; } - itemArray.push( - new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability), - ); + itemArray.push(new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability)); } // Draw a random item from spawn points possible items @@ -720,9 +710,7 @@ export class LocationGenerator for (const si of items) { // use locationId as template.Id is the same across all items - spawnpointArray.push( - new ProbabilityObject(si.locationId, si.probability, si), - ); + spawnpointArray.push(new ProbabilityObject(si.locationId, si.probability, si)); } // Choose 1 out of all found spawn positions for spawn id and add to loot array @@ -792,22 +780,13 @@ export class LocationGenerator ? 1 : this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); - itemWithMods.push( - { - _id: this.objectId.generate(), - _tpl: chosenTpl, - upd: {StackObjectsCount: stackCount}, - }, - ); + itemWithMods.push({_id: this.objectId.generate(), _tpl: chosenTpl, upd: {StackObjectsCount: stackCount}}); } else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX)) { // Fill with cartrdiges const ammoBoxTemplate = this.itemHelper.getItem(chosenTpl)[1]; - const ammoBoxItem: Item[] = [{ - _id: this.objectId.generate(), - _tpl: chosenTpl, - }]; + const ammoBoxItem: Item[] = [{_id: this.objectId.generate(), _tpl: chosenTpl}]; this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, ammoBoxTemplate); itemWithMods.push(...ammoBoxItem); } @@ -815,10 +794,7 @@ export class LocationGenerator { // Create array with just magazine + randomised amount of cartridges const magazineTemplate = this.itemHelper.getItem(chosenTpl)[1]; - const magazineItem: Item[] = [{ - _id: this.objectId.generate(), - _tpl: chosenTpl, - }]; + const magazineItem: Item[] = [{_id: this.objectId.generate(), _tpl: chosenTpl}]; this.itemHelper.fillMagazineWithRandomCartridge( magazineItem, magazineTemplate, @@ -845,11 +821,7 @@ export class LocationGenerator // Get inventory size of item const size = this.itemHelper.getItemSize(itemWithMods, itemWithMods[0]._id); - return { - items: itemWithMods, - width: size.width, - height: size.height, - }; + return {items: itemWithMods, width: size.width, height: size.height}; } /** @@ -901,12 +873,7 @@ export class LocationGenerator const itemTemplate = this.itemHelper.getItem(tpl)[1]; let width = itemTemplate._props.Width; let height = itemTemplate._props.Height; - let items: Item[] = [ - { - _id: this.objectId.generate(), - _tpl: tpl, - }, - ]; + let items: Item[] = [{_id: this.objectId.generate(), _tpl: tpl}]; // Use passed in parentId as override for new item if (parentId) @@ -1037,10 +1004,6 @@ export class LocationGenerator items.splice(items.indexOf(items[0]), 1, ...magazineWithCartridges); } - return { - items: items, - width: width, - height: height, - }; + return {items: items, width: width, height: height}; } } diff --git a/project/src/generators/LootGenerator.ts b/project/src/generators/LootGenerator.ts index 56bb3032..2dce664f 100644 --- a/project/src/generators/LootGenerator.ts +++ b/project/src/generators/LootGenerator.ts @@ -19,10 +19,7 @@ import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemSer import { HashUtil } from "@spt-aki/utils/HashUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; -type ItemLimit = { - current: number; - max: number; -}; +type ItemLimit = {current: number; max: number;}; @injectable() export class LootGenerator @@ -134,10 +131,7 @@ export class LootGenerator const itemTypeCounts: Record = {}; for (const itemTypeId in limits) { - itemTypeCounts[itemTypeId] = { - current: 0, - max: limits[itemTypeId], - }; + itemTypeCounts[itemTypeId] = {current: 0, max: limits[itemTypeId]}; } return itemTypeCounts; @@ -174,10 +168,7 @@ export class LootGenerator }; // Check if armor has level in allowed whitelist - if ( - randomItem._parent === BaseClasses.ARMOR - || randomItem._parent === BaseClasses.VEST - ) + if (randomItem._parent === BaseClasses.ARMOR || randomItem._parent === BaseClasses.VEST) { if (!options.armorLevelWhitelist.includes(Number(randomItem._props.armorClass))) { @@ -277,11 +268,7 @@ export class LootGenerator return false; } - const newLootItem: LootItem = { - tpl: randomPreset._items[0]._tpl, - isPreset: true, - stackCount: 1, - }; + const newLootItem: LootItem = {tpl: randomPreset._items[0]._tpl, isPreset: true, stackCount: 1}; result.push(newLootItem); @@ -405,14 +392,13 @@ export class LootGenerator } // Get all items of the desired type + not quest items + not globally blacklisted - const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items) - .filter((x) => - x._parent === rewardTypeId - && x._type.toLowerCase() === "item" - && !this.itemFilterService.isItemBlacklisted(x._id) - && (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id))) - && !x._props.QuestItem - ); + const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items).filter((x) => + x._parent === rewardTypeId + && x._type.toLowerCase() === "item" + && !this.itemFilterService.isItemBlacklisted(x._id) + && (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id))) + && !x._props.QuestItem + ); if (rewardItemPool.length === 0) { diff --git a/project/src/generators/PlayerScavGenerator.ts b/project/src/generators/PlayerScavGenerator.ts index f612c208..14fe59fc 100644 --- a/project/src/generators/PlayerScavGenerator.ts +++ b/project/src/generators/PlayerScavGenerator.ts @@ -66,9 +66,7 @@ export class PlayerScavGenerator const existingScavData = this.jsonUtil.clone(profile.characters.scav); // scav profile can be empty on first profile creation - const scavKarmaLevel = (Object.keys(existingScavData).length === 0) - ? 0 - : this.getScavKarmaLevel(pmcData); + const scavKarmaLevel = (Object.keys(existingScavData).length === 0) ? 0 : this.getScavKarmaLevel(pmcData); // use karma level to get correct karmaSettings const playerScavKarmaSettings = this.playerScavConfig.karmaLevel[scavKarmaLevel]; @@ -258,11 +256,7 @@ export class PlayerScavGenerator protected getDefaultScavSkills(): Skills { - return { - Common: [], - Mastering: [], - Points: 0, - }; + return {Common: [], Mastering: [], Points: 0}; } protected getScavStats(scavProfile: IPmcData): Stats diff --git a/project/src/generators/RagfairAssortGenerator.ts b/project/src/generators/RagfairAssortGenerator.ts index ceccce7d..4e343613 100644 --- a/project/src/generators/RagfairAssortGenerator.ts +++ b/project/src/generators/RagfairAssortGenerator.ts @@ -135,10 +135,7 @@ export class RagfairAssortGenerator _tpl: tplId, parentId: "hideout", slotId: "hideout", - upd: { - StackObjectsCount: 99999999, - UnlimitedCount: true, - }, + upd: {StackObjectsCount: 99999999, UnlimitedCount: true}, }; } } diff --git a/project/src/generators/RagfairOfferGenerator.ts b/project/src/generators/RagfairOfferGenerator.ts index 2a716526..68071f03 100644 --- a/project/src/generators/RagfairOfferGenerator.ts +++ b/project/src/generators/RagfairOfferGenerator.ts @@ -636,10 +636,7 @@ export class RagfairOfferGenerator { const totalCapacity = itemDetails._props.MaxResource; const remainingFuel = Math.round(totalCapacity * multiplier); - item.upd.Resource = { - UnitsConsumed: totalCapacity - remainingFuel, - Value: remainingFuel, - }; + item.upd.Resource = {UnitsConsumed: totalCapacity - remainingFuel, Value: remainingFuel}; } } @@ -653,9 +650,10 @@ export class RagfairOfferGenerator item.upd.Repairable.Durability = Math.round(item.upd.Repairable.Durability * multiplier) || 1; // randomize max durability, store to a temporary value so we can still compare the max durability - let tempMaxDurability = Math.round( - this.randomUtil.getFloat(item.upd.Repairable.Durability - 5, item.upd.Repairable.MaxDurability + 5), - ) || item.upd.Repairable.Durability; + let tempMaxDurability = + Math.round( + this.randomUtil.getFloat(item.upd.Repairable.Durability - 5, item.upd.Repairable.MaxDurability + 5), + ) || item.upd.Repairable.Durability; // clamp values to max/current if (tempMaxDurability >= item.upd.Repairable.MaxDurability) @@ -689,38 +687,27 @@ export class RagfairOfferGenerator if (isRepairable && props.Durability > 0) { - item.upd.Repairable = { - Durability: props.Durability, - MaxDurability: props.Durability, - }; + item.upd.Repairable = {Durability: props.Durability, MaxDurability: props.Durability}; } if (isMedkit && props.MaxHpResource > 0) { - item.upd.MedKit = { - HpResource: props.MaxHpResource, - }; + item.upd.MedKit = {HpResource: props.MaxHpResource}; } if (isKey) { - item.upd.Key = { - NumberOfUsages: 0, - }; + item.upd.Key = {NumberOfUsages: 0}; } if (isConsumable) { - item.upd.FoodDrink = { - HpPercent: props.MaxResource, - }; + item.upd.FoodDrink = {HpPercent: props.MaxResource}; } if (isRepairKit) { - item.upd.RepairKit = { - Resource: props.MaxRepairResource, - }; + item.upd.RepairKit = {Resource: props.MaxRepairResource}; } return item; @@ -775,12 +762,7 @@ export class RagfairOfferGenerator // Choose random item from price-filtered flea items const randomItem = this.randomUtil.getArrayValue(filtered); - return [ - { - count: barterItemCount, - _tpl: randomItem.tpl, - }, - ]; + return [{count: barterItemCount, _tpl: randomItem.tpl}]; } /** @@ -819,11 +801,6 @@ export class RagfairOfferGenerator const price = this.ragfairPriceService.getDynamicOfferPriceForOffer(offerItems, currency, isPackOffer) * multipler; - return [ - { - count: price, - _tpl: currency, - }, - ]; + return [{count: price, _tpl: currency}]; } } diff --git a/project/src/generators/RepeatableQuestGenerator.ts b/project/src/generators/RepeatableQuestGenerator.ts index e8d24768..c2c219a8 100644 --- a/project/src/generators/RepeatableQuestGenerator.ts +++ b/project/src/generators/RepeatableQuestGenerator.ts @@ -273,13 +273,12 @@ export class RepeatableQuestGenerator // get all boss spawn information const bossSpawns = Object.values(this.databaseServer.getTables().locations).filter((x) => "base" in x && "Id" in x.base - ).map( - (x) => ({Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn}), - ); + ).map((x) => ({Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn})); // filter for the current boss to spawn on map - const thisBossSpawns = bossSpawns.map( - (x) => ({Id: x.Id, BossSpawn: x.BossSpawn.filter((e) => e.BossName === targetKey)}), - ).filter((x) => x.BossSpawn.length > 0); + const thisBossSpawns = bossSpawns.map((x) => ({ + Id: x.Id, + BossSpawn: x.BossSpawn.filter((e) => e.BossName === targetKey), + })).filter((x) => x.BossSpawn.length > 0); // remove blacklisted locations const allowedSpawns = thisBossSpawns.filter((x) => !eliminationConfig.distLocationBlacklist.includes(x.Id)); // if the boss spawns on nom-blacklisted locations and the current location is allowed we can generate a distance kill requirement @@ -416,11 +415,7 @@ export class RepeatableQuestGenerator protected generateEliminationLocation(location: string[]): IEliminationCondition { const propsObject: IEliminationCondition = { - _props: { - target: location, - id: this.objectId.generate(), - dynamicLocale: true, - }, + _props: {target: location, id: this.objectId.generate(), dynamicLocale: true}, _parent: "Location", }; @@ -466,10 +461,7 @@ export class RepeatableQuestGenerator // Dont allow distance + melee requirement if (distance && allowedWeaponCategory !== "5b5f7a0886f77409407a7f96") { - killConditionProps.distance = { - compareMethod: ">=", - value: distance, - }; + killConditionProps.distance = {compareMethod: ">=", value: distance}; } // Has specific weapon requirement @@ -484,10 +476,7 @@ export class RepeatableQuestGenerator killConditionProps.weaponCategories = [allowedWeaponCategory]; } - return { - _props: killConditionProps, - _parent: "Kills", - }; + return {_props: killConditionProps, _parent: "Kills"}; } /** @@ -710,28 +699,15 @@ export class RepeatableQuestGenerator const exitStatusCondition: IExplorationCondition = { _parent: "ExitStatus", - _props: { - id: this.objectId.generate(), - dynamicLocale: true, - status: [ - "Survived", - ], - }, + _props: {id: this.objectId.generate(), dynamicLocale: true, status: ["Survived"]}, }; const locationCondition: IExplorationCondition = { _parent: "Location", - _props: { - id: this.objectId.generate(), - dynamicLocale: true, - target: locationTarget, - }, + _props: {id: this.objectId.generate(), dynamicLocale: true, target: locationTarget}, }; quest.conditions.AvailableForFinish[0]._props.counter.id = this.objectId.generate(); - quest.conditions.AvailableForFinish[0]._props.counter.conditions = [ - exitStatusCondition, - locationCondition, - ]; + quest.conditions.AvailableForFinish[0]._props.counter.conditions = [exitStatusCondition, locationCondition]; quest.conditions.AvailableForFinish[0]._props.value = numExtracts; quest.conditions.AvailableForFinish[0]._props.id = this.objectId.generate(); quest.location = this.getQuestLocationByMapId(locationKey); @@ -742,13 +718,11 @@ export class RepeatableQuestGenerator // Scav exits are not listed at all in locations.base currently. If that changes at some point, additional filtering will be required const mapExits = (this.databaseServer.getTables().locations[locationKey.toLowerCase()].base as ILocationBase).exits; - const possibleExists = mapExits.filter( - (x) => - (!("PassageRequirement" in x) - || repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes( - x.PassageRequirement, - )) - && x.Chance > 0, + const possibleExists = mapExits.filter((x) => + (!("PassageRequirement" in x) + || repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes( + x.PassageRequirement, + )) && x.Chance > 0 ); const exit = this.randomUtil.drawRandomFromList(possibleExists, 1)[0]; const exitCondition = this.generateExplorationExitCondition(exit); @@ -823,14 +797,7 @@ export class RepeatableQuestGenerator */ protected generateExplorationExitCondition(exit: Exit): IExplorationCondition { - return { - _parent: "ExitName", - _props: { - exitName: exit.Name, - id: this.objectId.generate(), - dynamicLocale: true, - }, - }; + return {_parent: "ExitName", _props: {exitName: exit.Name, id: this.objectId.generate(), dynamicLocale: true}}; } /** @@ -890,10 +857,11 @@ export class RepeatableQuestGenerator 1, Math.round(this.mathUtil.interp1(pmcLevel, levelsConfig, itemsConfig)) + 1, ); - const rewardReputation = Math.round( - 100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig) - * this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig), - ) / 100; + const rewardReputation = + Math.round( + 100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig) + * this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig), + ) / 100; const skillRewardChance = this.mathUtil.interp1(pmcLevel, levelsConfig, skillRewardChanceConfig); const skillPointReward = this.mathUtil.interp1(pmcLevel, levelsConfig, skillPointRewardConfig); @@ -901,17 +869,7 @@ export class RepeatableQuestGenerator let roublesBudget = rewardRoubles; let chosenRewardItems = this.chooseRewardItemsWithinBudget(repeatableConfig, roublesBudget); - const rewards: IRewards = { - Started: [], - Success: [ - { - value: rewardXP, - type: "Experience", - index: 0, - }, - ], - Fail: [], - }; + const rewards: IRewards = {Started: [], Success: [{value: rewardXP, type: "Experience", index: 0}], Fail: []}; if (traderId === Traders.PEACEKEEPER) { @@ -988,12 +946,7 @@ export class RepeatableQuestGenerator // Add rep reward to rewards array if (rewardReputation > 0) { - const reward: IReward = { - target: traderId, - value: rewardReputation, - type: "TraderStanding", - index: index, - }; + const reward: IReward = {target: traderId, value: rewardReputation, type: "TraderStanding", index: index}; rewards.Success.push(reward); } @@ -1057,21 +1010,9 @@ export class RepeatableQuestGenerator protected generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward { const id = this.objectId.generate(); - const rewardItem: IReward = { - target: id, - value: value, - type: "Item", - index: index, - }; + const rewardItem: IReward = {target: id, value: value, type: "Item", index: index}; - const rootItem = { - _id: id, - _tpl: tpl, - upd: { - StackObjectsCount: value, - SpawnedInSession: true, - }, - }; + const rootItem = {_id: id, _tpl: tpl, upd: {StackObjectsCount: value, SpawnedInSession: true}}; if (preset) { @@ -1094,18 +1035,16 @@ 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 === "") { - // Base "Item" item has no parent, ignore it - if (itemTemplate._parent === "") - { - return false; - } + return false; + } - return this.isValidRewardItem(tpl, repeatableQuestConfig); - }, - ); + return this.isValidRewardItem(tpl, repeatableQuestConfig); + }); } /** @@ -1123,10 +1062,7 @@ export class RepeatableQuestGenerator } // Item is on repeatable or global blacklist - if ( - repeatableQuestConfig.rewardBlacklist.includes(tpl) - || this.itemFilterService.isItemBlacklisted(tpl) - ) + if (repeatableQuestConfig.rewardBlacklist.includes(tpl) || this.itemFilterService.isItemBlacklisted(tpl)) { return false; } @@ -1152,8 +1088,7 @@ export class RepeatableQuestGenerator // Skip globally blacklisted items + boss items // biome-ignore lint/complexity/useSimplifiedLogicExpression: - valid = !this.itemFilterService.isItemBlacklisted(tpl) - && !this.itemFilterService.isBossItem(tpl); + valid = !this.itemFilterService.isItemBlacklisted(tpl) && !this.itemFilterService.isBossItem(tpl); return valid; } diff --git a/project/src/generators/ScavCaseRewardGenerator.ts b/project/src/generators/ScavCaseRewardGenerator.ts index 2cb56bc3..21ca83a9 100644 --- a/project/src/generators/ScavCaseRewardGenerator.ts +++ b/project/src/generators/ScavCaseRewardGenerator.ts @@ -279,11 +279,7 @@ export class ScavCaseRewardGenerator const result: Product[] = []; for (const item of rewardItems) { - const resultItem = { - _id: this.hashUtil.generate(), - _tpl: item._id, - upd: undefined, - }; + const resultItem = {_id: this.hashUtil.generate(), _tpl: item._id, upd: undefined}; this.addStackCountToAmmoAndMoney(item, resultItem, rarity); @@ -312,9 +308,7 @@ export class ScavCaseRewardGenerator { if (item._parent === BaseClasses.AMMO || item._parent === BaseClasses.MONEY) { - resultItem.upd = { - StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity), - }; + resultItem.upd = {StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity)}; } } @@ -331,10 +325,7 @@ export class ScavCaseRewardGenerator return dbItems.filter((item) => { const handbookPrice = this.ragfairPriceService.getStaticPriceForItem(item._id); - if ( - handbookPrice >= itemFilters.minPriceRub - && handbookPrice <= itemFilters.maxPriceRub - ) + if (handbookPrice >= itemFilters.minPriceRub && handbookPrice <= itemFilters.maxPriceRub) { return true; } diff --git a/project/src/generators/WeatherGenerator.ts b/project/src/generators/WeatherGenerator.ts index 224e9d88..7f2efb42 100644 --- a/project/src/generators/WeatherGenerator.ts +++ b/project/src/generators/WeatherGenerator.ts @@ -106,9 +106,7 @@ export class WeatherGenerator wind_gustiness: this.getRandomFloat("windGustiness"), rain: rain, // eslint-disable-next-line @typescript-eslint/naming-convention - rain_intensity: (rain > 1) - ? this.getRandomFloat("rainIntensity") - : 0, + rain_intensity: (rain > 1) ? this.getRandomFloat("rainIntensity") : 0, fog: this.getWeightedFog(), temp: this.getRandomFloat("temp"), pressure: this.getRandomFloat("pressure"), diff --git a/project/src/generators/weapongen/implementations/InternalMagazineInventoryMagGen.ts b/project/src/generators/weapongen/implementations/InternalMagazineInventoryMagGen.ts index 800013bd..2d865fee 100644 --- a/project/src/generators/weapongen/implementations/InternalMagazineInventoryMagGen.ts +++ b/project/src/generators/weapongen/implementations/InternalMagazineInventoryMagGen.ts @@ -7,9 +7,7 @@ import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHel @injectable() export class InternalMagazineInventoryMagGen implements IInventoryMagGen { - constructor( - @inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper, - ) + constructor(@inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper) {} public getPriority(): number diff --git a/project/src/generators/weapongen/implementations/UbglExternalMagGen.ts b/project/src/generators/weapongen/implementations/UbglExternalMagGen.ts index 1821eafc..03abcb02 100644 --- a/project/src/generators/weapongen/implementations/UbglExternalMagGen.ts +++ b/project/src/generators/weapongen/implementations/UbglExternalMagGen.ts @@ -9,9 +9,7 @@ import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots"; @injectable() export class UbglExternalMagGen implements IInventoryMagGen { - constructor( - @inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper, - ) + constructor(@inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper) {} public getPriority(): number diff --git a/project/src/helpers/BotDifficultyHelper.ts b/project/src/helpers/BotDifficultyHelper.ts index 3b6298f5..9fd469d6 100644 --- a/project/src/helpers/BotDifficultyHelper.ts +++ b/project/src/helpers/BotDifficultyHelper.ts @@ -38,12 +38,8 @@ export class BotDifficultyHelper { const difficultySettings = this.getDifficultySettings(pmcType, difficulty); - const friendlyType = pmcType === "bear" - ? bearType - : usecType; - const enemyType = pmcType === "bear" - ? usecType - : bearType; + const friendlyType = pmcType === "bear" ? bearType : usecType; + const enemyType = pmcType === "bear" ? usecType : bearType; this.botHelper.addBotToEnemyList(difficultySettings, this.pmcConfig.enemyTypes, friendlyType); // Add generic bot types to enemy list this.botHelper.addBotToEnemyList(difficultySettings, [enemyType, friendlyType], ""); // add same/opposite side to enemy list diff --git a/project/src/helpers/BotGeneratorHelper.ts b/project/src/helpers/BotGeneratorHelper.ts index e1849094..97ac6b87 100644 --- a/project/src/helpers/BotGeneratorHelper.ts +++ b/project/src/helpers/BotGeneratorHelper.ts @@ -150,9 +150,7 @@ export class BotGeneratorHelper itemProperties.Togglable = {On: (this.randomUtil.getChance100(faceShieldActiveChance))}; } - return Object.keys(itemProperties).length - ? {upd: itemProperties} - : {}; + return Object.keys(itemProperties).length ? {upd: itemProperties} : {}; } /** @@ -240,10 +238,7 @@ export class BotGeneratorHelper maxDurability, ); - return { - Durability: currentDurability, - MaxDurability: maxDurability, - }; + return {Durability: currentDurability, MaxDurability: maxDurability}; } /** @@ -271,10 +266,7 @@ export class BotGeneratorHelper ); } - return { - Durability: currentDurability, - MaxDurability: maxDurability, - }; + return {Durability: currentDurability, MaxDurability: maxDurability}; } /** @@ -381,11 +373,7 @@ export class ExhaustableArray { private pool: T[]; - constructor( - private itemPool: T[], - private randomUtil: RandomUtil, - private jsonUtil: JsonUtil, - ) + constructor(private itemPool: T[], private randomUtil: RandomUtil, private jsonUtil: JsonUtil) { this.pool = this.jsonUtil.clone(itemPool); } diff --git a/project/src/helpers/BotHelper.ts b/project/src/helpers/BotHelper.ts index 9801ecb7..d7c1991d 100644 --- a/project/src/helpers/BotHelper.ts +++ b/project/src/helpers/BotHelper.ts @@ -248,8 +248,6 @@ export class BotHelper */ protected getRandomizedPmcSide(): string { - return (this.randomUtil.getChance100(this.pmcConfig.isUsec)) - ? "Usec" - : "Bear"; + return (this.randomUtil.getChance100(this.pmcConfig.isUsec)) ? "Usec" : "Bear"; } } diff --git a/project/src/helpers/BotWeaponGeneratorHelper.ts b/project/src/helpers/BotWeaponGeneratorHelper.ts index 3a0631e1..8be17470 100644 --- a/project/src/helpers/BotWeaponGeneratorHelper.ts +++ b/project/src/helpers/BotWeaponGeneratorHelper.ts @@ -96,10 +96,7 @@ export class BotWeaponGeneratorHelper */ public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[] { - const magazine: Item[] = [{ - _id: this.hashUtil.generate(), - _tpl: magazineTpl, - }]; + const magazine: Item[] = [{_id: this.hashUtil.generate(), _tpl: magazineTpl}]; this.itemHelper.fillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1); @@ -128,13 +125,9 @@ export class BotWeaponGeneratorHelper for (const ammoItem of ammoItems) { - const result = this.addItemWithChildrenToEquipmentSlot( - equipmentSlotsToAddTo, - ammoItem._id, - ammoItem._tpl, - [ammoItem], - inventory, - ); + const result = this.addItemWithChildrenToEquipmentSlot(equipmentSlotsToAddTo, ammoItem._id, ammoItem._tpl, [ + ammoItem, + ], inventory); if (result === ItemAddedResult.NO_SPACE) { diff --git a/project/src/helpers/DialogueHelper.ts b/project/src/helpers/DialogueHelper.ts index 86e2ecdf..47c4a799 100644 --- a/project/src/helpers/DialogueHelper.ts +++ b/project/src/helpers/DialogueHelper.ts @@ -39,10 +39,7 @@ export class DialogueHelper */ public createMessageContext(templateId: string, messageType: MessageType, maxStoreTime = null): MessageContent { - const result: MessageContent = { - templateId: templateId, - type: messageType, - }; + const result: MessageContent = {templateId: templateId, type: messageType}; if (maxStoreTime) { @@ -69,14 +66,7 @@ export class DialogueHelper if (isNewDialogue) { - dialogue = { - _id: dialogueID, - type: messageType, - messages: [], - pinned: false, - new: 0, - attachmentsNew: 0, - }; + dialogue = {_id: dialogueID, type: messageType, messages: [], pinned: false, new: 0, attachmentsNew: 0}; dialogueData[dialogueID] = dialogue; } @@ -89,10 +79,7 @@ export class DialogueHelper if (rewards.length > 0) { const stashId = this.hashUtil.generate(); - items = { - stash: stashId, - data: [], - }; + items = {stash: stashId, data: []}; rewards = this.itemHelper.replaceIDs(null, rewards); for (const reward of rewards) diff --git a/project/src/helpers/DurabilityLimitsHelper.ts b/project/src/helpers/DurabilityLimitsHelper.ts index 8840976e..45d2abcb 100644 --- a/project/src/helpers/DurabilityLimitsHelper.ts +++ b/project/src/helpers/DurabilityLimitsHelper.ts @@ -177,9 +177,7 @@ export class DurabilityLimitsHelper ); // Dont let weapon dura go below the percent defined in config - return (result >= durabilityValueMinLimit) - ? result - : durabilityValueMinLimit; + return (result >= durabilityValueMinLimit) ? result : durabilityValueMinLimit; } protected generateArmorDurability(botRole: string, maxDurability: number): number @@ -193,9 +191,7 @@ export class DurabilityLimitsHelper ); // Dont let armor dura go below the percent defined in config - return (result >= durabilityValueMinLimit) - ? result - : durabilityValueMinLimit; + return (result >= durabilityValueMinLimit) ? result : durabilityValueMinLimit; } protected getMinWeaponDeltaFromConfig(botRole: string): number diff --git a/project/src/helpers/HandbookHelper.ts b/project/src/helpers/HandbookHelper.ts index bc93a88d..a5662eb5 100644 --- a/project/src/helpers/HandbookHelper.ts +++ b/project/src/helpers/HandbookHelper.ts @@ -49,9 +49,7 @@ export class HandbookHelper { this.handbookPriceCache.items.byParent.set(handbookItem.ParentId, []); } - this.handbookPriceCache.items.byParent - .get(handbookItem.ParentId) - .push(handbookItem.Id); + this.handbookPriceCache.items.byParent.get(handbookItem.ParentId).push(handbookItem.Id); } for (const handbookCategory of handbookDb.Categories) @@ -63,9 +61,7 @@ export class HandbookHelper { this.handbookPriceCache.categories.byParent.set(handbookCategory.ParentId, []); } - this.handbookPriceCache.categories.byParent - .get(handbookCategory.ParentId) - .push(handbookCategory.Id); + this.handbookPriceCache.categories.byParent.get(handbookCategory.ParentId).push(handbookCategory.Id); } } } diff --git a/project/src/helpers/HealthHelper.ts b/project/src/helpers/HealthHelper.ts index aa934564..f9247e8a 100644 --- a/project/src/helpers/HealthHelper.ts +++ b/project/src/helpers/HealthHelper.ts @@ -38,10 +38,7 @@ export class HealthHelper if (!profile.vitality) { // Occurs on newly created profiles - profile.vitality = { - health: null, - effects: null, - }; + profile.vitality = {health: null, effects: null}; } profile.vitality.health = { Hydration: 0, diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index 55e83f88..b6449457 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -651,13 +651,7 @@ export class HideoutHelper */ protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd { - return { - StackObjectsCount: stackCount, - Resource: { - Value: resourceValue, - UnitsConsumed: resourceUnitsConsumed, - }, - }; + return {StackObjectsCount: stackCount, Resource: {Value: resourceValue, UnitsConsumed: resourceUnitsConsumed}}; } protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void @@ -705,10 +699,7 @@ export class HideoutHelper { airFilterArea.slots[i].item[0].upd = { StackObjectsCount: 1, - Resource: { - Value: resourceValue, - UnitsConsumed: pointsConsumed, - }, + Resource: {Value: resourceValue, UnitsConsumed: pointsConsumed}, }; this.logger.debug(`Air filter: ${resourceValue} filter left on slot ${i + 1}`); break; // Break here to avoid updating all filters @@ -815,9 +806,7 @@ export class HideoutHelper btcProd.Products.push({ _id: this.hashUtil.generate(), _tpl: "59faff1d86f7746c51718c9c", - upd: { - StackObjectsCount: 1, - }, + upd: {StackObjectsCount: 1}, }); btcProd.Progress -= coinCraftTimeSeconds; @@ -896,9 +885,7 @@ export class HideoutHelper // at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki // says that it caps at level 51 with 25% but as per dump data that is incorrect apparently let roundedLevel = Math.floor(hideoutManagementSkill.Progress / 100); - roundedLevel = (roundedLevel === 51) - ? roundedLevel - 1 - : roundedLevel; + roundedLevel = (roundedLevel === 51) ? roundedLevel - 1 : roundedLevel; return (roundedLevel * this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement @@ -1023,9 +1010,7 @@ export class HideoutHelper */ protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean { - return improvement?.completed - ? true - : false; + return improvement?.completed ? true : false; } /** diff --git a/project/src/helpers/HttpServerHelper.ts b/project/src/helpers/HttpServerHelper.ts index 65b38bcc..d8f0c1e6 100644 --- a/project/src/helpers/HttpServerHelper.ts +++ b/project/src/helpers/HttpServerHelper.ts @@ -21,9 +21,7 @@ export class HttpServerHelper txt: "text/plain", }; - constructor( - @inject("ConfigServer") protected configServer: ConfigServer, - ) + constructor(@inject("ConfigServer") protected configServer: ConfigServer) { this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP); } diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index 952a134a..c5c35953 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -593,10 +593,7 @@ export class InRaidHelper } // Add these new found items to our list of inventory items - inventoryItems = [ - ...inventoryItems, - ...foundItems, - ]; + inventoryItems = [...inventoryItems, ...foundItems]; // Now find the children of these items newItems = foundItems; diff --git a/project/src/helpers/InventoryHelper.ts b/project/src/helpers/InventoryHelper.ts index 9bf19682..e94f4ba9 100644 --- a/project/src/helpers/InventoryHelper.ts +++ b/project/src/helpers/InventoryHelper.ts @@ -175,9 +175,7 @@ export class InventoryHelper catch (err) { // Callback failed - const message = typeof err === "string" - ? err - : this.localisationService.getText("http-unknown_error"); + const message = typeof err === "string" ? err : this.localisationService.getText("http-unknown_error"); return this.httpResponse.appendErrorToOutput(output, message); } @@ -299,11 +297,7 @@ export class InventoryHelper _tpl: itemLib[tmpKey]._tpl, parentId: toDo[0][1], slotId: slotID, - location: { - x: itemToAdd.location.x, - y: itemToAdd.location.y, - r: "Horizontal", - }, + location: {x: itemToAdd.location.x, y: itemToAdd.location.y, r: "Horizontal"}, upd: this.jsonUtil.clone(upd), }); @@ -312,11 +306,7 @@ export class InventoryHelper _tpl: itemLib[tmpKey]._tpl, parentId: toDo[0][1], slotId: itemLib[tmpKey].slotId, - location: { - x: itemToAdd.location.x, - y: itemToAdd.location.y, - r: "Horizontal", - }, + location: {x: itemToAdd.location.x, y: itemToAdd.location.y, r: "Horizontal"}, upd: this.jsonUtil.clone(upd), }); } @@ -405,9 +395,7 @@ export class InventoryHelper } catch (err) { - const errorText = typeof err === "string" - ? ` -> ${err}` - : ""; + const errorText = typeof err === "string" ? ` -> ${err}` : ""; this.logger.error(this.localisationService.getText("inventory-fill_container_failed", errorText)); return this.httpResponse.appendErrorToOutput( @@ -897,10 +885,7 @@ export class InventoryHelper protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash { - const inventoryItemHash: InventoryHelper.InventoryItemHash = { - byItemId: {}, - byParentId: {}, - }; + const inventoryItemHash: InventoryHelper.InventoryItemHash = {byItemId: {}, byParentId: {}}; for (const item of inventoryItem) { @@ -942,14 +927,16 @@ export class InventoryHelper const tmpSize = this.getSizeByInventoryItemHash(item._tpl, item._id, inventoryItemHash); const iW = tmpSize[0]; // x const iH = tmpSize[1]; // y - const fH = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical" - || (item.location as Location).rotation === "Vertical") - ? iW - : iH; - const fW = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical" - || (item.location as Location).rotation === "Vertical") - ? iH - : iW; + const fH = + ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical" + || (item.location as Location).rotation === "Vertical") + ? iW + : iH; + const fW = + ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical" + || (item.location as Location).rotation === "Vertical") + ? iH + : iW; const fillTo = (item.location as Location).x + fW; for (let y = 0; y < fH; y++) @@ -1002,9 +989,7 @@ export class InventoryHelper else if (request.fromOwner.type.toLocaleLowerCase() === "mail") { // Split requests dont use 'use' but 'splitItem' property - const item = "splitItem" in request - ? request.splitItem - : request.item; + const item = "splitItem" in request ? request.splitItem : request.item; fromInventoryItems = this.dialogueHelper.getMessageItemContents(request.fromOwner.id, sessionId, item); fromType = "mail"; } diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index 1c47c474..cc9731ca 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -176,9 +176,7 @@ class ItemHelper { if (item.upd === undefined) { - item.upd = { - StackObjectsCount: 1, - }; + item.upd = {StackObjectsCount: 1}; } if (item.upd.StackObjectsCount === undefined) @@ -243,9 +241,7 @@ class ItemHelper parentId: parentId, slotId: slotId, location: 0, - upd: { - StackObjectsCount: count, - }, + upd: {StackObjectsCount: count}, }; stackSlotItems.push(stackSlotItem); } @@ -473,10 +469,7 @@ class ItemHelper */ public hasBuyRestrictions(itemToCheck: Item): boolean { - if ( - itemToCheck.upd?.BuyRestrictionCurrent !== undefined - && itemToCheck.upd?.BuyRestrictionMax !== undefined - ) + if (itemToCheck.upd?.BuyRestrictionCurrent !== undefined && itemToCheck.upd?.BuyRestrictionMax !== undefined) { return true; } @@ -574,18 +567,14 @@ class ItemHelper public findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[] { // find required items to take after buying (handles multiple items) - const barterIDs = typeof barterItemId === "string" - ? [barterItemId] - : barterItemId; + const barterIDs = typeof barterItemId === "string" ? [barterItemId] : barterItemId; let barterItems: Item[] = []; for (const barterID of barterIDs) { const filterResult = items.filter((item) => { - return by === "tpl" - ? (item._tpl === barterID) - : (item._id === barterID); + return by === "tpl" ? (item._tpl === barterID) : (item._id === barterID); }); barterItems = Object.assign(barterItems, filterResult); @@ -954,9 +943,7 @@ class ItemHelper while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount) { const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount; - const cartridgeCountToAdd = (remainingSpace < maxPerStack) - ? remainingSpace - : maxPerStack; + const cartridgeCountToAdd = (remainingSpace < maxPerStack) ? remainingSpace : maxPerStack; // Add cartridge item into items array ammoBox.push(this.createCartridges(ammoBox[0]._id, cartridgeTpl, cartridgeCountToAdd, location)); @@ -1086,10 +1073,8 @@ class ItemHelper const ammoTpls = magTemplate._props.Cartridges[0]._props.filters[0].Filter; const calibers = [ ...new Set( - ammoTpls.filter( - (x: string) => this.getItem(x)[0], - ).map( - (x: string) => this.getItem(x)[1]._props.Caliber, + ammoTpls.filter((x: string) => this.getItem(x)[0]).map((x: string) => + this.getItem(x)[1]._props.Caliber ), ), ]; @@ -1107,9 +1092,7 @@ class ItemHelper const ammoArray = new ProbabilityObjectArray(this.mathUtil, this.jsonUtil); for (const icd of staticAmmoDist[caliber]) { - ammoArray.push( - new ProbabilityObject(icd.tpl, icd.relativeProbability), - ); + ammoArray.push(new ProbabilityObject(icd.tpl, icd.relativeProbability)); } return ammoArray.draw(1)[0]; } diff --git a/project/src/helpers/NotifierHelper.ts b/project/src/helpers/NotifierHelper.ts index 4f340086..fb170a45 100644 --- a/project/src/helpers/NotifierHelper.ts +++ b/project/src/helpers/NotifierHelper.ts @@ -10,14 +10,9 @@ export class NotifierHelper /** * The default notification sent when waiting times out. */ - protected defaultNotification: INotification = { - type: NotificationType.PING, - eventId: "ping", - }; + protected defaultNotification: INotification = {type: NotificationType.PING, eventId: "ping"}; - constructor( - @inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper, - ) + constructor(@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper) {} public getDefaultNotification(): INotification diff --git a/project/src/helpers/PaymentHelper.ts b/project/src/helpers/PaymentHelper.ts index a835ab31..909dceb9 100644 --- a/project/src/helpers/PaymentHelper.ts +++ b/project/src/helpers/PaymentHelper.ts @@ -10,9 +10,7 @@ export class PaymentHelper { protected inventoryConfig: IInventoryConfig; - constructor( - @inject("ConfigServer") protected configServer: ConfigServer, - ) + constructor(@inject("ConfigServer") protected configServer: ConfigServer) { this.inventoryConfig = this.configServer.getConfig(ConfigTypes.INVENTORY); } diff --git a/project/src/helpers/PresetHelper.ts b/project/src/helpers/PresetHelper.ts index c973fd98..cfefb0bd 100644 --- a/project/src/helpers/PresetHelper.ts +++ b/project/src/helpers/PresetHelper.ts @@ -25,13 +25,13 @@ export class PresetHelper { if (!this.defaultPresets) { - this.defaultPresets = Object.values(this.databaseServer.getTables().globals.ItemPresets) - .filter((x) => x._encyclopedia !== undefined) - .reduce((acc, cur) => - { - acc[cur._id] = cur; - return acc; - }, {}); + this.defaultPresets = Object.values(this.databaseServer.getTables().globals.ItemPresets).filter((x) => + x._encyclopedia !== undefined + ).reduce((acc, cur) => + { + acc[cur._id] = cur; + return acc; + }, {}); } return this.defaultPresets; diff --git a/project/src/helpers/ProfileHelper.ts b/project/src/helpers/ProfileHelper.ts index 95ebea98..120b65d9 100644 --- a/project/src/helpers/ProfileHelper.ts +++ b/project/src/helpers/ProfileHelper.ts @@ -217,9 +217,7 @@ export class ProfileHelper public getDefaultAkiDataObject(): any { - return { - version: this.getServerVersion(), - }; + return {version: this.getServerVersion()}; } public getFullProfile(sessionID: string): IAkiProfile @@ -257,11 +255,7 @@ export class ProfileHelper return { Eft: { CarriedQuestItems: [], - DamageHistory: { - LethalDamagePart: "Head", - LethalDamage: undefined, - BodyParts: [], - }, + DamageHistory: {LethalDamagePart: "Head", LethalDamage: undefined, BodyParts: []}, DroppedItems: [], ExperienceBonusMult: 0, FoundInRaidItems: [], diff --git a/project/src/helpers/QuestHelper.ts b/project/src/helpers/QuestHelper.ts index 4af49a8f..30d9ebfa 100644 --- a/project/src/helpers/QuestHelper.ts +++ b/project/src/helpers/QuestHelper.ts @@ -69,9 +69,7 @@ export class QuestHelper { const quest = pmcData.Quests?.find((q) => q.qid === questId); - return quest - ? quest.status - : QuestStatus.Locked; + return quest ? quest.status : QuestStatus.Locked; } /** @@ -328,12 +326,9 @@ export class QuestHelper public getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[] { // Iterate over all rewards with the desired status, flatten out items that have a type of Item - const questRewards = quest.rewards[QuestStatus[status]] - .flatMap((reward: Reward) => - reward.type === "Item" - ? this.processReward(reward) - : [] - ); + const questRewards = quest.rewards[QuestStatus[status]].flatMap((reward: Reward) => + reward.type === "Item" ? this.processReward(reward) : [] + ); return questRewards; } @@ -467,14 +462,12 @@ export class QuestHelper const quests = this.getQuestsFromDb().filter((q) => { - const acceptedQuestCondition = q.conditions.AvailableForStart.find( - (c) => - { - return c._parent === "Quest" - && c._props.target === failedQuestId - && c._props.status[0] === QuestStatus.Fail; - }, - ); + const acceptedQuestCondition = q.conditions.AvailableForStart.find((c) => + { + return c._parent === "Quest" + && c._props.target === failedQuestId + && c._props.status[0] === QuestStatus.Fail; + }); if (!acceptedQuestCondition) { @@ -581,9 +574,7 @@ export class QuestHelper parentId: item.parentId, slotId: item.slotId, location: item.location, - upd: { - StackObjectsCount: item.upd.StackObjectsCount, - }, + upd: {StackObjectsCount: item.upd.StackObjectsCount}, }); } diff --git a/project/src/helpers/RagfairHelper.ts b/project/src/helpers/RagfairHelper.ts index 3f8f9d39..105cecfb 100644 --- a/project/src/helpers/RagfairHelper.ts +++ b/project/src/helpers/RagfairHelper.ts @@ -73,9 +73,7 @@ export class RagfairHelper if (info.linkedSearchId) { const data = this.ragfairLinkedItemService.getLinkedItems(info.linkedSearchId); - result = !data - ? [] - : [...data]; + result = !data ? [] : [...data]; } // Case: category diff --git a/project/src/helpers/RagfairSellHelper.ts b/project/src/helpers/RagfairSellHelper.ts index 5804df65..5f5d174f 100644 --- a/project/src/helpers/RagfairSellHelper.ts +++ b/project/src/helpers/RagfairSellHelper.ts @@ -61,9 +61,7 @@ export class RagfairSellHelper playerListedPriceRub: number, ): number { - return (playerListedPriceRub < averageOfferPriceRub) - ? this.ragfairConfig.sell.chance.underpriced - : 1; + return (playerListedPriceRub < averageOfferPriceRub) ? this.ragfairConfig.sell.chance.underpriced : 1; } /** @@ -114,10 +112,7 @@ export class RagfairSellHelper this.ragfairConfig.sell.time.min * 60, ); - result.push({ - sellTime: sellTime, - amount: boughtAmount, - }); + result.push({sellTime: sellTime, amount: boughtAmount}); this.logger.debug(`Offer will sell at: ${new Date(sellTime * 1000).toLocaleTimeString("en-US")}`); } diff --git a/project/src/helpers/RagfairSortHelper.ts b/project/src/helpers/RagfairSortHelper.ts index afbfcc5b..edb06fa4 100644 --- a/project/src/helpers/RagfairSortHelper.ts +++ b/project/src/helpers/RagfairSortHelper.ts @@ -75,11 +75,7 @@ export class RagfairSortHelper const nameA = locale[`${tplA} Name`] || tplA; const nameB = locale[`${tplB} Name`] || tplB; - return (nameA < nameB) - ? -1 - : (nameA > nameB) - ? 1 - : 0; + return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0; } /** diff --git a/project/src/helpers/RepairHelper.ts b/project/src/helpers/RepairHelper.ts index 6aa88118..2b0e48f9 100644 --- a/project/src/helpers/RepairHelper.ts +++ b/project/src/helpers/RepairHelper.ts @@ -68,10 +68,7 @@ export class RepairHelper } // Construct object to return - itemToRepair.upd.Repairable = { - Durability: newCurrentDurability, - MaxDurability: newCurrentMaxDurability, - }; + itemToRepair.upd.Repairable = {Durability: newCurrentDurability, MaxDurability: newCurrentMaxDurability}; // when modders set the repair coefficient to 0 it means that they dont want to lose durability on items // the code below generates a random degradation on the weapon durability @@ -138,12 +135,8 @@ export class RepairHelper traderQualityMultipler: number, ): number { - const minRepairDeg = isRepairKit - ? itemProps.MinRepairKitDegradation - : itemProps.MinRepairDegradation; - let maxRepairDeg = isRepairKit - ? itemProps.MaxRepairKitDegradation - : itemProps.MaxRepairDegradation; + const minRepairDeg = isRepairKit ? itemProps.MinRepairKitDegradation : itemProps.MinRepairDegradation; + let maxRepairDeg = isRepairKit ? itemProps.MaxRepairKitDegradation : itemProps.MaxRepairDegradation; // WORKAROUND: Some items are always 0 when repairkit is true if (maxRepairDeg === 0) diff --git a/project/src/helpers/SecureContainerHelper.ts b/project/src/helpers/SecureContainerHelper.ts index a62f51b1..a8dd36af 100644 --- a/project/src/helpers/SecureContainerHelper.ts +++ b/project/src/helpers/SecureContainerHelper.ts @@ -14,9 +14,7 @@ export interface OwnerInventoryItems @injectable() export class SecureContainerHelper { - constructor( - @inject("ItemHelper") protected itemHelper: ItemHelper, - ) + constructor(@inject("ItemHelper") protected itemHelper: ItemHelper) {} public getSecureContainerItems(items: Item[]): string[] diff --git a/project/src/helpers/TradeHelper.ts b/project/src/helpers/TradeHelper.ts index c4b0d3c1..11750a18 100644 --- a/project/src/helpers/TradeHelper.ts +++ b/project/src/helpers/TradeHelper.ts @@ -60,13 +60,11 @@ export class TradeHelper let output = this.eventOutputHolder.getOutput(sessionID); const newReq = { - items: [ - { - // eslint-disable-next-line @typescript-eslint/naming-convention - item_id: buyRequestData.item_id, - count: buyRequestData.count, - }, - ], + items: [{ + // eslint-disable-next-line @typescript-eslint/naming-convention + item_id: buyRequestData.item_id, + count: buyRequestData.count, + }], tid: buyRequestData.tid, }; diff --git a/project/src/helpers/TraderAssortHelper.ts b/project/src/helpers/TraderAssortHelper.ts index 535d48e6..3ee329fc 100644 --- a/project/src/helpers/TraderAssortHelper.ts +++ b/project/src/helpers/TraderAssortHelper.ts @@ -26,11 +26,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export class TraderAssortHelper { protected traderConfig: ITraderConfig; - protected mergedQuestAssorts: Record> = { - started: {}, - success: {}, - fail: {}, - }; + protected mergedQuestAssorts: Record> = {started: {}, success: {}, fail: {}}; protected createdMergedQuestAssorts = false; constructor( diff --git a/project/src/helpers/TraderHelper.ts b/project/src/helpers/TraderHelper.ts index 7f0af7d8..aaae8ecd 100644 --- a/project/src/helpers/TraderHelper.ts +++ b/project/src/helpers/TraderHelper.ts @@ -199,9 +199,7 @@ export class TraderHelper { const newStanding = currentStanding + standingToAdd; - return newStanding < 0 - ? 0 - : newStanding; + return newStanding < 0 ? 0 : newStanding; } /** @@ -229,8 +227,7 @@ export class TraderHelper if ( (loyalty.minLevel <= pmcData.Info.Level && loyalty.minSalesSum <= pmcData.TradersInfo[traderID].salesSum - && loyalty.minStanding <= pmcData.TradersInfo[traderID].standing) - && targetLevel < 4 + && loyalty.minStanding <= pmcData.TradersInfo[traderID].standing) && targetLevel < 4 ) { // level reached @@ -271,10 +268,7 @@ export class TraderHelper }), ); this.traderConfig.updateTime.push( // create temporary entry to prevent logger spam - { - traderId: traderId, - seconds: this.traderConfig.updateTimeDefault, - }, + {traderId: traderId, seconds: this.traderConfig.updateTimeDefault}, ); } else diff --git a/project/src/helpers/WeightedRandomHelper.ts b/project/src/helpers/WeightedRandomHelper.ts index 5b6178a4..7e66a3e0 100644 --- a/project/src/helpers/WeightedRandomHelper.ts +++ b/project/src/helpers/WeightedRandomHelper.ts @@ -77,10 +77,7 @@ export class WeightedRandomHelper { if (cumulativeWeights[itemIndex] >= randomNumber) { - return { - item: items[itemIndex], - index: itemIndex, - }; + return {item: items[itemIndex], index: itemIndex}; } } } diff --git a/project/src/models/external/HttpFramework.ts b/project/src/models/external/HttpFramework.ts index 8c3d0326..ffc28468 100644 --- a/project/src/models/external/HttpFramework.ts +++ b/project/src/models/external/HttpFramework.ts @@ -111,11 +111,7 @@ const createHttpDecorator = (httpMethod: HttpMethods) => } // Flag the method as a HTTP handler - target.handlers.push({ - handlerName: propertyKey, - path, - httpMethod, - }); + target.handlers.push({handlerName: propertyKey, path, httpMethod}); }; }; }; diff --git a/project/src/models/spt/server/IDatabaseTables.ts b/project/src/models/spt/server/IDatabaseTables.ts index 140bd1d6..73ce43ed 100644 --- a/project/src/models/spt/server/IDatabaseTables.ts +++ b/project/src/models/spt/server/IDatabaseTables.ts @@ -24,11 +24,7 @@ import { ISettingsBase } from "@spt-aki/models/spt/server/ISettingsBase"; export interface IDatabaseTables { - bots?: { - types: Record; - base: IBotBase; - core: IBotCore; - }; + bots?: {types: Record; base: IBotBase; core: IBotCore;}; hideout?: { areas: IHideoutArea[]; production: IHideoutProduction[]; diff --git a/project/src/routers/EventOutputHolder.ts b/project/src/routers/EventOutputHolder.ts index b020371d..dca76e78 100644 --- a/project/src/routers/EventOutputHolder.ts +++ b/project/src/routers/EventOutputHolder.ts @@ -22,10 +22,7 @@ export class EventOutputHolder {} // TODO REMEMBER TO CHANGE OUTPUT - protected output: IItemEventRouterResponse = { - warnings: [], - profileChanges: {}, - }; + protected output: IItemEventRouterResponse = {warnings: [], profileChanges: {}}; public getOutput(sessionID: string): IItemEventRouterResponse { @@ -54,18 +51,10 @@ export class EventOutputHolder ragFairOffers: [], weaponBuilds: [], equipmentBuilds: [], - items: { - new: [], - change: [], - del: [], - }, + items: {new: [], change: [], del: []}, production: {}, improvements: {}, - skills: { - Common: [], - Mastering: [], - Points: 0, - }, + skills: {Common: [], Mastering: [], Points: 0}, health: this.jsonUtil.clone(pmcData.Health), traderRelations: {}, // changedHideoutStashes: {}, diff --git a/project/src/routers/HttpRouter.ts b/project/src/routers/HttpRouter.ts index 620c53d3..a507f3c8 100644 --- a/project/src/routers/HttpRouter.ts +++ b/project/src/routers/HttpRouter.ts @@ -87,8 +87,6 @@ export class HttpRouter class ResponseWrapper { - constructor( - public output: string, - ) + constructor(public output: string) {} } diff --git a/project/src/routers/dynamic/BotDynamicRouter.ts b/project/src/routers/dynamic/BotDynamicRouter.ts index 6f374792..df65c79b 100644 --- a/project/src/routers/dynamic/BotDynamicRouter.ts +++ b/project/src/routers/dynamic/BotDynamicRouter.ts @@ -6,41 +6,37 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class BotDynamicRouter extends DynamicRouter { - constructor( - @inject("BotCallbacks") protected botCallbacks: BotCallbacks, - ) + constructor(@inject("BotCallbacks") protected botCallbacks: BotCallbacks) { - super( - [ - new RouteAction( - "/singleplayer/settings/bot/limit/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.botCallbacks.getBotLimit(url, info, sessionID); - }, - ), - new RouteAction( - "/singleplayer/settings/bot/difficulty/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.botCallbacks.getBotDifficulty(url, info, sessionID); - }, - ), - new RouteAction( - "/singleplayer/settings/bot/maxCap", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.botCallbacks.getBotCap(); - }, - ), - new RouteAction( - "/singleplayer/settings/bot/getBotBehaviours/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.botCallbacks.getBotBehaviours(); - }, - ), - ], - ); + super([ + new RouteAction( + "/singleplayer/settings/bot/limit/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.botCallbacks.getBotLimit(url, info, sessionID); + }, + ), + new RouteAction( + "/singleplayer/settings/bot/difficulty/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.botCallbacks.getBotDifficulty(url, info, sessionID); + }, + ), + new RouteAction( + "/singleplayer/settings/bot/maxCap", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.botCallbacks.getBotCap(); + }, + ), + new RouteAction( + "/singleplayer/settings/bot/getBotBehaviours/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.botCallbacks.getBotBehaviours(); + }, + ), + ]); } } diff --git a/project/src/routers/dynamic/BundleDynamicRouter.ts b/project/src/routers/dynamic/BundleDynamicRouter.ts index c365c98d..929eba50 100644 --- a/project/src/routers/dynamic/BundleDynamicRouter.ts +++ b/project/src/routers/dynamic/BundleDynamicRouter.ts @@ -6,20 +6,13 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class BundleDynamicRouter extends DynamicRouter { - constructor( - @inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks, - ) + constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks) { - super( - [ - new RouteAction( - ".bundle", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.bundleCallbacks.getBundle(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction(".bundle", (url: string, info: any, sessionID: string, output: string): any => + { + return this.bundleCallbacks.getBundle(url, info, sessionID); + }), + ]); } } diff --git a/project/src/routers/dynamic/CustomizationDynamicRouter.ts b/project/src/routers/dynamic/CustomizationDynamicRouter.ts index 75e8d516..1a146349 100644 --- a/project/src/routers/dynamic/CustomizationDynamicRouter.ts +++ b/project/src/routers/dynamic/CustomizationDynamicRouter.ts @@ -6,20 +6,16 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class CustomizationDynamicRouter extends DynamicRouter { - constructor( - @inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks, - ) + constructor(@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks) { - super( - [ - new RouteAction( - "/client/trading/customization/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.customizationCallbacks.getTraderSuits(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/trading/customization/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.customizationCallbacks.getTraderSuits(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/dynamic/DataDynamicRouter.ts b/project/src/routers/dynamic/DataDynamicRouter.ts index 9f364c17..82ab4860 100644 --- a/project/src/routers/dynamic/DataDynamicRouter.ts +++ b/project/src/routers/dynamic/DataDynamicRouter.ts @@ -6,34 +6,21 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class DataDynamicRouter extends DynamicRouter { - constructor( - @inject("DataCallbacks") protected dataCallbacks: DataCallbacks, - ) + constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks) { - super( - [ - 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 => - { - return this.dataCallbacks.getLocalesGlobal(url, info, sessionID); - }, - ), - new RouteAction( - "/client/items/prices/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dataCallbacks.getItemPrices(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.dataCallbacks.getLocalesGlobal(url, info, sessionID); + }), + new RouteAction("/client/items/prices/", (url: string, info: any, sessionID: string, output: string): any => + { + return this.dataCallbacks.getItemPrices(url, info, sessionID); + }), + ]); } } diff --git a/project/src/routers/dynamic/HttpDynamicRouter.ts b/project/src/routers/dynamic/HttpDynamicRouter.ts index 4fd9357e..c7e677ec 100644 --- a/project/src/routers/dynamic/HttpDynamicRouter.ts +++ b/project/src/routers/dynamic/HttpDynamicRouter.ts @@ -6,34 +6,21 @@ import { ImageRouter } from "@spt-aki/routers/ImageRouter"; @injectable() export class HttpDynamicRouter extends DynamicRouter { - constructor( - @inject("ImageRouter") protected imageRouter: ImageRouter, - ) + constructor(@inject("ImageRouter") protected imageRouter: ImageRouter) { - super( - [ - 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 => - { - return this.imageRouter.getImage(); - }, - ), - new RouteAction( - ".ico", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.imageRouter.getImage(); - }, - ), - ], - ); + super([ + 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 => + { + return this.imageRouter.getImage(); + }), + new RouteAction(".ico", (url: string, info: any, sessionID: string, output: string): any => + { + return this.imageRouter.getImage(); + }), + ]); } } diff --git a/project/src/routers/dynamic/InraidDynamicRouter.ts b/project/src/routers/dynamic/InraidDynamicRouter.ts index f8e1a9c2..72ccea1d 100644 --- a/project/src/routers/dynamic/InraidDynamicRouter.ts +++ b/project/src/routers/dynamic/InraidDynamicRouter.ts @@ -6,21 +6,17 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class InraidDynamicRouter extends DynamicRouter { - constructor( - @inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks, - ) + constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks) { - super( - [ - new RouteAction( - "/client/location/getLocalloot", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.inraidCallbacks.registerPlayer(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/location/getLocalloot", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.inraidCallbacks.registerPlayer(url, info, sessionID); + }, + ), + ]); } public override getTopLevelRoute(): string diff --git a/project/src/routers/dynamic/LocationDynamicRouter.ts b/project/src/routers/dynamic/LocationDynamicRouter.ts index 798ece9d..76eaa6ba 100644 --- a/project/src/routers/dynamic/LocationDynamicRouter.ts +++ b/project/src/routers/dynamic/LocationDynamicRouter.ts @@ -6,21 +6,17 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class LocationDynamicRouter extends DynamicRouter { - constructor( - @inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks, - ) + constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks) { - super( - [ - new RouteAction( - "/client/location/getLocalloot", - (url: string, info: any, sessionID: string, _output: string): any => - { - return this.locationCallbacks.getLocation(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/location/getLocalloot", + (url: string, info: any, sessionID: string, _output: string): any => + { + return this.locationCallbacks.getLocation(url, info, sessionID); + }, + ), + ]); } public override getTopLevelRoute(): string diff --git a/project/src/routers/dynamic/NotifierDynamicRouter.ts b/project/src/routers/dynamic/NotifierDynamicRouter.ts index 261c2a20..cf8c86b8 100644 --- a/project/src/routers/dynamic/NotifierDynamicRouter.ts +++ b/project/src/routers/dynamic/NotifierDynamicRouter.ts @@ -6,41 +6,28 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class NotifierDynamicRouter extends DynamicRouter { - constructor( - @inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks, - ) + constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks) { - super( - [ - 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 => - { - return this.notifierCallbacks.notify(url, info, sessionID); - }, - ), - new RouteAction( - "/push/notifier/get/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.notifierCallbacks.getNotifier(url, info, sessionID); - }, - ), - new RouteAction( - "/push/notifier/getwebsocket/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.notifierCallbacks.getNotifier(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.notifierCallbacks.notify(url, info, sessionID); + }), + new RouteAction("/push/notifier/get/", (url: string, info: any, sessionID: string, output: string): any => + { + return this.notifierCallbacks.getNotifier(url, info, sessionID); + }), + new RouteAction( + "/push/notifier/getwebsocket/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.notifierCallbacks.getNotifier(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/dynamic/TraderDynamicRouter.ts b/project/src/routers/dynamic/TraderDynamicRouter.ts index f8f821a4..b5c92eed 100644 --- a/project/src/routers/dynamic/TraderDynamicRouter.ts +++ b/project/src/routers/dynamic/TraderDynamicRouter.ts @@ -6,27 +6,23 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; @injectable() export class TraderDynamicRouter extends DynamicRouter { - constructor( - @inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks, - ) + constructor(@inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks) { - super( - [ - new RouteAction( - "/client/trading/api/getTrader/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.traderCallbacks.getTrader(url, info, sessionID); - }, - ), - new RouteAction( - "/client/trading/api/getTraderAssort/", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.traderCallbacks.getAssort(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/trading/api/getTrader/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.traderCallbacks.getTrader(url, info, sessionID); + }, + ), + new RouteAction( + "/client/trading/api/getTraderAssort/", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.traderCallbacks.getAssort(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/item_events/CustomizationItemEventRouter.ts b/project/src/routers/item_events/CustomizationItemEventRouter.ts index b6a6dc1e..f944fed4 100644 --- a/project/src/routers/item_events/CustomizationItemEventRouter.ts +++ b/project/src/routers/item_events/CustomizationItemEventRouter.ts @@ -17,10 +17,7 @@ export class CustomizationItemEventRouter extends ItemEventRouterDefinition public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("CustomizationWear", false), - new HandledRoute("CustomizationBuy", false), - ]; + return [new HandledRoute("CustomizationWear", false), new HandledRoute("CustomizationBuy", false)]; } public override handleItemEvent( diff --git a/project/src/routers/item_events/HideoutItemEventRouter.ts b/project/src/routers/item_events/HideoutItemEventRouter.ts index b4a6d3f2..4fba95f4 100644 --- a/project/src/routers/item_events/HideoutItemEventRouter.ts +++ b/project/src/routers/item_events/HideoutItemEventRouter.ts @@ -9,9 +9,7 @@ import { HideoutEventActions } from "@spt-aki/models/enums/HideoutEventActions"; @injectable() export class HideoutItemEventRouter extends ItemEventRouterDefinition { - constructor( - @inject("HideoutCallbacks") protected hideoutCallbacks: HideoutCallbacks, - ) + constructor(@inject("HideoutCallbacks") protected hideoutCallbacks: HideoutCallbacks) { super(); } diff --git a/project/src/routers/item_events/InsuranceItemEventRouter.ts b/project/src/routers/item_events/InsuranceItemEventRouter.ts index b2849336..087d8145 100644 --- a/project/src/routers/item_events/InsuranceItemEventRouter.ts +++ b/project/src/routers/item_events/InsuranceItemEventRouter.ts @@ -17,9 +17,7 @@ export class InsuranceItemEventRouter extends ItemEventRouterDefinition public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("Insure", false), - ]; + return [new HandledRoute("Insure", false)]; } public override handleItemEvent( diff --git a/project/src/routers/item_events/PresetBuildItemEventRouter.ts b/project/src/routers/item_events/PresetBuildItemEventRouter.ts index 07e8ee2f..577464e0 100644 --- a/project/src/routers/item_events/PresetBuildItemEventRouter.ts +++ b/project/src/routers/item_events/PresetBuildItemEventRouter.ts @@ -9,9 +9,7 @@ import { ItemEventActions } from "@spt-aki/models/enums/ItemEventActions"; @injectable() export class PresetBuildItemEventRouter extends ItemEventRouterDefinition { - constructor( - @inject("PresetBuildCallbacks") protected presetBuildCallbacks: PresetBuildCallbacks, - ) + constructor(@inject("PresetBuildCallbacks") protected presetBuildCallbacks: PresetBuildCallbacks) { super(); } diff --git a/project/src/routers/item_events/RagfairItemEventRouter.ts b/project/src/routers/item_events/RagfairItemEventRouter.ts index fb0d0fb8..ae65e463 100644 --- a/project/src/routers/item_events/RagfairItemEventRouter.ts +++ b/project/src/routers/item_events/RagfairItemEventRouter.ts @@ -8,9 +8,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve @injectable() export class RagfairItemEventRouter extends ItemEventRouterDefinition { - constructor( - @inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks, - ) + constructor(@inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks) { super(); } diff --git a/project/src/routers/item_events/RepairItemEventRouter.ts b/project/src/routers/item_events/RepairItemEventRouter.ts index 608760f7..af906ef2 100644 --- a/project/src/routers/item_events/RepairItemEventRouter.ts +++ b/project/src/routers/item_events/RepairItemEventRouter.ts @@ -8,19 +8,14 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve @injectable() export class RepairItemEventRouter extends ItemEventRouterDefinition { - constructor( - @inject("RepairCallbacks") protected repairCallbacks: RepairCallbacks, - ) + constructor(@inject("RepairCallbacks") protected repairCallbacks: RepairCallbacks) { super(); } public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("Repair", false), - new HandledRoute("TraderRepair", false), - ]; + return [new HandledRoute("Repair", false), new HandledRoute("TraderRepair", false)]; } public override handleItemEvent( diff --git a/project/src/routers/item_events/TradeItemEventRouter.ts b/project/src/routers/item_events/TradeItemEventRouter.ts index b4db5dc0..c36ba60f 100644 --- a/project/src/routers/item_events/TradeItemEventRouter.ts +++ b/project/src/routers/item_events/TradeItemEventRouter.ts @@ -8,9 +8,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve @injectable() export class TradeItemEventRouter extends ItemEventRouterDefinition { - constructor( - @inject("TradeCallbacks") protected tradeCallbacks: TradeCallbacks, - ) + constructor(@inject("TradeCallbacks") protected tradeCallbacks: TradeCallbacks) { super(); } diff --git a/project/src/routers/item_events/WishlistItemEventRouter.ts b/project/src/routers/item_events/WishlistItemEventRouter.ts index b1132edb..dd15eae4 100644 --- a/project/src/routers/item_events/WishlistItemEventRouter.ts +++ b/project/src/routers/item_events/WishlistItemEventRouter.ts @@ -8,19 +8,14 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve @injectable() export class WishlistItemEventRouter extends ItemEventRouterDefinition { - constructor( - @inject("WishlistCallbacks") protected wishlistCallbacks: WishlistCallbacks, - ) + constructor(@inject("WishlistCallbacks") protected wishlistCallbacks: WishlistCallbacks) { super(); } public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("AddToWishList", false), - new HandledRoute("RemoveFromWishList", false), - ]; + return [new HandledRoute("AddToWishList", false), new HandledRoute("RemoveFromWishList", false)]; } public override handleItemEvent( diff --git a/project/src/routers/save_load/HealthSaveLoadRouter.ts b/project/src/routers/save_load/HealthSaveLoadRouter.ts index b41bb39e..343490d2 100644 --- a/project/src/routers/save_load/HealthSaveLoadRouter.ts +++ b/project/src/routers/save_load/HealthSaveLoadRouter.ts @@ -8,19 +8,14 @@ export class HealthSaveLoadRouter extends SaveLoadRouter { public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("aki-health", false), - ]; + return [new HandledRoute("aki-health", false)]; } public override handleLoad(profile: IAkiProfile): IAkiProfile { if (!profile.vitality) { // Occurs on newly created profiles - profile.vitality = { - health: null, - effects: null, - }; + profile.vitality = {health: null, effects: null}; } profile.vitality.health = { Hydration: 0, diff --git a/project/src/routers/save_load/InraidSaveLoadRouter.ts b/project/src/routers/save_load/InraidSaveLoadRouter.ts index 3f9b6ab7..bea4532f 100644 --- a/project/src/routers/save_load/InraidSaveLoadRouter.ts +++ b/project/src/routers/save_load/InraidSaveLoadRouter.ts @@ -8,19 +8,14 @@ export class InraidSaveLoadRouter extends SaveLoadRouter { public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("aki-inraid", false), - ]; + return [new HandledRoute("aki-inraid", false)]; } public override handleLoad(profile: IAkiProfile): IAkiProfile { if (profile.inraid === undefined) { - profile.inraid = { - location: "none", - character: "none", - }; + profile.inraid = {location: "none", character: "none"}; } return profile; diff --git a/project/src/routers/save_load/InsuranceSaveLoadRouter.ts b/project/src/routers/save_load/InsuranceSaveLoadRouter.ts index 82264828..433b8a49 100644 --- a/project/src/routers/save_load/InsuranceSaveLoadRouter.ts +++ b/project/src/routers/save_load/InsuranceSaveLoadRouter.ts @@ -8,9 +8,7 @@ export class InsuranceSaveLoadRouter extends SaveLoadRouter { public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("aki-insurance", false), - ]; + return [new HandledRoute("aki-insurance", false)]; } public override handleLoad(profile: IAkiProfile): IAkiProfile diff --git a/project/src/routers/save_load/ProfileSaveLoadRouter.ts b/project/src/routers/save_load/ProfileSaveLoadRouter.ts index 87348102..bab47117 100644 --- a/project/src/routers/save_load/ProfileSaveLoadRouter.ts +++ b/project/src/routers/save_load/ProfileSaveLoadRouter.ts @@ -9,19 +9,14 @@ export class ProfileSaveLoadRouter extends SaveLoadRouter { public override getHandledRoutes(): HandledRoute[] { - return [ - new HandledRoute("aki-profile", false), - ]; + return [new HandledRoute("aki-profile", false)]; } public override handleLoad(profile: IAkiProfile): IAkiProfile { if (profile.characters === null) { - profile.characters = { - pmc: {} as IPmcData, - scav: {} as IPmcData, - }; + profile.characters = {pmc: {} as IPmcData, scav: {} as IPmcData}; } return profile; } diff --git a/project/src/routers/serializers/ImageSerializer.ts b/project/src/routers/serializers/ImageSerializer.ts index af220c0a..90a0ccec 100644 --- a/project/src/routers/serializers/ImageSerializer.ts +++ b/project/src/routers/serializers/ImageSerializer.ts @@ -7,9 +7,7 @@ import { ImageRouter } from "@spt-aki/routers/ImageRouter"; @injectable() export class ImageSerializer extends Serializer { - constructor( - @inject("ImageRouter") protected imageRouter: ImageRouter, - ) + constructor(@inject("ImageRouter") protected imageRouter: ImageRouter) { super(); } diff --git a/project/src/routers/serializers/NotifySerializer.ts b/project/src/routers/serializers/NotifySerializer.ts index 2cc1975d..5ff48468 100644 --- a/project/src/routers/serializers/NotifySerializer.ts +++ b/project/src/routers/serializers/NotifySerializer.ts @@ -27,9 +27,9 @@ export class NotifySerializer extends Serializer * Take our array of JSON message objects and cast them to JSON strings, so that they can then * be sent to client as NEWLINE separated strings... yup. */ - this.notifierController.notifyAsync(tmpSessionID) - .then((messages: any) => messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n")) - .then((text) => this.httpServerHelper.sendTextJson(resp, text)); + this.notifierController.notifyAsync(tmpSessionID).then((messages: any) => + messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n") + ).then((text) => this.httpServerHelper.sendTextJson(resp, text)); } public override canHandle(route: string): boolean diff --git a/project/src/routers/static/BotStaticRouter.ts b/project/src/routers/static/BotStaticRouter.ts index c4efff6c..4a1968e5 100644 --- a/project/src/routers/static/BotStaticRouter.ts +++ b/project/src/routers/static/BotStaticRouter.ts @@ -6,20 +6,16 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class BotStaticRouter extends StaticRouter { - constructor( - @inject("BotCallbacks") protected botCallbacks: BotCallbacks, - ) + constructor(@inject("BotCallbacks") protected botCallbacks: BotCallbacks) { - super( - [ - new RouteAction( - "/client/game/bot/generate", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.botCallbacks.generateBots(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/game/bot/generate", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.botCallbacks.generateBots(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/BundleStaticRouter.ts b/project/src/routers/static/BundleStaticRouter.ts index b269a36e..a982835c 100644 --- a/project/src/routers/static/BundleStaticRouter.ts +++ b/project/src/routers/static/BundleStaticRouter.ts @@ -6,20 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class BundleStaticRouter extends StaticRouter { - constructor( - @inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks, - ) + constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks) { - super( - [ - new RouteAction( - "/singleplayer/bundles", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.bundleCallbacks.getBundles(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction("/singleplayer/bundles", (url: string, info: any, sessionID: string, output: string): any => + { + return this.bundleCallbacks.getBundles(url, info, sessionID); + }), + ]); } } diff --git a/project/src/routers/static/ClientLogStaticRouter.ts b/project/src/routers/static/ClientLogStaticRouter.ts index 3844d2f0..4c183531 100644 --- a/project/src/routers/static/ClientLogStaticRouter.ts +++ b/project/src/routers/static/ClientLogStaticRouter.ts @@ -6,20 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class ClientLogStaticRouter extends StaticRouter { - constructor( - @inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks, - ) + constructor(@inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks) { - super( - [ - new RouteAction( - "/singleplayer/log", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.clientLogCallbacks.clientLog(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction("/singleplayer/log", (url: string, info: any, sessionID: string, output: string): any => + { + return this.clientLogCallbacks.clientLog(url, info, sessionID); + }), + ]); } } diff --git a/project/src/routers/static/CustomizationStaticRouter.ts b/project/src/routers/static/CustomizationStaticRouter.ts index 94392ab9..c2fe4b29 100644 --- a/project/src/routers/static/CustomizationStaticRouter.ts +++ b/project/src/routers/static/CustomizationStaticRouter.ts @@ -6,20 +6,16 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class CustomizationStaticRouter extends StaticRouter { - constructor( - @inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks, - ) + constructor(@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks) { - super( - [ - new RouteAction( - "/client/trading/customization/storage", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.customizationCallbacks.getSuits(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/trading/customization/storage", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.customizationCallbacks.getSuits(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/DataStaticRouter.ts b/project/src/routers/static/DataStaticRouter.ts index 22360c59..cbb7e7a0 100644 --- a/project/src/routers/static/DataStaticRouter.ts +++ b/project/src/routers/static/DataStaticRouter.ts @@ -6,97 +6,75 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class DataStaticRouter extends StaticRouter { - constructor( - @inject("DataCallbacks") protected dataCallbacks: DataCallbacks, - ) + constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks) { - super( - [ - 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 => - { - return this.dataCallbacks.getGlobals(url, info, sessionID); - }, - ), - new RouteAction( - "/client/items", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dataCallbacks.getTemplateItems(url, info, sessionID); - }, - ), - new RouteAction( - "/client/handbook/templates", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dataCallbacks.getTemplateHandbook(url, info, sessionID); - }, - ), - 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 => - { - return this.dataCallbacks.getTemplateCharacter(url, info, sessionID); - }, - ), - new RouteAction( - "/client/hideout/production/recipes", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dataCallbacks.gethideoutProduction(url, info, sessionID); - }, - ), - new RouteAction( - "/client/hideout/settings", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dataCallbacks.getHideoutSettings(url, info, sessionID); - }, - ), - 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 => - { - return this.dataCallbacks.getHideoutScavcase(url, info, sessionID); - }, - ), - new RouteAction( - "/client/languages", - (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 => - { - return this.dataCallbacks.getQteList(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.dataCallbacks.getGlobals(url, info, sessionID); + }), + new RouteAction("/client/items", (url: string, info: any, sessionID: string, output: string): any => + { + return this.dataCallbacks.getTemplateItems(url, info, sessionID); + }), + new RouteAction( + "/client/handbook/templates", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dataCallbacks.getTemplateHandbook(url, info, sessionID); + }, + ), + 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 => + { + return this.dataCallbacks.getTemplateCharacter(url, info, sessionID); + }, + ), + new RouteAction( + "/client/hideout/production/recipes", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dataCallbacks.gethideoutProduction(url, info, sessionID); + }, + ), + new RouteAction( + "/client/hideout/settings", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dataCallbacks.getHideoutSettings(url, info, sessionID); + }, + ), + 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 => + { + return this.dataCallbacks.getHideoutScavcase(url, info, sessionID); + }, + ), + new RouteAction("/client/languages", (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 => + { + return this.dataCallbacks.getQteList(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/DialogStaticRouter.ts b/project/src/routers/static/DialogStaticRouter.ts index 2bee28c2..a22acc6d 100644 --- a/project/src/routers/static/DialogStaticRouter.ts +++ b/project/src/routers/static/DialogStaticRouter.ts @@ -6,160 +6,147 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class DialogStaticRouter extends StaticRouter { - constructor( - @inject("DialogueCallbacks") protected dialogueCallbacks: DialogueCallbacks, - ) + constructor(@inject("DialogueCallbacks") protected dialogueCallbacks: DialogueCallbacks) { - super( - [ - new RouteAction( - "/client/chatServer/list", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.getChatServerList(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/list", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.getMailDialogList(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/view", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.getMailDialogView(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/info", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.getMailDialogInfo(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/remove", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.removeDialog(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/pin", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.pinDialog(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/unpin", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.unpinDialog(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/read", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.setRead(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/remove", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.removeMail(url, info, sessionID); - }, - ), - new RouteAction( - "/client/mail/dialog/getAllAttachments", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.getAllAttachments(url, info, sessionID); - }, - ), - 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 => - { - return this.dialogueCallbacks.clearMail(url, info, sessionID); - }, - ), - 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 => - { - return this.dialogueCallbacks.listOutbox(url, info, sessionID); - }, - ), - new RouteAction( - "/client/friend/request/list/inbox", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.listInbox(url, info, sessionID); - }, - ), - new RouteAction( - "/client/friend/request/send", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.sendFriendRequest(url, info, sessionID); - }, - ), - new RouteAction( - "/client/friend/request/accept", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.acceptFriendRequest(url, info, sessionID); - }, - ), - new RouteAction( - "/client/friend/request/cancel", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID); - }, - ), - 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 => - { - return this.dialogueCallbacks.ignoreFriend(url, info, sessionID); - }, - ), - new RouteAction( - "/client/friend/ignore/remove", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.dialogueCallbacks.unIgnoreFriend(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/chatServer/list", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.getChatServerList(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/list", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.getMailDialogList(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/view", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.getMailDialogView(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/info", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.getMailDialogInfo(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/remove", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.removeDialog(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/pin", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.pinDialog(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/unpin", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.unpinDialog(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/read", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.setRead(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/remove", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.removeMail(url, info, sessionID); + }, + ), + new RouteAction( + "/client/mail/dialog/getAllAttachments", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.getAllAttachments(url, info, sessionID); + }, + ), + 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 => + { + return this.dialogueCallbacks.clearMail(url, info, sessionID); + }, + ), + 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 => + { + return this.dialogueCallbacks.listOutbox(url, info, sessionID); + }, + ), + new RouteAction( + "/client/friend/request/list/inbox", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.listInbox(url, info, sessionID); + }, + ), + new RouteAction( + "/client/friend/request/send", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.sendFriendRequest(url, info, sessionID); + }, + ), + new RouteAction( + "/client/friend/request/accept", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.acceptFriendRequest(url, info, sessionID); + }, + ), + new RouteAction( + "/client/friend/request/cancel", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID); + }, + ), + 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 => + { + return this.dialogueCallbacks.ignoreFriend(url, info, sessionID); + }, + ), + new RouteAction( + "/client/friend/ignore/remove", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.unIgnoreFriend(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/GameStaticRouter.ts b/project/src/routers/static/GameStaticRouter.ts index 34d5fe4e..04c89a6c 100644 --- a/project/src/routers/static/GameStaticRouter.ts +++ b/project/src/routers/static/GameStaticRouter.ts @@ -6,83 +6,64 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class GameStaticRouter extends StaticRouter { - constructor( - @inject("GameCallbacks") protected gameCallbacks: GameCallbacks, - ) + constructor(@inject("GameCallbacks") protected gameCallbacks: GameCallbacks) { - super( - [ - 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 => - { - return this.gameCallbacks.getServer(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/current", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.gameCallbacks.getCurrentGroup(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/version/validate", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.gameCallbacks.versionValidate(url, info, sessionID); - }, - ), - 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 => - { - return this.gameCallbacks.gameLogout(url, info, sessionID); - }, - ), - new RouteAction( - "/client/checkVersion", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.gameCallbacks.validateGameVersion(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/keepalive", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.gameCallbacks.gameKeepalive(url, info, sessionID); - }, - ), - new RouteAction( - "/singleplayer/settings/version", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.gameCallbacks.getVersion(url, info, sessionID); - }, - ), - new RouteAction( - "/client/reports/lobby/send", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.gameCallbacks.reportNickname(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.gameCallbacks.getServer(url, info, sessionID); + }), + new RouteAction( + "/client/match/group/current", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.gameCallbacks.getCurrentGroup(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/version/validate", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.gameCallbacks.versionValidate(url, info, sessionID); + }, + ), + 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 => + { + return this.gameCallbacks.gameLogout(url, info, sessionID); + }), + new RouteAction("/client/checkVersion", (url: string, info: any, sessionID: string, output: string): any => + { + return this.gameCallbacks.validateGameVersion(url, info, sessionID); + }), + new RouteAction( + "/client/game/keepalive", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.gameCallbacks.gameKeepalive(url, info, sessionID); + }, + ), + new RouteAction( + "/singleplayer/settings/version", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.gameCallbacks.getVersion(url, info, sessionID); + }, + ), + new RouteAction( + "/client/reports/lobby/send", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.gameCallbacks.reportNickname(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/HealthStaticRouter.ts b/project/src/routers/static/HealthStaticRouter.ts index 9f4aa243..f20da993 100644 --- a/project/src/routers/static/HealthStaticRouter.ts +++ b/project/src/routers/static/HealthStaticRouter.ts @@ -6,27 +6,20 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class HealthStaticRouter extends StaticRouter { - constructor( - @inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks, - ) + constructor(@inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks) { - super( - [ - 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 => - { - return this.healthCallbacks.handleWorkoutEffects(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.healthCallbacks.handleWorkoutEffects(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/InraidStaticRouter.ts b/project/src/routers/static/InraidStaticRouter.ts index a3e958ae..3d3eda8d 100644 --- a/project/src/routers/static/InraidStaticRouter.ts +++ b/project/src/routers/static/InraidStaticRouter.ts @@ -6,48 +6,41 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class InraidStaticRouter extends StaticRouter { - constructor( - @inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks, - ) + constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks) { - super( - [ - 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 => - { - return this.inraidCallbacks.getRaidEndState(); - }, - ), - new RouteAction( - "/singleplayer/settings/weapon/durability", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.inraidCallbacks.getWeaponDurability(); - }, - ), - new RouteAction( - "/singleplayer/settings/raid/menu", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.inraidCallbacks.getRaidMenuSettings(); - }, - ), - new RouteAction( - "/singleplayer/airdrop/config", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.inraidCallbacks.getAirdropConfig(); - }, - ), - ], - ); + super([ + 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 => + { + return this.inraidCallbacks.getRaidEndState(); + }, + ), + new RouteAction( + "/singleplayer/settings/weapon/durability", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.inraidCallbacks.getWeaponDurability(); + }, + ), + new RouteAction( + "/singleplayer/settings/raid/menu", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.inraidCallbacks.getRaidMenuSettings(); + }, + ), + new RouteAction( + "/singleplayer/airdrop/config", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.inraidCallbacks.getAirdropConfig(); + }, + ), + ]); } } diff --git a/project/src/routers/static/InsuranceStaticRouter.ts b/project/src/routers/static/InsuranceStaticRouter.ts index 08d879ed..dcb333ea 100644 --- a/project/src/routers/static/InsuranceStaticRouter.ts +++ b/project/src/routers/static/InsuranceStaticRouter.ts @@ -6,20 +6,16 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class InsuranceStaticRouter extends StaticRouter { - constructor( - @inject("InsuranceCallbacks") protected insuranceCallbacks: InsuranceCallbacks, - ) + constructor(@inject("InsuranceCallbacks") protected insuranceCallbacks: InsuranceCallbacks) { - super( - [ - new RouteAction( - "/client/insurance/items/list/cost", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.insuranceCallbacks.getInsuranceCost(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/insurance/items/list/cost", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.insuranceCallbacks.getInsuranceCost(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/ItemEventStaticRouter.ts b/project/src/routers/static/ItemEventStaticRouter.ts index 793494da..54d668f2 100644 --- a/project/src/routers/static/ItemEventStaticRouter.ts +++ b/project/src/routers/static/ItemEventStaticRouter.ts @@ -6,20 +6,16 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class ItemEventStaticRouter extends StaticRouter { - constructor( - @inject("ItemEventCallbacks") protected itemEventCallbacks: ItemEventCallbacks, - ) + constructor(@inject("ItemEventCallbacks") protected itemEventCallbacks: ItemEventCallbacks) { - super( - [ - new RouteAction( - "/client/game/profile/items/moving", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.itemEventCallbacks.handleEvents(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/game/profile/items/moving", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.itemEventCallbacks.handleEvents(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/LauncherStaticRouter.ts b/project/src/routers/static/LauncherStaticRouter.ts index 7ecd65dd..0cdae88c 100644 --- a/project/src/routers/static/LauncherStaticRouter.ts +++ b/project/src/routers/static/LauncherStaticRouter.ts @@ -6,104 +6,94 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class LauncherStaticRouter extends StaticRouter { - constructor( - @inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks, - ) + constructor(@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks) { - super( - [ - 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 => - { - return this.launcherCallbacks.connect(); - }, - ), - new RouteAction( - "/launcher/profile/login", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.login(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profile/register", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.register(url, info, sessionID); - }, - ), - 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 => - { - return this.launcherCallbacks.changeUsername(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profile/change/password", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.changePassword(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profile/change/wipe", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.wipe(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profile/remove", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.removeProfile(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profile/compatibleTarkovVersion", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.getCompatibleTarkovVersion(); - }, - ), - new RouteAction( - "/launcher/server/version", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.getServerVersion(); - }, - ), - new RouteAction( - "/launcher/server/loadedServerMods", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.getLoadedServerMods(); - }, - ), - new RouteAction( - "/launcher/server/serverModsUsedByProfile", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.launcherCallbacks.connect(); + }, + ), + new RouteAction( + "/launcher/profile/login", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.login(url, info, sessionID); + }, + ), + new RouteAction( + "/launcher/profile/register", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.register(url, info, sessionID); + }, + ), + 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 => + { + return this.launcherCallbacks.changeUsername(url, info, sessionID); + }, + ), + new RouteAction( + "/launcher/profile/change/password", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.changePassword(url, info, sessionID); + }, + ), + new RouteAction( + "/launcher/profile/change/wipe", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.wipe(url, info, sessionID); + }, + ), + new RouteAction( + "/launcher/profile/remove", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.removeProfile(url, info, sessionID); + }, + ), + new RouteAction( + "/launcher/profile/compatibleTarkovVersion", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.getCompatibleTarkovVersion(); + }, + ), + new RouteAction( + "/launcher/server/version", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.getServerVersion(); + }, + ), + new RouteAction( + "/launcher/server/loadedServerMods", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.getLoadedServerMods(); + }, + ), + new RouteAction( + "/launcher/server/serverModsUsedByProfile", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/LocationStaticRouter.ts b/project/src/routers/static/LocationStaticRouter.ts index ccfb93a0..a2bff938 100644 --- a/project/src/routers/static/LocationStaticRouter.ts +++ b/project/src/routers/static/LocationStaticRouter.ts @@ -6,27 +6,20 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class LocationStaticRouter extends StaticRouter { - constructor( - @inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks, - ) + constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks) { - super( - [ - 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 => - { - return this.locationCallbacks.getAirdropLoot(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.locationCallbacks.getAirdropLoot(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/MatchStaticRouter.ts b/project/src/routers/static/MatchStaticRouter.ts index 74c81455..22ce8bb3 100644 --- a/project/src/routers/static/MatchStaticRouter.ts +++ b/project/src/routers/static/MatchStaticRouter.ts @@ -6,174 +6,158 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class MatchStaticRouter extends StaticRouter { - constructor( - @inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks, - ) + constructor(@inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks) { - super( - [ - 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 => - { - return this.matchCallbacks.serverAvailable(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/updatePing", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.updatePing(url, info, sessionID); - }, - ), - 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 => - { - return this.matchCallbacks.exitMatch(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/create", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.createGroup(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/delete", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.deleteGroup(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/leave", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.leaveGroup(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/status", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.getGroupStatus(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/start_game", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.joinMatch(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/exit_from_menu", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.exitToMenu(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/looking/start", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.startGroupSearch(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/looking/stop", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.stopGroupSearch(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/invite/send", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.sendGroupInvite(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/invite/accept", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.acceptGroupInvite(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/invite/cancel", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.cancelGroupInvite(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/invite/cancel-all", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/transfer", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.transferGroup(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/offline/end", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.endOfflineRaid(url, info, sessionID); - }, - ), - 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 => - { - return this.matchCallbacks.getMetrics(url, info, sessionID); - }, - ), - new RouteAction( - "/client/raid/configuration", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.getRaidConfiguration(url, info, sessionID); - }, - ), - new RouteAction( - "/client/match/group/player/remove", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.matchCallbacks.serverAvailable(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/updatePing", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.updatePing(url, info, sessionID); + }, + ), + 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 => + { + return this.matchCallbacks.exitMatch(url, info, sessionID); + }), + new RouteAction( + "/client/match/group/create", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.createGroup(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/delete", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.deleteGroup(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/leave", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.leaveGroup(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/status", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.getGroupStatus(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/start_game", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.joinMatch(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/exit_from_menu", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.exitToMenu(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/looking/start", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.startGroupSearch(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/looking/stop", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.stopGroupSearch(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/invite/send", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.sendGroupInvite(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/invite/accept", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.acceptGroupInvite(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/invite/cancel", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.cancelGroupInvite(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/invite/cancel-all", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/transfer", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.transferGroup(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/offline/end", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.endOfflineRaid(url, info, sessionID); + }, + ), + 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 => + { + return this.matchCallbacks.getMetrics(url, info, sessionID); + }, + ), + new RouteAction( + "/client/raid/configuration", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.getRaidConfiguration(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/player/remove", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/NotifierStaticRouter.ts b/project/src/routers/static/NotifierStaticRouter.ts index 56b34ce2..19cfbd08 100644 --- a/project/src/routers/static/NotifierStaticRouter.ts +++ b/project/src/routers/static/NotifierStaticRouter.ts @@ -6,27 +6,23 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class NotifierStaticRouter extends StaticRouter { - constructor( - @inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks, - ) + constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks) { - super( - [ - new RouteAction( - "/client/notifier/channel/create", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.notifierCallbacks.createNotifierChannel(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/select", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.notifierCallbacks.selectProfile(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/notifier/channel/create", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.notifierCallbacks.createNotifierChannel(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/select", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.notifierCallbacks.selectProfile(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/PresetStaticRouter.ts b/project/src/routers/static/PresetStaticRouter.ts index c08482ff..08d84521 100644 --- a/project/src/routers/static/PresetStaticRouter.ts +++ b/project/src/routers/static/PresetStaticRouter.ts @@ -6,20 +6,16 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class PresetStaticRouter extends StaticRouter { - constructor( - @inject("PresetBuildCallbacks") protected presetCallbacks: PresetBuildCallbacks, - ) + constructor(@inject("PresetBuildCallbacks") protected presetCallbacks: PresetBuildCallbacks) { - super( - [ - new RouteAction( - "/client/handbook/builds/my/list", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.presetCallbacks.getHandbookUserlist(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/handbook/builds/my/list", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.presetCallbacks.getHandbookUserlist(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/ProfileStaticRouter.ts b/project/src/routers/static/ProfileStaticRouter.ts index 147a066e..4ab84e5f 100644 --- a/project/src/routers/static/ProfileStaticRouter.ts +++ b/project/src/routers/static/ProfileStaticRouter.ts @@ -6,97 +6,90 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class ProfileStaticRouter extends StaticRouter { - constructor( - @inject("ProfileCallbacks") protected profileCallbacks: ProfileCallbacks, - ) + constructor(@inject("ProfileCallbacks") protected profileCallbacks: ProfileCallbacks) { - super( - [ - new RouteAction( - "/client/game/profile/create", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.createProfile(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/list", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.getProfileData(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/savage/regenerate", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.regenerateScav(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/voice/change", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.changeVoice(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/nickname/change", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.changeNickname(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/nickname/validate", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.validateNickname(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/nickname/reserved", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.getReservedNickname(url, info, sessionID); - }, - ), - new RouteAction( - "/client/profile/status", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.getProfileStatus(url, info, sessionID); - }, - ), - new RouteAction( - "/client/profile/settings", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.getProfileSettings(url, info, sessionID); - }, - ), - new RouteAction( - "/client/game/profile/search", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.searchFriend(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profile/info", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.getMiniProfile(url, info, sessionID); - }, - ), - new RouteAction( - "/launcher/profiles", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/game/profile/create", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.createProfile(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/list", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.getProfileData(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/savage/regenerate", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.regenerateScav(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/voice/change", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.changeVoice(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/nickname/change", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.changeNickname(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/nickname/validate", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.validateNickname(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/nickname/reserved", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.getReservedNickname(url, info, sessionID); + }, + ), + new RouteAction( + "/client/profile/status", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.getProfileStatus(url, info, sessionID); + }, + ), + new RouteAction( + "/client/profile/settings", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.getProfileSettings(url, info, sessionID); + }, + ), + new RouteAction( + "/client/game/profile/search", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.searchFriend(url, info, sessionID); + }, + ), + new RouteAction( + "/launcher/profile/info", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.getMiniProfile(url, info, sessionID); + }, + ), + new RouteAction("/launcher/profiles", (url: string, info: any, sessionID: string, output: string): any => + { + return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID); + }), + ]); } } diff --git a/project/src/routers/static/QuestStaticRouter.ts b/project/src/routers/static/QuestStaticRouter.ts index d0ac6f12..e56f51ac 100644 --- a/project/src/routers/static/QuestStaticRouter.ts +++ b/project/src/routers/static/QuestStaticRouter.ts @@ -6,27 +6,20 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class QuestStaticRouter extends StaticRouter { - constructor( - @inject("QuestCallbacks") protected questCallbacks: QuestCallbacks, - ) + constructor(@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks) { - super( - [ - 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 => - { - return this.questCallbacks.activityPeriods(url, info, sessionID); - }, - ), - ], - ); + super([ + 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 => + { + return this.questCallbacks.activityPeriods(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/RagfairStaticRouter.ts b/project/src/routers/static/RagfairStaticRouter.ts index 06461d4f..376b8c6d 100644 --- a/project/src/routers/static/RagfairStaticRouter.ts +++ b/project/src/routers/static/RagfairStaticRouter.ts @@ -6,55 +6,45 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class RagfairStaticRouter extends StaticRouter { - constructor( - @inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks, - ) + constructor(@inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks) { - super( - [ - new RouteAction( - "/client/ragfair/search", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.ragfairCallbacks.search(url, info, sessionID); - }, - ), - 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 => - { - return this.ragfairCallbacks.getMarketPrice(url, info, sessionID); - }, - ), - new RouteAction( - "/client/ragfair/offerfees", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.ragfairCallbacks.storePlayerOfferTaxAmount(url, info, sessionID); - }, - ), - new RouteAction( - "/client/reports/ragfair/send", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.ragfairCallbacks.sendReport(url, info, sessionID); - }, - ), - new RouteAction( - "/client/items/prices", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.ragfairCallbacks.getFleaPrices(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/ragfair/search", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.ragfairCallbacks.search(url, info, sessionID); + }, + ), + 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 => + { + return this.ragfairCallbacks.getMarketPrice(url, info, sessionID); + }, + ), + new RouteAction( + "/client/ragfair/offerfees", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.ragfairCallbacks.storePlayerOfferTaxAmount(url, info, sessionID); + }, + ), + new RouteAction( + "/client/reports/ragfair/send", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.ragfairCallbacks.sendReport(url, info, sessionID); + }, + ), + new RouteAction("/client/items/prices", (url: string, info: any, sessionID: string, output: string): any => + { + return this.ragfairCallbacks.getFleaPrices(url, info, sessionID); + }), + ]); } } diff --git a/project/src/routers/static/TraderStaticRouter.ts b/project/src/routers/static/TraderStaticRouter.ts index 12ac0359..2903f9be 100644 --- a/project/src/routers/static/TraderStaticRouter.ts +++ b/project/src/routers/static/TraderStaticRouter.ts @@ -6,20 +6,16 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class TraderStaticRouter extends StaticRouter { - constructor( - @inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks, - ) + constructor(@inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks) { - super( - [ - new RouteAction( - "/client/trading/api/traderSettings", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.traderCallbacks.getTraderSettings(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction( + "/client/trading/api/traderSettings", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.traderCallbacks.getTraderSettings(url, info, sessionID); + }, + ), + ]); } } diff --git a/project/src/routers/static/WeatherStaticRouter.ts b/project/src/routers/static/WeatherStaticRouter.ts index df013520..28504cc1 100644 --- a/project/src/routers/static/WeatherStaticRouter.ts +++ b/project/src/routers/static/WeatherStaticRouter.ts @@ -6,20 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; @injectable() export class WeatherStaticRouter extends StaticRouter { - constructor( - @inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks, - ) + constructor(@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks) { - super( - [ - new RouteAction( - "/client/weather", - (url: string, info: any, sessionID: string, output: string): any => - { - return this.weatherCallbacks.getWeather(url, info, sessionID); - }, - ), - ], - ); + super([ + new RouteAction("/client/weather", (url: string, info: any, sessionID: string, output: string): any => + { + return this.weatherCallbacks.getWeather(url, info, sessionID); + }), + ]); } } diff --git a/project/src/servers/ConfigServer.ts b/project/src/servers/ConfigServer.ts index d6128e37..85c4cb6f 100644 --- a/project/src/servers/ConfigServer.ts +++ b/project/src/servers/ConfigServer.ts @@ -36,9 +36,7 @@ export class ConfigServer this.logger.debug("Importing configs..."); // Get all filepaths - const filepath = (globalThis.G_RELEASE_CONFIGURATION) - ? "Aki_Data/Server/configs/" - : "./assets/configs/"; + const filepath = (globalThis.G_RELEASE_CONFIGURATION) ? "Aki_Data/Server/configs/" : "./assets/configs/"; const files = this.vfs.getFiles(filepath); // Add file content to result diff --git a/project/src/servers/SaveServer.ts b/project/src/servers/SaveServer.ts index 8105ab79..5599b361 100644 --- a/project/src/servers/SaveServer.ts +++ b/project/src/servers/SaveServer.ts @@ -142,10 +142,7 @@ export class SaveServer throw new Error(`profile already exists for sessionId: ${profileInfo.id}`); } - this.profiles[profileInfo.id] = { - info: profileInfo, - characters: {pmc: {}, scav: {}}, - }; + this.profiles[profileInfo.id] = {info: profileInfo, characters: {pmc: {}, scav: {}}}; } /** diff --git a/project/src/servers/WebSocketServer.ts b/project/src/servers/WebSocketServer.ts index aece4db8..fcf3ea16 100644 --- a/project/src/servers/WebSocketServer.ts +++ b/project/src/servers/WebSocketServer.ts @@ -28,19 +28,14 @@ export class WebSocketServer } protected httpConfig: IHttpConfig; - protected defaultNotification: INotification = { - type: NotificationType.PING, - eventId: "ping", - }; + protected defaultNotification: INotification = {type: NotificationType.PING, eventId: "ping"}; protected webSockets: Record = {}; protected websocketPingHandler = null; public setupWebSocket(httpServer: http.Server): void { - const webSocketServer = new WebSocket.Server({ - server: httpServer, - }); + const webSocketServer = new WebSocket.Server({server: httpServer}); webSocketServer.addListener("listening", () => { diff --git a/project/src/servers/http/AkiHttpListener.ts b/project/src/servers/http/AkiHttpListener.ts index 77f48918..bc74db94 100644 --- a/project/src/servers/http/AkiHttpListener.ts +++ b/project/src/servers/http/AkiHttpListener.ts @@ -141,9 +141,7 @@ export class AkiHttpListener implements IHttpListener if (globalThis.G_LOG_REQUESTS) { // Parse quest info into object - const data = (typeof info === "object") - ? info - : this.jsonUtil.deserialize(info); + const data = (typeof info === "object") ? info : this.jsonUtil.deserialize(info); const log = new Request(req.method, new RequestData(req.url, req.headers, data)); this.requestsLogger.info(`REQUEST=${this.jsonUtil.serialize(log)}`); @@ -184,28 +182,18 @@ export class AkiHttpListener implements IHttpListener class RequestData { - constructor( - public url: string, - public headers: IncomingHttpHeaders, - public data?: any, - ) + constructor(public url: string, public headers: IncomingHttpHeaders, public data?: any) {} } class Request { - constructor( - public type: string, - public req: RequestData, - ) + constructor(public type: string, public req: RequestData) {} } class Response { - constructor( - public type: string, - public response: any, - ) + constructor(public type: string, public response: any) {} } diff --git a/project/src/services/BotEquipmentFilterService.ts b/project/src/services/BotEquipmentFilterService.ts index c9d99111..5c67c0d8 100644 --- a/project/src/services/BotEquipmentFilterService.ts +++ b/project/src/services/BotEquipmentFilterService.ts @@ -54,9 +54,7 @@ export class BotEquipmentFilterService { const pmcProfile = this.profileHelper.getPmcProfile(sessionId); - const botRole = (botGenerationDetails.isPmc) - ? "pmc" - : botGenerationDetails.role; + const botRole = (botGenerationDetails.isPmc) ? "pmc" : botGenerationDetails.role; const botEquipmentBlacklist = this.getBotEquipmentBlacklist(botRole, botLevel); const botEquipmentWhitelist = this.getBotEquipmentWhitelist(botRole, botLevel); const botWeightingAdjustments = this.getBotWeightingAdjustments(botRole, botLevel); diff --git a/project/src/services/BotLootCacheService.ts b/project/src/services/BotLootCacheService.ts index 76828d14..f24ba9ff 100644 --- a/project/src/services/BotLootCacheService.ts +++ b/project/src/services/BotLootCacheService.ts @@ -168,8 +168,7 @@ export class BotLootCacheService const specialLootItems = (botJsonTemplate.generation.items.specialItems.whitelist?.length > 0) ? botJsonTemplate.generation.items.specialItems.whitelist.map((x) => this.itemHelper.getItem(x)[1]) : specialLootTemplates.filter((template) => - !(this.isBulletOrGrenade(template._props) - || this.isMagazine(template._props)) + !(this.isBulletOrGrenade(template._props) || this.isMagazine(template._props)) ); const healingItems = (botJsonTemplate.generation.items.healing.whitelist?.length > 0) @@ -183,15 +182,13 @@ export class BotLootCacheService const drugItems = (botJsonTemplate.generation.items.drugs.whitelist?.length > 0) ? botJsonTemplate.generation.items.drugs.whitelist.map((x) => this.itemHelper.getItem(x)[1]) : combinedPoolTemplates.filter((template) => - this.isMedicalItem(template._props) - && template._parent === BaseClasses.DRUGS + this.isMedicalItem(template._props) && template._parent === BaseClasses.DRUGS ); const stimItems = (botJsonTemplate.generation.items.stims.whitelist?.length > 0) ? botJsonTemplate.generation.items.stims.whitelist.map((x) => this.itemHelper.getItem(x)[1]) : combinedPoolTemplates.filter((template) => - this.isMedicalItem(template._props) - && template._parent === BaseClasses.STIMULATOR + this.isMedicalItem(template._props) && template._parent === BaseClasses.STIMULATOR ); const grenadeItems = (botJsonTemplate.generation.items.grenades.whitelist?.length > 0) @@ -201,9 +198,7 @@ export class BotLootCacheService // Get loot items (excluding magazines, bullets, grenades and healing items) const backpackLootItems = backpackLootTemplates.filter((template) => // biome-ignore lint/complexity/useSimplifiedLogicExpression: - !this.isBulletOrGrenade(template._props) - && !this.isMagazine(template._props) - // && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot + !this.isBulletOrGrenade(template._props) && !this.isMagazine(template._props) // && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot && !this.isGrenade(template._props) ); diff --git a/project/src/services/FenceService.ts b/project/src/services/FenceService.ts index f1e53b17..9eb4afed 100644 --- a/project/src/services/FenceService.ts +++ b/project/src/services/FenceService.ts @@ -294,9 +294,7 @@ export class FenceService const desiredTotalCount = this.traderConfig.fence.assortSize; const actualTotalCount = this.fenceAssort.items.reduce((count, item) => { - return item.slotId === "hideout" - ? count + 1 - : count; + return item.slotId === "hideout" ? count + 1 : count; }, 0); return actualTotalCount < desiredTotalCount @@ -587,10 +585,7 @@ export class FenceService // Multiply weapon+mods rouble price by multipler in config assorts.barter_scheme[weaponAndMods[0]._id] = [[]]; - assorts.barter_scheme[weaponAndMods[0]._id][0][0] = { - _tpl: Money.ROUBLES, - count: Math.round(rub), - }; + assorts.barter_scheme[weaponAndMods[0]._id][0][0] = {_tpl: Money.ROUBLES, count: Math.round(rub)}; assorts.loyal_level_items[weaponAndMods[0]._id] = loyaltyLevel; @@ -658,8 +653,7 @@ export class FenceService // Roll from 0 to 9999, then divide it by 100: 9999 = 99.99% const randomChance = this.randomUtil.getInt(0, 9999) / 100; - return randomChance > removalChance - && !itemsBeingDeleted.includes(weaponMod._id); + return randomChance > removalChance && !itemsBeingDeleted.includes(weaponMod._id); } /** @@ -681,9 +675,7 @@ export class FenceService // Randomise hp resource of med items if ("MaxHpResource" in itemDetails._props && itemDetails._props.MaxHpResource > 0) { - itemToAdjust.upd.MedKit = { - HpResource: this.randomUtil.getInt(1, itemDetails._props.MaxHpResource), - }; + itemToAdjust.upd.MedKit = {HpResource: this.randomUtil.getInt(1, itemDetails._props.MaxHpResource)}; } // Randomise armor durability @@ -692,8 +684,7 @@ export class FenceService || itemDetails._parent === BaseClasses.HEADWEAR || itemDetails._parent === BaseClasses.VEST || itemDetails._parent === BaseClasses.ARMOREDEQUIPMENT - || itemDetails._parent === BaseClasses.FACECOVER) - && itemDetails._props.MaxDurability > 0 + || itemDetails._parent === BaseClasses.FACECOVER) && itemDetails._props.MaxDurability > 0 ) { const armorMaxDurabilityLimits = this.traderConfig.fence.armorMaxDurabilityPercentMinMax; @@ -703,10 +694,7 @@ export class FenceService const maxDurability = this.randomUtil.getInt(duraMin, duraMax); const durability = this.randomUtil.getInt(1, maxDurability); - itemToAdjust.upd.Repairable = { - Durability: durability, - MaxDurability: maxDurability, - }; + itemToAdjust.upd.Repairable = {Durability: durability, MaxDurability: maxDurability}; return; } @@ -721,19 +709,14 @@ export class FenceService const maxDurability = this.randomUtil.getInt(duraMin, duraMax); const durability = this.randomUtil.getInt(1, maxDurability); - itemToAdjust.upd.Repairable = { - Durability: durability, - MaxDurability: maxDurability, - }; + itemToAdjust.upd.Repairable = {Durability: durability, MaxDurability: maxDurability}; return; } if (this.itemHelper.isOfBaseclass(itemDetails._id, BaseClasses.REPAIR_KITS)) { - itemToAdjust.upd.RepairKit = { - Resource: this.randomUtil.getInt(1, itemDetails._props.MaxRepairResource), - }; + itemToAdjust.upd.RepairKit = {Resource: this.randomUtil.getInt(1, itemDetails._props.MaxRepairResource)}; return; } @@ -757,10 +740,7 @@ export class FenceService const resourceMax = itemDetails._props.MaxResource; const resourceCurrent = this.randomUtil.getInt(1, itemDetails._props.MaxResource); - itemToAdjust.upd.Resource = { - Value: resourceMax - resourceCurrent, - UnitsConsumed: resourceCurrent, - }; + itemToAdjust.upd.Resource = {Value: resourceMax - resourceCurrent, UnitsConsumed: resourceCurrent}; } } @@ -775,10 +755,7 @@ export class FenceService for (const x in limits) { - itemTypeCounts[x] = { - current: 0, - max: limits[x], - }; + itemTypeCounts[x] = {current: 0, max: limits[x]}; } return itemTypeCounts; diff --git a/project/src/services/InsuranceService.ts b/project/src/services/InsuranceService.ts index 86055e5e..b32d9bbd 100644 --- a/project/src/services/InsuranceService.ts +++ b/project/src/services/InsuranceService.ts @@ -202,9 +202,8 @@ export class InsuranceService } const insuranceReturnTimeBonus = pmcData.Bonuses.find((b) => b.type === "InsuranceReturnTime"); - const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonus - ? Math.abs(insuranceReturnTimeBonus.value) - : 0) / 100; + const insuranceReturnTimeBonusPercent = 1.0 + - (insuranceReturnTimeBonus ? Math.abs(insuranceReturnTimeBonus.value) : 0) / 100; const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.oneHourAsSeconds; const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.oneHourAsSeconds; @@ -335,9 +334,7 @@ export class InsuranceService // Item didnt have faceshield object pre-raid, add it if (!itemToReturn.upd.FaceShield) { - itemToReturn.upd.FaceShield = { - Hits: insuredItemFromClient.hits, - }; + itemToReturn.upd.FaceShield = {Hits: insuredItemFromClient.hits}; } else { @@ -355,12 +352,7 @@ export class InsuranceService */ protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void { - const pocketSlots = [ - "pocket1", - "pocket2", - "pocket3", - "pocket4", - ]; + const pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"]; // Some pockets can lose items with player death, some don't if (!("slotId" in itemToReturn) || pocketSlots.includes(itemToReturn.slotId)) diff --git a/project/src/services/LocalisationService.ts b/project/src/services/LocalisationService.ts index 525e9e25..73859227 100644 --- a/project/src/services/LocalisationService.ts +++ b/project/src/services/LocalisationService.ts @@ -30,14 +30,12 @@ export class LocalisationService ? "Aki_Data/Server/database/locales/server" : "./assets/database/locales/server", ); - this.i18n = new I18n( - { - locales: this.localeService.getServerSupportedLocales(), - defaultLocale: "en", - directory: localeFileDirectory, - retryInDefaultLocale: true, - }, - ); + this.i18n = new I18n({ + locales: this.localeService.getServerSupportedLocales(), + defaultLocale: "en", + directory: localeFileDirectory, + retryInDefaultLocale: true, + }); this.i18n.setLocale(this.localeService.getDesiredServerLocale()); } diff --git a/project/src/services/MailSendService.ts b/project/src/services/MailSendService.ts index 41f9ec78..d5accb8a 100644 --- a/project/src/services/MailSendService.ts +++ b/project/src/services/MailSendService.ts @@ -420,10 +420,7 @@ export class MailSendService parentItem.parentId = this.hashUtil.generate(); } - itemsToSendToPlayer = { - stash: parentItem.parentId, - data: [], - }; + itemsToSendToPlayer = {stash: parentItem.parentId, data: []}; // Ensure Ids are unique and cont collide with items in player inventory later messageDetails.items = this.itemHelper.replaceIDs(null, messageDetails.items); diff --git a/project/src/services/MatchLocationService.ts b/project/src/services/MatchLocationService.ts index 1b3e40bd..d81b1817 100644 --- a/project/src/services/MatchLocationService.ts +++ b/project/src/services/MatchLocationService.ts @@ -8,9 +8,7 @@ export class MatchLocationService { protected locations = {}; - constructor( - @inject("TimeUtil") protected timeUtil: TimeUtil, - ) + constructor(@inject("TimeUtil") protected timeUtil: TimeUtil) {} public createGroup(sessionID: string, info: ICreateGroupRequestData): any @@ -27,15 +25,13 @@ export class MatchLocationService isSavage: false, timeShift: "CURR", dt: this.timeUtil.getTimestamp(), - players: [ - { - _id: `pmc${sessionID}`, - region: "EUR", - ip: "127.0.0.1", - savageId: `scav${sessionID}`, - accessKeyId: "", - }, - ], + players: [{ + _id: `pmc${sessionID}`, + region: "EUR", + ip: "127.0.0.1", + savageId: `scav${sessionID}`, + accessKeyId: "", + }], customDataCenter: [], }; diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 7dfe1b39..2dcb1547 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -93,8 +93,7 @@ export class ProfileFixerService HideoutAreas.GENERATOR, 6 + this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots - .Generator - .Slots, + .Generator.Slots, pmcProfile, ); } @@ -276,34 +275,30 @@ export class ProfileFixerService { if (!pmcProfile.Hideout.Areas.find((x) => x.type === HideoutAreas.WEAPON_STAND)) { - pmcProfile.Hideout.Areas.push( - { - type: 24, - level: 0, - active: true, - passiveBonusesEnabled: true, - completeTime: 0, - constructing: false, - slots: [], - lastRecipe: "", - }, - ); + pmcProfile.Hideout.Areas.push({ + type: 24, + level: 0, + active: true, + passiveBonusesEnabled: true, + completeTime: 0, + constructing: false, + slots: [], + lastRecipe: "", + }); } if (!pmcProfile.Hideout.Areas.find((x) => x.type === HideoutAreas.WEAPON_STAND_SECONDARY)) { - pmcProfile.Hideout.Areas.push( - { - type: 25, - level: 0, - active: true, - passiveBonusesEnabled: true, - completeTime: 0, - constructing: false, - slots: [], - lastRecipe: "", - }, - ); + pmcProfile.Hideout.Areas.push({ + type: 25, + level: 0, + active: true, + passiveBonusesEnabled: true, + completeTime: 0, + constructing: false, + slots: [], + lastRecipe: "", + }); } } @@ -357,10 +352,7 @@ export class ProfileFixerService if (!fullProfile.aki) { this.logger.debug("Adding aki object to profile"); - fullProfile.aki = { - version: this.watermark.getVersionTag(), - receivedGifts: [], - }; + fullProfile.aki = {version: this.watermark.getVersionTag(), receivedGifts: []}; } } @@ -404,9 +396,7 @@ export class ProfileFixerService if (!pmcProfile.UnlockedInfo) { this.logger.debug("Adding UnlockedInfo object to profile"); - pmcProfile.UnlockedInfo = { - unlockedProductionRecipe: [], - }; + pmcProfile.UnlockedInfo = {unlockedProductionRecipe: []}; } } @@ -554,9 +544,9 @@ export class ProfileFixerService { if ( !(currentRepeatable.changeRequirement - && currentRepeatable.activeQuests.every( - (x) => (typeof x.changeCost !== "undefined" && typeof x.changeStandingCost !== "undefined"), - )) + && currentRepeatable.activeQuests.every(( + x, + ) => (typeof x.changeCost !== "undefined" && typeof x.changeStandingCost !== "undefined"))) ) { repeatablesCompatible = false; @@ -798,28 +788,17 @@ export class ProfileFixerService if (bonus.type.toLowerCase() === "stashsize") { - return profileBonuses.find( - (x) => - x.type === bonus.type - && x.templateId === bonus.templateId, - ); + return profileBonuses.find((x) => x.type === bonus.type && x.templateId === bonus.templateId); } if (bonus.type.toLowerCase() === "additionalslots") { - return profileBonuses.find( - (x) => - x.type === bonus.type - && x.value === bonus.value - && x.visible === bonus.visible, + return profileBonuses.find((x) => + x.type === bonus.type && x.value === bonus.value && x.visible === bonus.visible ); } - return profileBonuses.find( - (x) => - x.type === bonus.type - && x.value === bonus.value, - ); + return profileBonuses.find((x) => x.type === bonus.type && x.value === bonus.value); } /** diff --git a/project/src/services/ProfileSnapshotService.ts b/project/src/services/ProfileSnapshotService.ts index 2007ea5c..f1ffe7c5 100644 --- a/project/src/services/ProfileSnapshotService.ts +++ b/project/src/services/ProfileSnapshotService.ts @@ -8,9 +8,7 @@ export class ProfileSnapshotService { protected storedProfileSnapshots: Record = {}; - constructor( - @inject("JsonUtil") protected jsonUtil: JsonUtil, - ) + constructor(@inject("JsonUtil") protected jsonUtil: JsonUtil) {} /** diff --git a/project/src/services/RagfairCategoriesService.ts b/project/src/services/RagfairCategoriesService.ts index a8039963..5a1196bd 100644 --- a/project/src/services/RagfairCategoriesService.ts +++ b/project/src/services/RagfairCategoriesService.ts @@ -8,9 +8,7 @@ export class RagfairCategoriesService { protected categories: Record = {}; - constructor( - @inject("WinstonLogger") protected logger: ILogger, - ) + constructor(@inject("WinstonLogger") protected logger: ILogger) {} /** @@ -58,9 +56,7 @@ export class RagfairCategoriesService const itemId = offer.items[0]._tpl; if (increment) { - categories[itemId] = categories[itemId] - ? categories[itemId] + 1 - : 1; + categories[itemId] = categories[itemId] ? categories[itemId] + 1 : 1; } else { diff --git a/project/src/services/RagfairPriceService.ts b/project/src/services/RagfairPriceService.ts index 3eba729a..22b57672 100644 --- a/project/src/services/RagfairPriceService.ts +++ b/project/src/services/RagfairPriceService.ts @@ -29,10 +29,7 @@ export class RagfairPriceService implements OnLoad protected generatedDynamicPrices: boolean; protected generatedStaticPrices: boolean; - protected prices: IRagfairServerPrices = { - static: {}, - dynamic: {}, - }; + protected prices: IRagfairServerPrices = {static: {}, dynamic: {}}; constructor( @inject("HandbookHelper") protected handbookHelper: HandbookHelper, @@ -298,8 +295,7 @@ export class RagfairPriceService implements OnLoad // Only adjust price if difference is > a percent AND item price passes threshhold set in config if ( - priceDifferencePercent - > this.ragfairConfig.dynamic.offerAdjustment.maxPriceDifferenceBelowHandbookPercent + priceDifferencePercent > this.ragfairConfig.dynamic.offerAdjustment.maxPriceDifferenceBelowHandbookPercent && itemPrice >= this.ragfairConfig.dynamic.offerAdjustment.priceThreshholdRub ) { @@ -418,10 +414,7 @@ export class RagfairPriceService implements OnLoad const defaultPreset = presets.find((x) => x._encyclopedia); if (defaultPreset) { - return { - isDefault: true, - preset: defaultPreset, - }; + return {isDefault: true, preset: defaultPreset}; } if (presets.length === 1) @@ -441,9 +434,6 @@ export class RagfairPriceService implements OnLoad ); } - return { - isDefault: false, - preset: presets[0], - }; + return {isDefault: false, preset: presets[0]}; } } diff --git a/project/src/services/RepairService.ts b/project/src/services/RepairService.ts index 9b1cd272..4064fd87 100644 --- a/project/src/services/RepairService.ts +++ b/project/src/services/RepairService.ts @@ -69,9 +69,7 @@ export class RepairService const priceCoef = this.traderHelper.getLoyaltyLevel(traderId, pmcData).repair_price_coef; const traderRepairDetails = this.traderHelper.getTrader(traderId, sessionID).repair; const repairQualityMultiplier = traderRepairDetails.quality; - const repairRate = (priceCoef <= 0) - ? 1 - : (priceCoef / 100 + 1); + const repairRate = (priceCoef <= 0) ? 1 : (priceCoef / 100 + 1); const itemToRepairDetails = this.databaseServer.getTables().templates.items[itemToRepair._tpl]; const repairItemIsArmor = !!itemToRepairDetails._props.ArmorMaterial; @@ -124,12 +122,7 @@ export class RepairService { const options: IProcessBuyTradeRequestData = { // eslint-disable-next-line @typescript-eslint/naming-convention - scheme_items: [ - { - id: repairedItemId, - count: Math.round(repairCost), - }, - ], + scheme_items: [{id: repairedItemId, count: Math.round(repairCost)}], tid: traderId, Action: "", type: "", @@ -149,11 +142,7 @@ export class RepairService * @param repairDetails details of item repaired, cost/item * @param pmcData Profile to add points to */ - public addRepairSkillPoints( - sessionId: string, - repairDetails: RepairDetails, - pmcData: IPmcData, - ): void + public addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData): void { if ( repairDetails.repairedByKit @@ -186,9 +175,7 @@ export class RepairService } const isHeavyArmor = itemDetails[1]._props.ArmorType === "Heavy"; - const vestSkillToLevel = isHeavyArmor - ? SkillTypes.HEAVY_VESTS - : SkillTypes.LIGHT_VESTS; + const vestSkillToLevel = isHeavyArmor ? SkillTypes.HEAVY_VESTS : SkillTypes.LIGHT_VESTS; const pointsToAddToVestSkill = repairDetails.repairPoints * this.repairConfig.armorKitSkillPointGainPerRepairPointMultiplier; @@ -227,9 +214,7 @@ export class RepairService * @param repairDetails the repair details to calculate skill points for * @returns the number of skill points to reward the user */ - protected getWeaponRepairSkillPoints( - repairDetails: RepairDetails, - ): number + protected getWeaponRepairSkillPoints(repairDetails: RepairDetails): number { // This formula and associated configs is calculated based on 30 repairs done on live // The points always came out 2-aligned, which is why there's a divide/multiply by 2 with ceil calls @@ -420,17 +405,11 @@ export class RepairService if (!repairKitInInventory.upd) { this.logger.debug(`Repair kit: ${repairKitInInventory._id} in inventory lacks upd object, adding`); - repairKitInInventory.upd = { - RepairKit: { - Resource: maxRepairAmount, - }, - }; + repairKitInInventory.upd = {RepairKit: {Resource: maxRepairAmount}}; } if (!repairKitInInventory.upd.RepairKit?.Resource) { - repairKitInInventory.upd.RepairKit = { - Resource: maxRepairAmount, - }; + repairKitInInventory.upd.RepairKit = {Resource: maxRepairAmount}; } } diff --git a/project/src/services/SeasonalEventService.ts b/project/src/services/SeasonalEventService.ts index b606d40e..2601fb90 100644 --- a/project/src/services/SeasonalEventService.ts +++ b/project/src/services/SeasonalEventService.ts @@ -236,10 +236,7 @@ export class SeasonalEventService const eventEndDate = new Date(currentDate.getFullYear(), event.endMonth - 1, event.endDay); // Current date is between start/end dates - if ( - currentDate >= eventStartDate - && currentDate <= eventEndDate - ) + if (currentDate >= eventStartDate && currentDate <= eventEndDate) { this.christmasEventActive = SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS; this.halloweenEventActive = SeasonalEventType[event.type] === SeasonalEventType.HALLOWEEN; diff --git a/project/src/services/mod/CustomItemService.ts b/project/src/services/mod/CustomItemService.ts index 5ae95575..45835d5a 100644 --- a/project/src/services/mod/CustomItemService.ts +++ b/project/src/services/mod/CustomItemService.ts @@ -120,9 +120,7 @@ export class CustomItemService */ protected getOrGenerateIdForItem(newId: string): string { - return (newId === "") - ? this.hashUtil.generate() - : newId; + return (newId === "") ? this.hashUtil.generate() : newId; } /** @@ -157,13 +155,7 @@ export class CustomItemService */ protected addToHandbookDb(newItemId: string, parentId: string, priceRoubles: number): void { - this.tables.templates.handbook.Items.push( - { - Id: newItemId, - ParentId: parentId, - Price: priceRoubles, - }, - ); + this.tables.templates.handbook.Items.push({Id: newItemId, ParentId: parentId, Price: priceRoubles}); } /** diff --git a/project/src/services/mod/dynamicRouter/DynamicRouterMod.ts b/project/src/services/mod/dynamicRouter/DynamicRouterMod.ts index f2b1054c..fc93971a 100644 --- a/project/src/services/mod/dynamicRouter/DynamicRouterMod.ts +++ b/project/src/services/mod/dynamicRouter/DynamicRouterMod.ts @@ -2,10 +2,7 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router"; export class DynamicRouterMod extends DynamicRouter { - public constructor( - routes: RouteAction[], - private topLevelRoute: string, - ) + public constructor(routes: RouteAction[], private topLevelRoute: string) { super(routes); } diff --git a/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts b/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts index 3992f0c1..a980bc5b 100644 --- a/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts +++ b/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts @@ -8,11 +8,7 @@ export class DynamicRouterModService { constructor(private container: DependencyContainer) {} - public registerDynamicRouter( - name: string, - routes: RouteAction[], - topLevelRoute: string, - ): void + public registerDynamicRouter(name: string, routes: RouteAction[], topLevelRoute: string): void { this.container.register(name, {useValue: new DynamicRouterMod(routes, topLevelRoute)}); this.container.registerType("DynamicRoutes", name); diff --git a/project/src/services/mod/onLoad/OnLoadMod.ts b/project/src/services/mod/onLoad/OnLoadMod.ts index b70b4644..2f1b4458 100644 --- a/project/src/services/mod/onLoad/OnLoadMod.ts +++ b/project/src/services/mod/onLoad/OnLoadMod.ts @@ -2,10 +2,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad"; export class OnLoadMod implements OnLoad { - public constructor( - private onLoadOverride: () => void, - private getRouteOverride: () => string, - ) + public constructor(private onLoadOverride: () => void, private getRouteOverride: () => string) { // super(); } diff --git a/project/src/services/mod/onLoad/OnLoadModService.ts b/project/src/services/mod/onLoad/OnLoadModService.ts index 7ada64c6..8145d480 100644 --- a/project/src/services/mod/onLoad/OnLoadModService.ts +++ b/project/src/services/mod/onLoad/OnLoadModService.ts @@ -8,11 +8,7 @@ export class OnLoadModService constructor(protected container: DependencyContainer) {} - public registerOnLoad( - name: string, - onLoad: () => void, - getRoute: () => string, - ): void + public registerOnLoad(name: string, onLoad: () => void, getRoute: () => string): void { this.container.register(name, {useValue: new OnLoadMod(onLoad, getRoute)}); this.container.registerType("OnLoad", name); diff --git a/project/src/services/mod/onUpdate/OnUpdateModService.ts b/project/src/services/mod/onUpdate/OnUpdateModService.ts index b8885d2d..5c55e677 100644 --- a/project/src/services/mod/onUpdate/OnUpdateModService.ts +++ b/project/src/services/mod/onUpdate/OnUpdateModService.ts @@ -8,11 +8,7 @@ export class OnUpdateModService constructor(protected container: DependencyContainer) {} - public registerOnUpdate( - name: string, - onUpdate: (timeSinceLastRun: number) => boolean, - getRoute: () => string, - ): void + public registerOnUpdate(name: string, onUpdate: (timeSinceLastRun: number) => boolean, getRoute: () => string): void { this.container.register(name, {useValue: new OnUpdateMod(onUpdate, getRoute)}); this.container.registerType("OnUpdate", name); diff --git a/project/src/services/mod/staticRouter/StaticRouterMod.ts b/project/src/services/mod/staticRouter/StaticRouterMod.ts index 01977a6f..04e07227 100644 --- a/project/src/services/mod/staticRouter/StaticRouterMod.ts +++ b/project/src/services/mod/staticRouter/StaticRouterMod.ts @@ -2,10 +2,7 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router"; export class StaticRouterMod extends StaticRouter { - public constructor( - routes: RouteAction[], - private topLevelRoute: string, - ) + public constructor(routes: RouteAction[], private topLevelRoute: string) { super(routes); } diff --git a/project/src/services/mod/staticRouter/StaticRouterModService.ts b/project/src/services/mod/staticRouter/StaticRouterModService.ts index 70502e87..14047c09 100644 --- a/project/src/services/mod/staticRouter/StaticRouterModService.ts +++ b/project/src/services/mod/staticRouter/StaticRouterModService.ts @@ -8,11 +8,7 @@ export class StaticRouterModService { constructor(protected container: DependencyContainer) {} - public registerStaticRouter( - name: string, - routes: RouteAction[], - topLevelRoute: string, - ): void + public registerStaticRouter(name: string, routes: RouteAction[], topLevelRoute: string): void { this.container.register(name, {useValue: new StaticRouterMod(routes, topLevelRoute)}); this.container.registerType("StaticRoutes", name); diff --git a/project/src/utils/DatabaseImporter.ts b/project/src/utils/DatabaseImporter.ts index b22e83f4..c348e6d5 100644 --- a/project/src/utils/DatabaseImporter.ts +++ b/project/src/utils/DatabaseImporter.ts @@ -45,9 +45,7 @@ export class DatabaseImporter implements OnLoad */ public getSptDataPath(): string { - return (globalThis.G_RELEASE_CONFIGURATION) - ? "Aki_Data/Server/" - : "./assets/"; + return (globalThis.G_RELEASE_CONFIGURATION) ? "Aki_Data/Server/" : "./assets/"; } public async onLoad(): Promise diff --git a/project/src/utils/HashUtil.ts b/project/src/utils/HashUtil.ts index 043f3cbc..6b9d0d2e 100644 --- a/project/src/utils/HashUtil.ts +++ b/project/src/utils/HashUtil.ts @@ -6,9 +6,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @injectable() export class HashUtil { - constructor( - @inject("TimeUtil") protected timeUtil: TimeUtil, - ) + constructor(@inject("TimeUtil") protected timeUtil: TimeUtil) {} /** diff --git a/project/src/utils/HttpFileUtil.ts b/project/src/utils/HttpFileUtil.ts index 358471cc..baca8734 100644 --- a/project/src/utils/HttpFileUtil.ts +++ b/project/src/utils/HttpFileUtil.ts @@ -7,9 +7,7 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; @injectable() export class HttpFileUtil { - constructor( - @inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper, - ) + constructor(@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper) { } diff --git a/project/src/utils/HttpResponseUtil.ts b/project/src/utils/HttpResponseUtil.ts index f10fdaba..5549dfa0 100644 --- a/project/src/utils/HttpResponseUtil.ts +++ b/project/src/utils/HttpResponseUtil.ts @@ -18,12 +18,10 @@ export class HttpResponseUtil protected clearString(s: string): any { - return s.replace(/[\b]/g, "") - .replace(/[\f]/g, "") - .replace(/[\n]/g, "") - .replace(/[\r]/g, "") - .replace(/[\t]/g, "") - .replace(/[\\]/g, ""); + return s.replace(/[\b]/g, "").replace(/[\f]/g, "").replace(/[\n]/g, "").replace(/[\r]/g, "").replace( + /[\t]/g, + "", + ).replace(/[\\]/g, ""); } /** @@ -43,11 +41,7 @@ export class HttpResponseUtil public getUnclearedBody(data: any, err = 0, errmsg = null): string { - return this.jsonUtil.serialize({ - err: err, - errmsg: errmsg, - data: data, - }); + return this.jsonUtil.serialize({err: err, errmsg: errmsg, data: data}); } public emptyResponse(): IGetBodyResponseData @@ -71,11 +65,7 @@ export class HttpResponseUtil errorCode = BackendErrorCodes.NONE, ): IItemEventRouterResponse { - output.warnings = [{ - index: 0, - errmsg: message, - code: errorCode.toString(), - }]; + output.warnings = [{index: 0, errmsg: message, code: errorCode.toString()}]; return output; } diff --git a/project/src/utils/ImporterUtil.ts b/project/src/utils/ImporterUtil.ts index ee92c21e..51173cec 100644 --- a/project/src/utils/ImporterUtil.ts +++ b/project/src/utils/ImporterUtil.ts @@ -9,10 +9,7 @@ import { Queue } from "@spt-aki/utils/collections/queue/Queue"; @injectable() export class ImporterUtil { - constructor( - @inject("VFS") protected vfs: VFS, - @inject("JsonUtil") protected jsonUtil: JsonUtil, - ) + constructor(@inject("VFS") protected vfs: VFS, @inject("JsonUtil") protected jsonUtil: JsonUtil) {} /** @@ -74,13 +71,9 @@ export class ImporterUtil * @param filepath Path to folder with files * @returns */ - public loadRecursive( - filepath: string, - onReadCallback: (fileWithPath: string, data: string) => void = () => - {}, - onObjectDeserialized: (fileWithPath: string, object: any) => void = () => - {}, - ): T + public loadRecursive(filepath: string, onReadCallback: (fileWithPath: string, data: string) => void = () => + {}, onObjectDeserialized: (fileWithPath: string, object: any) => void = () => + {}): T { const result = {} as T; @@ -148,18 +141,16 @@ export class ImporterUtil { const filePathAndName = `${fileNode.filePath}${fileNode.fileName}`; promises.push( - this.vfs.readFileAsync(filePathAndName) - .then(async (fileData) => - { - onReadCallback(filePathAndName, fileData); - return this.jsonUtil.deserializeWithCacheCheckAsync(fileData, filePathAndName); - }) - .then(async (fileDeserialized) => - { - onObjectDeserialized(filePathAndName, fileDeserialized); - const strippedFilePath = this.vfs.stripExtension(filePathAndName).replace(filepath, ""); - this.placeObject(fileDeserialized, strippedFilePath, result, strippablePath); - }), + this.vfs.readFileAsync(filePathAndName).then(async (fileData) => + { + onReadCallback(filePathAndName, fileData); + return this.jsonUtil.deserializeWithCacheCheckAsync(fileData, filePathAndName); + }).then(async (fileDeserialized) => + { + onObjectDeserialized(filePathAndName, fileDeserialized); + const strippedFilePath = this.vfs.stripExtension(filePathAndName).replace(filepath, ""); + this.placeObject(fileDeserialized, strippedFilePath, result, strippablePath); + }), ); } } @@ -196,9 +187,6 @@ export class ImporterUtil class VisitNode { - constructor( - public filePath: string, - public fileName: string, - ) + constructor(public filePath: string, public fileName: string) {} } diff --git a/project/src/utils/JsonUtil.ts b/project/src/utils/JsonUtil.ts index 73a7666c..a4cbe075 100644 --- a/project/src/utils/JsonUtil.ts +++ b/project/src/utils/JsonUtil.ts @@ -63,11 +63,7 @@ export class JsonUtil * @param options Stringify options or a replacer. * @returns The string converted from the JavaScript value */ - public serializeJsonC( - data: any, - filename?: string | null, - options?: IStringifyOptions | Reviver, - ): string + public serializeJsonC(data: any, filename?: string | null, options?: IStringifyOptions | Reviver): string { try { @@ -81,11 +77,7 @@ export class JsonUtil } } - public serializeJson5( - data: any, - filename?: string | null, - prettify = false, - ): string + public serializeJson5(data: any, filename?: string | null, prettify = false): string { try { diff --git a/project/src/utils/ObjectId.ts b/project/src/utils/ObjectId.ts index 6656bb97..4438e5e2 100644 --- a/project/src/utils/ObjectId.ts +++ b/project/src/utils/ObjectId.ts @@ -6,9 +6,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; @injectable() export class ObjectId { - constructor( - @inject("TimeUtil") protected timeUtil: TimeUtil, - ) + constructor(@inject("TimeUtil") protected timeUtil: TimeUtil) {} protected randomBytes = crypto.randomBytes(5); diff --git a/project/src/utils/RandomUtil.ts b/project/src/utils/RandomUtil.ts index 4e0ed9c3..5b45bf82 100644 --- a/project/src/utils/RandomUtil.ts +++ b/project/src/utils/RandomUtil.ts @@ -21,11 +21,7 @@ import { MathUtil } from "@spt-aki/utils/MathUtil"; */ export class ProbabilityObjectArray extends Array> { - constructor( - private mathUtil: MathUtil, - private jsonUtil: JsonUtil, - ...items: ProbabilityObject[] - ) + constructor(private mathUtil: MathUtil, private jsonUtil: JsonUtil, ...items: ProbabilityObject[]) { super(); this.push(...items); @@ -204,10 +200,7 @@ export class ProbabilityObject @injectable() export class RandomUtil { - constructor( - @inject("JsonUtil") protected jsonUtil: JsonUtil, - @inject("WinstonLogger") protected logger: ILogger, - ) + constructor(@inject("JsonUtil") protected jsonUtil: JsonUtil, @inject("WinstonLogger") protected logger: ILogger) { } @@ -381,10 +374,7 @@ export class RandomUtil if (n < 1) { - throw { - name: "Invalid argument", - message: `'n' must be 1 or greater (received ${n})`, - }; + throw {name: "Invalid argument", message: `'n' must be 1 or greater (received ${n})`}; } if (min === max) @@ -453,10 +443,7 @@ export class RandomUtil currentIndex--; // And swap it with the current element. - [array[currentIndex], array[randomIndex]] = [ - array[randomIndex], - array[currentIndex], - ]; + [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; } return array; diff --git a/project/src/utils/VFS.ts b/project/src/utils/VFS.ts index 05198a83..fd835750 100644 --- a/project/src/utils/VFS.ts +++ b/project/src/utils/VFS.ts @@ -26,9 +26,7 @@ export class VFS rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; - constructor( - @inject("AsyncQueue") protected asyncQueue: IAsyncQueue, - ) + constructor(@inject("AsyncQueue") protected asyncQueue: IAsyncQueue) { this.accessFilePromisify = promisify(fs.access); this.copyFilePromisify = promisify(fs.copyFile); @@ -52,10 +50,7 @@ export class VFS try { // Create the command to add to the queue - const command = { - uuid: crypto.randomUUID(), - cmd: async () => await this.accessFilePromisify(filepath), - }; + const command = {uuid: crypto.randomUUID(), cmd: async () => await this.accessFilePromisify(filepath)}; // Wait for the command completion await this.asyncQueue.waitFor(command); @@ -76,10 +71,7 @@ export class VFS public async copyAsync(filepath: fs.PathLike, target: fs.PathLike): Promise { - const command = { - uuid: crypto.randomUUID(), - cmd: async () => await this.copyFilePromisify(filepath, target), - }; + const command = {uuid: crypto.randomUUID(), cmd: async () => await this.copyFilePromisify(filepath, target)}; await this.asyncQueue.waitFor(command); } diff --git a/project/src/utils/Watermark.ts b/project/src/utils/Watermark.ts index 226d649d..33dce3fe 100644 --- a/project/src/utils/Watermark.ts +++ b/project/src/utils/Watermark.ts @@ -14,9 +14,7 @@ export class WatermarkLocale protected warning: string[]; protected modding: string[]; - constructor( - @inject("LocalisationService") protected localisationService: LocalisationService, - ) + constructor(@inject("LocalisationService") protected localisationService: LocalisationService) { this.description = [ this.localisationService.getText("watermark-discord_url"), diff --git a/project/src/utils/logging/AbstractWinstonLogger.ts b/project/src/utils/logging/AbstractWinstonLogger.ts index 95761eba..1facf66a 100644 --- a/project/src/utils/logging/AbstractWinstonLogger.ts +++ b/project/src/utils/logging/AbstractWinstonLogger.ts @@ -17,22 +17,8 @@ export abstract class AbstractWinstonLogger implements ILogger protected showDebugInConsole = false; protected filePath: string; protected logLevels = { - levels: { - error: 0, - warn: 1, - succ: 2, - info: 3, - custom: 4, - debug: 5, - }, - colors: { - error: "red", - warn: "yellow", - succ: "green", - info: "white", - custom: "black", - debug: "gray", - }, + levels: {error: 0, warn: 1, succ: 2, info: 3, custom: 4, debug: 5}, + colors: {error: "red", warn: "yellow", succ: "green", info: "white", custom: "black", debug: "gray"}, bgColors: { default: "", blackBG: "blackBG", @@ -48,9 +34,7 @@ export abstract class AbstractWinstonLogger implements ILogger protected logger: winston.Logger & SptLogger; protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; - constructor( - protected asyncQueue: IAsyncQueue, - ) + constructor(protected asyncQueue: IAsyncQueue) { this.filePath = `${this.getFilePath()}${this.getFileName()}`; this.writeFilePromisify = promisify(fs.writeFile); @@ -101,10 +85,7 @@ export abstract class AbstractWinstonLogger implements ILogger } winston.addColors(this.logLevels.colors); - this.logger = createLogger({ - levels: this.logLevels.levels, - transports: [...transportsList], - }); + this.logger = createLogger({levels: this.logLevels.levels, transports: [...transportsList]}); if (this.isLogExceptions()) { @@ -165,10 +146,7 @@ export abstract class AbstractWinstonLogger implements ILogger if (typeof data === "string") { - command = { - uuid: crypto.randomUUID(), - cmd: async () => await tmpLogger.log("custom", data), - }; + command = {uuid: crypto.randomUUID(), cmd: async () => await tmpLogger.log("custom", data)}; } else { @@ -183,37 +161,25 @@ export abstract class AbstractWinstonLogger implements ILogger public async error(data: string | Record): Promise { - const command: ICommand = { - uuid: crypto.randomUUID(), - cmd: async () => await this.logger.error(data), - }; + const command: ICommand = {uuid: crypto.randomUUID(), cmd: async () => await this.logger.error(data)}; await this.asyncQueue.waitFor(command); } public async warning(data: string | Record): Promise { - const command: ICommand = { - uuid: crypto.randomUUID(), - cmd: async () => await this.logger.warn(data), - }; + const command: ICommand = {uuid: crypto.randomUUID(), cmd: async () => await this.logger.warn(data)}; await this.asyncQueue.waitFor(command); } public async success(data: string | Record): Promise { - const command: ICommand = { - uuid: crypto.randomUUID(), - cmd: async () => await this.logger.succ(data), - }; + const command: ICommand = {uuid: crypto.randomUUID(), cmd: async () => await this.logger.succ(data)}; await this.asyncQueue.waitFor(command); } public async info(data: string | Record): Promise { - const command: ICommand = { - uuid: crypto.randomUUID(), - cmd: async () => await this.logger.info(data), - }; + const command: ICommand = {uuid: crypto.randomUUID(), cmd: async () => await this.logger.info(data)}; await this.asyncQueue.waitFor(command); } @@ -243,17 +209,11 @@ export abstract class AbstractWinstonLogger implements ILogger if (onlyShowInConsole) { - command = { - uuid: crypto.randomUUID(), - cmd: async () => await this.log(data, this.logLevels.colors.debug), - }; + command = {uuid: crypto.randomUUID(), cmd: async () => await this.log(data, this.logLevels.colors.debug)}; } else { - command = { - uuid: crypto.randomUUID(), - cmd: async () => await this.logger.debug(data), - }; + command = {uuid: crypto.randomUUID(), cmd: async () => await this.logger.debug(data)}; } await this.asyncQueue.waitFor(command); diff --git a/project/src/utils/logging/WinstonMainLogger.ts b/project/src/utils/logging/WinstonMainLogger.ts index ff02f482..9b7ad449 100644 --- a/project/src/utils/logging/WinstonMainLogger.ts +++ b/project/src/utils/logging/WinstonMainLogger.ts @@ -6,9 +6,7 @@ import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLog @injectable() export class WinstonMainLogger extends AbstractWinstonLogger { - constructor( - @inject("AsyncQueue") protected asyncQueue: IAsyncQueue, - ) + constructor(@inject("AsyncQueue") protected asyncQueue: IAsyncQueue) { super(asyncQueue); } diff --git a/project/src/utils/logging/WinstonRequestLogger.ts b/project/src/utils/logging/WinstonRequestLogger.ts index 9206d48e..b6812c2c 100644 --- a/project/src/utils/logging/WinstonRequestLogger.ts +++ b/project/src/utils/logging/WinstonRequestLogger.ts @@ -6,9 +6,7 @@ import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLog @injectable() export class WinstonRequestLogger extends AbstractWinstonLogger { - constructor( - @inject("AsyncQueue") protected asyncQueue: IAsyncQueue, - ) + constructor(@inject("AsyncQueue") protected asyncQueue: IAsyncQueue) { super(asyncQueue); } diff --git a/project/tests/__fixture__/profileInsurance.fixture.ts b/project/tests/__fixture__/profileInsurance.fixture.ts index de0b4f19..1e9008d2 100644 --- a/project/tests/__fixture__/profileInsurance.fixture.ts +++ b/project/tests/__fixture__/profileInsurance.fixture.ts @@ -1,1412 +1,747 @@ import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; -export const profileInsuranceFixture: Insurance[] = [ - { - scheduledTime: 1698945140, - traderId: "54cb50c76803fa8b248b4571", // Prapor - messageContent: { - templateId: "58fe0e4586f774728248ca13 4", - type: 8, - maxStorageTime: 345600, - text: "", - profileChangeEvents: [], - systemData: { - date: "01.11.2023", - time: "10:51", - location: "factory4_day", - }, - }, - items: [ - { - _id: "3679078e05f5b14466d6a730", - _tpl: "5d6d3716a4b9361bc8618872", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 55, - MaxDurability: 55, - }, - }, - }, - { - _id: "911a0f04d5d9c7e239807ae0", - _tpl: "5644bd2b4bdc2d3b4c8b4572", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 97.7862549, - MaxDurability: 100, - }, - }, - }, - { - _id: "695b13896108f765e8985698", - _tpl: "5648a69d4bdc2ded0b8b457b", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "bb49d6ceb3e87d8563a06455", - _tpl: "5df8a4d786f77412672a1e3b", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "631f8492de748dec852f7ddf", - _tpl: "64abd93857958b4249003418", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 49.2865, - MaxDurability: 60, - }, - }, - }, - { - _id: "a2b0c716162c5e31ec28c55a", - _tpl: "5a16b8a9fcdbcb00165aa6ca", - parentId: "3679078e05f5b14466d6a730", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "dc565f750342cb2d19eeda06", - _tpl: "5d6d3be5a4b9361bc73bc763", - parentId: "3679078e05f5b14466d6a730", - slotId: "mod_equipment_001", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 29.33, - MaxDurability: 29.33, - }, - }, - }, - { - _id: "e9ff62601669d9e2ea9c2fbb", - _tpl: "5d6d3943a4b9360dbc46d0cc", - parentId: "3679078e05f5b14466d6a730", - slotId: "mod_equipment_002", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "ac134d7cf6c9d8e25edd0015", - _tpl: "5c11046cd174af02a012e42b", - parentId: "a2b0c716162c5e31ec28c55a", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "22274b895ecc80d51c3cba1c", - _tpl: "5c110624d174af029e69734c", - parentId: "ac134d7cf6c9d8e25edd0015", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - Togglable: { - On: true, - }, - }, - }, - { - _id: "c9278dd8251e99578bf7a274", - _tpl: "59c6633186f7740cf0493bb9", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_gas_block", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "677c209ebb45445ebb42c405", - _tpl: "5649ab884bdc2ded0b8b457f", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_muzzle", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "8ada5c9cc26585281577c6eb", - _tpl: "5649ae4a4bdc2d1b2b8b4588", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_pistol_grip", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "4bd10f89836fd9f86aedcac1", - _tpl: "5649af094bdc2df8348b4586", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_reciever", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "8b1327270791b142ac341b03", - _tpl: "5649d9a14bdc2d79388b4580", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_sight_rear", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "566335b3df586f34b47f5e35", - _tpl: "5649b2314bdc2d79388b4576", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "da8cde1b3024c336f6e06152", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_magazine", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "1e0b177df108c0c117028812", - _tpl: "57cffddc24597763133760c6", - parentId: "c9278dd8251e99578bf7a274", - slotId: "mod_handguard", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "bc041c0011d76f714b898400", - _tpl: "57cffcd624597763133760c5", - parentId: "1e0b177df108c0c117028812", - slotId: "mod_mount_003", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "9f8d7880a6e0a47a211ec5d3", - _tpl: "58491f3324597764bc48fa02", - parentId: "8b1327270791b142ac341b03", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "402b4086535a50ef7d9cef88", - _tpl: "5649be884bdc2d79388b4577", - parentId: "566335b3df586f34b47f5e35", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "db2ef9442178910eba985b51", - _tpl: "58d2946386f774496974c37e", - parentId: "402b4086535a50ef7d9cef88", - slotId: "mod_stock_000", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "3c32b7d47ad80e83749fa906", - _tpl: "58d2912286f7744e27117493", - parentId: "db2ef9442178910eba985b51", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "574a9b5535585255cde19570", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", - slotId: "1", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "696835b2badfb96623ea887c", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", - slotId: "2", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "c2d5e23c7886e8ff02010731", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", - slotId: "3", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "306de2f475a559610a4f6f1d", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", - slotId: "4", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "eb0445b49a97e84e27d47f3c", - _tpl: "5aa2ba71e5b5b000137b758f", - parentId: "695b13896108f765e8985698", - slotId: "5", - upd: { - StackObjectsCount: 1, - }, - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - }, - { - _id: "fad89a5bdfd23e3248123346", - _tpl: "5fc5396e900b1d5091531e72", - parentId: "695b13896108f765e8985698", - slotId: "6", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "b16c2a938954cd69c687c51a", - _tpl: "5b4736b986f77405cb415c10", - parentId: "695b13896108f765e8985698", - slotId: "7", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "a2b3019ac8d340eeb068d429", - _tpl: "5ea18c84ecf1982c7712d9a2", - parentId: "695b13896108f765e8985698", - slotId: "10", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 29, - MaxDurability: 33, - }, - }, - }, - { - _id: "0b3c5d183e8b506d655f85c4", - _tpl: "644a3df63b0b6f03e101e065", - parentId: "fad89a5bdfd23e3248123346", - slotId: "mod_tactical", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "757211a0b648fe27b0475ded", - _tpl: "59f8a37386f7747af3328f06", - parentId: "b16c2a938954cd69c687c51a", - slotId: "mod_foregrip", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "870a887c63ca30fb15736b3d", - _tpl: "62a1b7fbc30cfa1d366af586", - parentId: "bb49d6ceb3e87d8563a06455", - slotId: "main", - upd: { - StackObjectsCount: 1, - }, - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - }, - { - _id: "f3de631a1bb2b74bd0160d9a", - _tpl: "5d6d3be5a4b9361bc73bc763", - parentId: "bb49d6ceb3e87d8563a06455", - slotId: "main", - location: { - x: 5, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 22.41, - MaxDurability: 22.41, - }, - }, - }, - { - _id: "351180f3248d45c71cb2ebdc", - _tpl: "57c44b372459772d2b39b8ce", - parentId: "870a887c63ca30fb15736b3d", - slotId: "main", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "7237f722106866f2df8dc8d1", - _tpl: "56e33680d2720be2748b4576", - parentId: "870a887c63ca30fb15736b3d", - slotId: "main", - location: { - x: 0, - y: 3, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "d0cf00aff56ea520cdd94330", - _tpl: "57c44dd02459772d2e0ae249", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_muzzle", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "5119653b2c66d57ee219e26f", - _tpl: "57c44f4f2459772d2c627113", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_reciever", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "ed1ac0183a8af587110aa74e", - _tpl: "5a9e81fba2750c00164f6b11", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_magazine", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "310a7d1bb07ae0e522f3f8e3", - _tpl: "5a69a2ed8dc32e000d46d1f1", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_pistol_grip", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "8a7e3489197b3b98126447fd", - _tpl: "6130ca3fd92c473c77020dbd", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_charge", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "e818616e11ae07aa05388759", - _tpl: "5dff8db859400025ea5150d4", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_mount_000", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "768812984debf2756bece089", - _tpl: "57c44e7b2459772d28133248", - parentId: "d0cf00aff56ea520cdd94330", - slotId: "mod_sight_rear", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "67c610585ed668baf4604931", - _tpl: "59eb7ebe86f7740b373438ce", - parentId: "d0cf00aff56ea520cdd94330", - slotId: "mod_mount_000", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "80e9dffa49bfe263ab0128c7", - _tpl: "6267c6396b642f77f56f5c1c", - parentId: "67c610585ed668baf4604931", - slotId: "mod_tactical_000", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "dee323443ce23ba8c54b9f1c", - _tpl: "5cc9c20cd7f00c001336c65d", - parentId: "67c610585ed668baf4604931", - slotId: "mod_tactical_001", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "3008088022dd55f1c99e5a32", - _tpl: "5c1cd46f2e22164bef5cfedb", - parentId: "67c610585ed668baf4604931", - slotId: "mod_foregrip", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "71e9f8d005c72940d857fe64", - _tpl: "59d790f486f77403cb06aec6", - parentId: "80e9dffa49bfe263ab0128c7", - slotId: "mod_flashlight", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "8c610c6cc67115a5fc1662ff", - _tpl: "56eabf3bd2720b75698b4569", - parentId: "310a7d1bb07ae0e522f3f8e3", - slotId: "mod_stock_000", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "9bf01177f0c1e346b2d65373", - _tpl: "58d2912286f7744e27117493", - parentId: "8c610c6cc67115a5fc1662ff", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "7dd43ffa6e03c2da6cddc56e", - _tpl: "6171407e50224f204c1da3c5", - parentId: "e818616e11ae07aa05388759", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "fa9da4ccf3630cb173c293f9", - _tpl: "5b3b99475acfc432ff4dcbee", - parentId: "7dd43ffa6e03c2da6cddc56e", - slotId: "mod_scope_000", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "6e2727806fb12e12123e9a57", - _tpl: "616554fe50224f204c1da2aa", - parentId: "7dd43ffa6e03c2da6cddc56e", - slotId: "mod_scope_001", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "2c868d4676adc934f897e9a7", - _tpl: "61605d88ffa6e502ac5e7eeb", - parentId: "7dd43ffa6e03c2da6cddc56e", - slotId: "mod_scope_002", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "1b159fdc14c350f8a4a7e19e", - _tpl: "58d39b0386f77443380bf13c", - parentId: "6e2727806fb12e12123e9a57", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "7691790ffc5290da292cab99", - _tpl: "61657230d92c473c770213d7", - parentId: "1b159fdc14c350f8a4a7e19e", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "012a11e7dcb1280a1ab9d2f6", - _tpl: "618168b350224f204c1da4d8", - parentId: "7237f722106866f2df8dc8d1", - slotId: "main", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "38ca7415a458c4d22ba2f3c3", - _tpl: "6130c43c67085e45ef1405a1", - parentId: "012a11e7dcb1280a1ab9d2f6", - slotId: "mod_muzzle", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "c5a0621ebf856ce1b0945efc", - _tpl: "61816fcad92c473c770215cc", - parentId: "012a11e7dcb1280a1ab9d2f6", - slotId: "mod_sight_front", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "a74677b17c1c49edc002df9b", - _tpl: "5dfa3d2b0dee1b22f862eade", - parentId: "38ca7415a458c4d22ba2f3c3", - slotId: "mod_muzzle", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - ], +export const profileInsuranceFixture: Insurance[] = [{ + scheduledTime: 1698945140, + traderId: "54cb50c76803fa8b248b4571", // Prapor + messageContent: { + templateId: "58fe0e4586f774728248ca13 4", + type: 8, + maxStorageTime: 345600, + text: "", + profileChangeEvents: [], + systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}, }, - { - scheduledTime: 1698945140, - traderId: "54cb57776803fa99248b456e", // Therapist - messageContent: { - templateId: "58fe0e3486f77471f772c3f2 2", - type: 8, - maxStorageTime: 518400, - text: "", - profileChangeEvents: [], - systemData: { - date: "01.11.2023", - time: "11:18", - location: "factory4_day", - }, - }, - items: [ - { - _id: "5ae1c2b99a0a339adc620148", - _tpl: "5cebec38d7f00c00110a652a", - parentId: "ad018df9da0cbf2726394ef1", - slotId: "mod_mount_000", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "30f4bcb87bcc4604e27c02c1", - _tpl: "5cc70146e4a949000d73bf6b", - parentId: "ad018df9da0cbf2726394ef1", - slotId: "mod_mount_001", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "ad018df9da0cbf2726394ef1", - _tpl: "5cc70102e4a949035e43ba74", - parentId: "3bc4ff5bd99f165dc75cbd25", - slotId: "main", - upd: { - StackObjectsCount: 1, - }, - location: { - x: 3, - y: 0, - r: "Horizontal", - isSearched: true, - }, - }, - { - _id: "12c243bd6b3e486e61325f81", - _tpl: "5cc82d76e24e8d00134b4b83", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 99.93771, - MaxDurability: 100, - }, - }, - }, - { - _id: "760652d86ee78eed513e0ad7", - _tpl: "5ab8f39486f7745cd93a1cca", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "61ab4afefac354dfc64c7874", - _tpl: "5b432d215acfc4771e1c6624", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 30, - MaxDurability: 30, - }, - }, - }, - { - _id: "285e9d9ae196ae4e336cd04f", - _tpl: "5d5d87f786f77427997cfaef", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 75, - MaxDurability: 80, - }, - }, - }, - { - _id: "3bc4ff5bd99f165dc75cbd25", - _tpl: "5f5e467b0bc58666c37e7821", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "6bf5d8ee81a3c9aec21bbbad", - _tpl: "5d5fca1ea4b93635fd598c07", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "2371438cf809b5e483bf5d85", - _tpl: "5cc70093e4a949033c734312", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_magazine", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "7f890346ea5b2cbc68c3170f", - _tpl: "5cc700b9e4a949000f0f0f25", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "12fb79a9c4929009ff8d89e1", - _tpl: "5cc700ede4a949033c734315", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_reciever", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "d4c5274082ed716e19447f46", - _tpl: "5cc701d7e4a94900100ac4e7", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_barrel", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "d819dd4d2b13de10e9d6d805", - _tpl: "5cc6ea85e4a949000e1ea3c3", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_charge", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "fc9a664cacc477c4e725a81a", - _tpl: "5cc700d4e4a949000f0f0f28", - parentId: "7f890346ea5b2cbc68c3170f", - slotId: "mod_stock_000", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "372891c593cf14e176b93ce2", - _tpl: "5cc7012ae4a949001252b43e", - parentId: "12fb79a9c4929009ff8d89e1", - slotId: "mod_mount_000", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "bd196435a57bdc433df1e49d", - _tpl: "5cc7012ae4a949001252b43e", - parentId: "12fb79a9c4929009ff8d89e1", - slotId: "mod_mount_001", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "ea3349d29797354d835c2192", - _tpl: "58491f3324597764bc48fa02", - parentId: "12fb79a9c4929009ff8d89e1", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "4ccf7c74ca7d2167deb0ae5c", - _tpl: "626becf9582c3e319310b837", - parentId: "372891c593cf14e176b93ce2", - slotId: "mod_tactical", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "adfd3640fc93daf21c721ca6", - _tpl: "5cc9c20cd7f00c001336c65d", - parentId: "bd196435a57bdc433df1e49d", - slotId: "mod_tactical", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "deeb36b1812790b0145d2532", - _tpl: "5a16badafcdbcb001865f72d", - parentId: "61ab4afefac354dfc64c7874", - slotId: "mod_equipment_000", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 12, - MaxDurability: 25, - }, - }, - }, - { - _id: "4c0e0548df904c384569190c", - _tpl: "5ea058e01dbce517f324b3e2", - parentId: "61ab4afefac354dfc64c7874", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 3, - MaxDurability: 39, - }, - }, - }, - { - _id: "da82c293cabc705b30fef93a", - _tpl: "5a398ab9c4a282000c5a9842", - parentId: "61ab4afefac354dfc64c7874", - slotId: "mod_mount", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "b8fc94611def6e9ba534a8b3", - _tpl: "5a16b8a9fcdbcb00165aa6ca", - parentId: "4c0e0548df904c384569190c", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "20d6193c1f399e6326ebbc10", - _tpl: "5a16b93dfcdbcbcae6687261", - parentId: "b8fc94611def6e9ba534a8b3", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "065c4f13b2bd8be266e1e809", - _tpl: "57235b6f24597759bf5a30f1", - parentId: "20d6193c1f399e6326ebbc10", - slotId: "mod_nvg", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - Togglable: { - On: true, - }, - }, - }, - { - _id: "1883b955ab202fa099809278", - _tpl: "57d17c5e2459775a5c57d17d", - parentId: "da82c293cabc705b30fef93a", - slotId: "mod_flashlight", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "e3c9e50ce31900c950b4ff6f", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "1", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "193259b5eb848af4d036bee5", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "2", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "f97ce69443f63bbe8f8097a7", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "3", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "5d1c154a8abcfa934e477ac4", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "4", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "289f7af841690c5388095477", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "5", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "3e6d578165b61aef9865f677", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "6", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "338682523f8504f97f84f3ab", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "7", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "6d18ac01aa04b16e4f0d5d2f", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "8", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "ac4ed54d61daa0c5219f8522", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "9", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "2460460ef3d3df5c1ce07edb", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "10", - location: { - x: 0, - y: 0, - r: "Vertical", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "3aeb18aac0b532f34255f162", - _tpl: "5cc70146e4a949000d73bf6b", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "11", - upd: { - StackObjectsCount: 1, - }, - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - }, - { - _id: "bdb46107abbf1d92edaaf14e", - _tpl: "6272379924e29f06af4d5ecb", - parentId: "3aeb18aac0b532f34255f162", - slotId: "mod_tactical", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "0caadd8507a36d9ea871e88e", - _tpl: "5ab8f04f86f774585f4237d8", - parentId: "3bc4ff5bd99f165dc75cbd25", - slotId: "main", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "240046eebc9040c1d7e58611", - _tpl: "5ac66d015acfc400180ae6e4", - parentId: "0caadd8507a36d9ea871e88e", - slotId: "main", - location: { - x: 0, - y: 0, - r: "Horizontal", - isSearched: true, - }, - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { - Durability: 32, - MaxDurability: 59, - }, - Foldable: { - Folded: true, - }, - }, - }, - { - _id: "70b23c628fa17699d9a71e94", - _tpl: "59c6633186f7740cf0493bb9", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_gas_block", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { - Durability: 32, - MaxDurability: 59, - }, - }, - }, - { - _id: "7cc2e24dc6bc0716bdddc472", - _tpl: "5943ee5a86f77413872d25ec", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_muzzle", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "7a51ebbad703082660d59d27", - _tpl: "5649ade84bdc2d1b2b8b4587", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_pistol_grip", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { - Durability: 32, - MaxDurability: 59, - }, - }, - }, - { - _id: "b481bc57436ed9a0c3abe7f3", - _tpl: "5d2c76ed48f03532f2136169", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_reciever", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "5774ef80597c7f91bff40dbb", - _tpl: "5ac50c185acfc400163398d4", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { - Durability: 32, - MaxDurability: 59, - }, - }, - }, - { - _id: "8b7c8e6ba172ac390c99a2ae", - _tpl: "5ac66c5d5acfc4001718d314", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_magazine", - upd: { - StackObjectsCount: 1, - }, - }, - { - _id: "1ed3a416b1fc7adbed1160df", - _tpl: "6130ca3fd92c473c77020dbd", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_charge", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "bbe087661947c0d9c1cde146", - _tpl: "5648b1504bdc2d9d488b4584", - parentId: "70b23c628fa17699d9a71e94", - slotId: "mod_handguard", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { - Durability: 32, - MaxDurability: 59, - }, - }, - }, - { - _id: "724388f8110434efccd79b3a", - _tpl: "544a3a774bdc2d3a388b4567", - parentId: "b481bc57436ed9a0c3abe7f3", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - { - _id: "8581038b0f795618a3d26c94", - _tpl: "58d268fc86f774111273f8c2", - parentId: "724388f8110434efccd79b3a", - slotId: "mod_scope", - upd: { - StackObjectsCount: 1, - Repairable: { - Durability: 100, - MaxDurability: 100, - }, - }, - }, - ], + items: [{ + _id: "3679078e05f5b14466d6a730", + _tpl: "5d6d3716a4b9361bc8618872", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1, Repairable: {Durability: 55, MaxDurability: 55}}, + }, { + _id: "911a0f04d5d9c7e239807ae0", + _tpl: "5644bd2b4bdc2d3b4c8b4572", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1, Repairable: {Durability: 97.7862549, MaxDurability: 100}}, + }, { + _id: "695b13896108f765e8985698", + _tpl: "5648a69d4bdc2ded0b8b457b", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1}, + }, { + _id: "bb49d6ceb3e87d8563a06455", + _tpl: "5df8a4d786f77412672a1e3b", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1}, + }, { + _id: "631f8492de748dec852f7ddf", + _tpl: "64abd93857958b4249003418", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1, Repairable: {Durability: 49.2865, MaxDurability: 60}}, + }, { + _id: "a2b0c716162c5e31ec28c55a", + _tpl: "5a16b8a9fcdbcb00165aa6ca", + parentId: "3679078e05f5b14466d6a730", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1}, + }, { + _id: "dc565f750342cb2d19eeda06", + _tpl: "5d6d3be5a4b9361bc73bc763", + parentId: "3679078e05f5b14466d6a730", + slotId: "mod_equipment_001", + upd: {StackObjectsCount: 1, Repairable: {Durability: 29.33, MaxDurability: 29.33}}, + }, { + _id: "e9ff62601669d9e2ea9c2fbb", + _tpl: "5d6d3943a4b9360dbc46d0cc", + parentId: "3679078e05f5b14466d6a730", + slotId: "mod_equipment_002", + upd: {StackObjectsCount: 1}, + }, { + _id: "ac134d7cf6c9d8e25edd0015", + _tpl: "5c11046cd174af02a012e42b", + parentId: "a2b0c716162c5e31ec28c55a", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1}, + }, { + _id: "22274b895ecc80d51c3cba1c", + _tpl: "5c110624d174af029e69734c", + parentId: "ac134d7cf6c9d8e25edd0015", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}, Togglable: {On: true}}, + }, { + _id: "c9278dd8251e99578bf7a274", + _tpl: "59c6633186f7740cf0493bb9", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_gas_block", + upd: {StackObjectsCount: 1}, + }, { + _id: "677c209ebb45445ebb42c405", + _tpl: "5649ab884bdc2ded0b8b457f", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_muzzle", + upd: {StackObjectsCount: 1}, + }, { + _id: "8ada5c9cc26585281577c6eb", + _tpl: "5649ae4a4bdc2d1b2b8b4588", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_pistol_grip", + upd: {StackObjectsCount: 1}, + }, { + _id: "4bd10f89836fd9f86aedcac1", + _tpl: "5649af094bdc2df8348b4586", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_reciever", + upd: {StackObjectsCount: 1}, + }, { + _id: "8b1327270791b142ac341b03", + _tpl: "5649d9a14bdc2d79388b4580", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_sight_rear", + upd: {StackObjectsCount: 1}, + }, { + _id: "566335b3df586f34b47f5e35", + _tpl: "5649b2314bdc2d79388b4576", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_stock", + upd: {StackObjectsCount: 1}, + }, { + _id: "da8cde1b3024c336f6e06152", + _tpl: "55d482194bdc2d1d4e8b456b", + parentId: "911a0f04d5d9c7e239807ae0", + slotId: "mod_magazine", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "1e0b177df108c0c117028812", + _tpl: "57cffddc24597763133760c6", + parentId: "c9278dd8251e99578bf7a274", + slotId: "mod_handguard", + upd: {StackObjectsCount: 1}, + }, { + _id: "bc041c0011d76f714b898400", + _tpl: "57cffcd624597763133760c5", + parentId: "1e0b177df108c0c117028812", + slotId: "mod_mount_003", + upd: {StackObjectsCount: 1}, + }, { + _id: "9f8d7880a6e0a47a211ec5d3", + _tpl: "58491f3324597764bc48fa02", + parentId: "8b1327270791b142ac341b03", + slotId: "mod_scope", + upd: {StackObjectsCount: 1}, + }, { + _id: "402b4086535a50ef7d9cef88", + _tpl: "5649be884bdc2d79388b4577", + parentId: "566335b3df586f34b47f5e35", + slotId: "mod_stock", + upd: {StackObjectsCount: 1}, + }, { + _id: "db2ef9442178910eba985b51", + _tpl: "58d2946386f774496974c37e", + parentId: "402b4086535a50ef7d9cef88", + slotId: "mod_stock_000", + upd: {StackObjectsCount: 1}, + }, { + _id: "3c32b7d47ad80e83749fa906", + _tpl: "58d2912286f7744e27117493", + parentId: "db2ef9442178910eba985b51", + slotId: "mod_stock", + upd: {StackObjectsCount: 1}, + }, { + _id: "574a9b5535585255cde19570", + _tpl: "55d482194bdc2d1d4e8b456b", + parentId: "695b13896108f765e8985698", + slotId: "1", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "696835b2badfb96623ea887c", + _tpl: "55d482194bdc2d1d4e8b456b", + parentId: "695b13896108f765e8985698", + slotId: "2", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "c2d5e23c7886e8ff02010731", + _tpl: "55d482194bdc2d1d4e8b456b", + parentId: "695b13896108f765e8985698", + slotId: "3", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "306de2f475a559610a4f6f1d", + _tpl: "55d482194bdc2d1d4e8b456b", + parentId: "695b13896108f765e8985698", + slotId: "4", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "eb0445b49a97e84e27d47f3c", + _tpl: "5aa2ba71e5b5b000137b758f", + parentId: "695b13896108f765e8985698", + slotId: "5", + upd: {StackObjectsCount: 1}, + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + }, { + _id: "fad89a5bdfd23e3248123346", + _tpl: "5fc5396e900b1d5091531e72", + parentId: "695b13896108f765e8985698", + slotId: "6", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "b16c2a938954cd69c687c51a", + _tpl: "5b4736b986f77405cb415c10", + parentId: "695b13896108f765e8985698", + slotId: "7", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "a2b3019ac8d340eeb068d429", + _tpl: "5ea18c84ecf1982c7712d9a2", + parentId: "695b13896108f765e8985698", + slotId: "10", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 29, MaxDurability: 33}}, + }, { + _id: "0b3c5d183e8b506d655f85c4", + _tpl: "644a3df63b0b6f03e101e065", + parentId: "fad89a5bdfd23e3248123346", + slotId: "mod_tactical", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "757211a0b648fe27b0475ded", + _tpl: "59f8a37386f7747af3328f06", + parentId: "b16c2a938954cd69c687c51a", + slotId: "mod_foregrip", + upd: {StackObjectsCount: 1}, + }, { + _id: "870a887c63ca30fb15736b3d", + _tpl: "62a1b7fbc30cfa1d366af586", + parentId: "bb49d6ceb3e87d8563a06455", + slotId: "main", + upd: {StackObjectsCount: 1}, + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + }, { + _id: "f3de631a1bb2b74bd0160d9a", + _tpl: "5d6d3be5a4b9361bc73bc763", + parentId: "bb49d6ceb3e87d8563a06455", + slotId: "main", + location: {x: 5, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 22.41, MaxDurability: 22.41}}, + }, { + _id: "351180f3248d45c71cb2ebdc", + _tpl: "57c44b372459772d2b39b8ce", + parentId: "870a887c63ca30fb15736b3d", + slotId: "main", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "7237f722106866f2df8dc8d1", + _tpl: "56e33680d2720be2748b4576", + parentId: "870a887c63ca30fb15736b3d", + slotId: "main", + location: {x: 0, y: 3, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "d0cf00aff56ea520cdd94330", + _tpl: "57c44dd02459772d2e0ae249", + parentId: "351180f3248d45c71cb2ebdc", + slotId: "mod_muzzle", + upd: {StackObjectsCount: 1}, + }, { + _id: "5119653b2c66d57ee219e26f", + _tpl: "57c44f4f2459772d2c627113", + parentId: "351180f3248d45c71cb2ebdc", + slotId: "mod_reciever", + upd: {StackObjectsCount: 1}, + }, { + _id: "ed1ac0183a8af587110aa74e", + _tpl: "5a9e81fba2750c00164f6b11", + parentId: "351180f3248d45c71cb2ebdc", + slotId: "mod_magazine", + upd: {StackObjectsCount: 1}, + }, { + _id: "310a7d1bb07ae0e522f3f8e3", + _tpl: "5a69a2ed8dc32e000d46d1f1", + parentId: "351180f3248d45c71cb2ebdc", + slotId: "mod_pistol_grip", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "8a7e3489197b3b98126447fd", + _tpl: "6130ca3fd92c473c77020dbd", + parentId: "351180f3248d45c71cb2ebdc", + slotId: "mod_charge", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "e818616e11ae07aa05388759", + _tpl: "5dff8db859400025ea5150d4", + parentId: "351180f3248d45c71cb2ebdc", + slotId: "mod_mount_000", + upd: {StackObjectsCount: 1}, + }, { + _id: "768812984debf2756bece089", + _tpl: "57c44e7b2459772d28133248", + parentId: "d0cf00aff56ea520cdd94330", + slotId: "mod_sight_rear", + upd: {StackObjectsCount: 1}, + }, { + _id: "67c610585ed668baf4604931", + _tpl: "59eb7ebe86f7740b373438ce", + parentId: "d0cf00aff56ea520cdd94330", + slotId: "mod_mount_000", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "80e9dffa49bfe263ab0128c7", + _tpl: "6267c6396b642f77f56f5c1c", + parentId: "67c610585ed668baf4604931", + slotId: "mod_tactical_000", + upd: {StackObjectsCount: 1}, + }, { + _id: "dee323443ce23ba8c54b9f1c", + _tpl: "5cc9c20cd7f00c001336c65d", + parentId: "67c610585ed668baf4604931", + slotId: "mod_tactical_001", + upd: {StackObjectsCount: 1}, + }, { + _id: "3008088022dd55f1c99e5a32", + _tpl: "5c1cd46f2e22164bef5cfedb", + parentId: "67c610585ed668baf4604931", + slotId: "mod_foregrip", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "71e9f8d005c72940d857fe64", + _tpl: "59d790f486f77403cb06aec6", + parentId: "80e9dffa49bfe263ab0128c7", + slotId: "mod_flashlight", + upd: {StackObjectsCount: 1}, + }, { + _id: "8c610c6cc67115a5fc1662ff", + _tpl: "56eabf3bd2720b75698b4569", + parentId: "310a7d1bb07ae0e522f3f8e3", + slotId: "mod_stock_000", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "9bf01177f0c1e346b2d65373", + _tpl: "58d2912286f7744e27117493", + parentId: "8c610c6cc67115a5fc1662ff", + slotId: "mod_stock", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "7dd43ffa6e03c2da6cddc56e", + _tpl: "6171407e50224f204c1da3c5", + parentId: "e818616e11ae07aa05388759", + slotId: "mod_scope", + upd: {StackObjectsCount: 1}, + }, { + _id: "fa9da4ccf3630cb173c293f9", + _tpl: "5b3b99475acfc432ff4dcbee", + parentId: "7dd43ffa6e03c2da6cddc56e", + slotId: "mod_scope_000", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "6e2727806fb12e12123e9a57", + _tpl: "616554fe50224f204c1da2aa", + parentId: "7dd43ffa6e03c2da6cddc56e", + slotId: "mod_scope_001", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "2c868d4676adc934f897e9a7", + _tpl: "61605d88ffa6e502ac5e7eeb", + parentId: "7dd43ffa6e03c2da6cddc56e", + slotId: "mod_scope_002", + upd: {StackObjectsCount: 1}, + }, { + _id: "1b159fdc14c350f8a4a7e19e", + _tpl: "58d39b0386f77443380bf13c", + parentId: "6e2727806fb12e12123e9a57", + slotId: "mod_scope", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "7691790ffc5290da292cab99", + _tpl: "61657230d92c473c770213d7", + parentId: "1b159fdc14c350f8a4a7e19e", + slotId: "mod_scope", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "012a11e7dcb1280a1ab9d2f6", + _tpl: "618168b350224f204c1da4d8", + parentId: "7237f722106866f2df8dc8d1", + slotId: "main", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "38ca7415a458c4d22ba2f3c3", + _tpl: "6130c43c67085e45ef1405a1", + parentId: "012a11e7dcb1280a1ab9d2f6", + slotId: "mod_muzzle", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "c5a0621ebf856ce1b0945efc", + _tpl: "61816fcad92c473c770215cc", + parentId: "012a11e7dcb1280a1ab9d2f6", + slotId: "mod_sight_front", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "a74677b17c1c49edc002df9b", + _tpl: "5dfa3d2b0dee1b22f862eade", + parentId: "38ca7415a458c4d22ba2f3c3", + slotId: "mod_muzzle", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }], +}, { + scheduledTime: 1698945140, + traderId: "54cb57776803fa99248b456e", // Therapist + messageContent: { + templateId: "58fe0e3486f77471f772c3f2 2", + type: 8, + maxStorageTime: 518400, + text: "", + profileChangeEvents: [], + systemData: {date: "01.11.2023", time: "11:18", location: "factory4_day"}, }, -]; + items: [{ + _id: "5ae1c2b99a0a339adc620148", + _tpl: "5cebec38d7f00c00110a652a", + parentId: "ad018df9da0cbf2726394ef1", + slotId: "mod_mount_000", + upd: {StackObjectsCount: 1}, + }, { + _id: "30f4bcb87bcc4604e27c02c1", + _tpl: "5cc70146e4a949000d73bf6b", + parentId: "ad018df9da0cbf2726394ef1", + slotId: "mod_mount_001", + upd: {StackObjectsCount: 1}, + }, { + _id: "ad018df9da0cbf2726394ef1", + _tpl: "5cc70102e4a949035e43ba74", + parentId: "3bc4ff5bd99f165dc75cbd25", + slotId: "main", + upd: {StackObjectsCount: 1}, + location: {x: 3, y: 0, r: "Horizontal", isSearched: true}, + }, { + _id: "12c243bd6b3e486e61325f81", + _tpl: "5cc82d76e24e8d00134b4b83", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1, Repairable: {Durability: 99.93771, MaxDurability: 100}}, + }, { + _id: "760652d86ee78eed513e0ad7", + _tpl: "5ab8f39486f7745cd93a1cca", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1}, + }, { + _id: "61ab4afefac354dfc64c7874", + _tpl: "5b432d215acfc4771e1c6624", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1, Repairable: {Durability: 30, MaxDurability: 30}}, + }, { + _id: "285e9d9ae196ae4e336cd04f", + _tpl: "5d5d87f786f77427997cfaef", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1, Repairable: {Durability: 75, MaxDurability: 80}}, + }, { + _id: "3bc4ff5bd99f165dc75cbd25", + _tpl: "5f5e467b0bc58666c37e7821", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1}, + }, { + _id: "6bf5d8ee81a3c9aec21bbbad", + _tpl: "5d5fca1ea4b93635fd598c07", + parentId: "5fe49444ae6628187a2e77b8", + slotId: "hideout", + upd: {StackObjectsCount: 1}, + }, { + _id: "2371438cf809b5e483bf5d85", + _tpl: "5cc70093e4a949033c734312", + parentId: "12c243bd6b3e486e61325f81", + slotId: "mod_magazine", + upd: {StackObjectsCount: 1}, + }, { + _id: "7f890346ea5b2cbc68c3170f", + _tpl: "5cc700b9e4a949000f0f0f25", + parentId: "12c243bd6b3e486e61325f81", + slotId: "mod_stock", + upd: {StackObjectsCount: 1}, + }, { + _id: "12fb79a9c4929009ff8d89e1", + _tpl: "5cc700ede4a949033c734315", + parentId: "12c243bd6b3e486e61325f81", + slotId: "mod_reciever", + upd: {StackObjectsCount: 1}, + }, { + _id: "d4c5274082ed716e19447f46", + _tpl: "5cc701d7e4a94900100ac4e7", + parentId: "12c243bd6b3e486e61325f81", + slotId: "mod_barrel", + upd: {StackObjectsCount: 1}, + }, { + _id: "d819dd4d2b13de10e9d6d805", + _tpl: "5cc6ea85e4a949000e1ea3c3", + parentId: "12c243bd6b3e486e61325f81", + slotId: "mod_charge", + upd: {StackObjectsCount: 1}, + }, { + _id: "fc9a664cacc477c4e725a81a", + _tpl: "5cc700d4e4a949000f0f0f28", + parentId: "7f890346ea5b2cbc68c3170f", + slotId: "mod_stock_000", + upd: {StackObjectsCount: 1}, + }, { + _id: "372891c593cf14e176b93ce2", + _tpl: "5cc7012ae4a949001252b43e", + parentId: "12fb79a9c4929009ff8d89e1", + slotId: "mod_mount_000", + upd: {StackObjectsCount: 1}, + }, { + _id: "bd196435a57bdc433df1e49d", + _tpl: "5cc7012ae4a949001252b43e", + parentId: "12fb79a9c4929009ff8d89e1", + slotId: "mod_mount_001", + upd: {StackObjectsCount: 1}, + }, { + _id: "ea3349d29797354d835c2192", + _tpl: "58491f3324597764bc48fa02", + parentId: "12fb79a9c4929009ff8d89e1", + slotId: "mod_scope", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "4ccf7c74ca7d2167deb0ae5c", + _tpl: "626becf9582c3e319310b837", + parentId: "372891c593cf14e176b93ce2", + slotId: "mod_tactical", + upd: {StackObjectsCount: 1}, + }, { + _id: "adfd3640fc93daf21c721ca6", + _tpl: "5cc9c20cd7f00c001336c65d", + parentId: "bd196435a57bdc433df1e49d", + slotId: "mod_tactical", + upd: {StackObjectsCount: 1}, + }, { + _id: "deeb36b1812790b0145d2532", + _tpl: "5a16badafcdbcb001865f72d", + parentId: "61ab4afefac354dfc64c7874", + slotId: "mod_equipment_000", + upd: {StackObjectsCount: 1, Repairable: {Durability: 12, MaxDurability: 25}}, + }, { + _id: "4c0e0548df904c384569190c", + _tpl: "5ea058e01dbce517f324b3e2", + parentId: "61ab4afefac354dfc64c7874", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1, Repairable: {Durability: 3, MaxDurability: 39}}, + }, { + _id: "da82c293cabc705b30fef93a", + _tpl: "5a398ab9c4a282000c5a9842", + parentId: "61ab4afefac354dfc64c7874", + slotId: "mod_mount", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "b8fc94611def6e9ba534a8b3", + _tpl: "5a16b8a9fcdbcb00165aa6ca", + parentId: "4c0e0548df904c384569190c", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "20d6193c1f399e6326ebbc10", + _tpl: "5a16b93dfcdbcbcae6687261", + parentId: "b8fc94611def6e9ba534a8b3", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "065c4f13b2bd8be266e1e809", + _tpl: "57235b6f24597759bf5a30f1", + parentId: "20d6193c1f399e6326ebbc10", + slotId: "mod_nvg", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}, Togglable: {On: true}}, + }, { + _id: "1883b955ab202fa099809278", + _tpl: "57d17c5e2459775a5c57d17d", + parentId: "da82c293cabc705b30fef93a", + slotId: "mod_flashlight", + upd: {StackObjectsCount: 1}, + }, { + _id: "e3c9e50ce31900c950b4ff6f", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "1", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "193259b5eb848af4d036bee5", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "2", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "f97ce69443f63bbe8f8097a7", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "3", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "5d1c154a8abcfa934e477ac4", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "4", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "289f7af841690c5388095477", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "5", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "3e6d578165b61aef9865f677", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "6", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "338682523f8504f97f84f3ab", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "7", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "6d18ac01aa04b16e4f0d5d2f", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "8", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "ac4ed54d61daa0c5219f8522", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "9", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "2460460ef3d3df5c1ce07edb", + _tpl: "5cc70093e4a949033c734312", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "10", + location: {x: 0, y: 0, r: "Vertical", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "3aeb18aac0b532f34255f162", + _tpl: "5cc70146e4a949000d73bf6b", + parentId: "285e9d9ae196ae4e336cd04f", + slotId: "11", + upd: {StackObjectsCount: 1}, + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + }, { + _id: "bdb46107abbf1d92edaaf14e", + _tpl: "6272379924e29f06af4d5ecb", + parentId: "3aeb18aac0b532f34255f162", + slotId: "mod_tactical", + upd: {StackObjectsCount: 1}, + }, { + _id: "0caadd8507a36d9ea871e88e", + _tpl: "5ab8f04f86f774585f4237d8", + parentId: "3bc4ff5bd99f165dc75cbd25", + slotId: "main", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: {StackObjectsCount: 1}, + }, { + _id: "240046eebc9040c1d7e58611", + _tpl: "5ac66d015acfc400180ae6e4", + parentId: "0caadd8507a36d9ea871e88e", + slotId: "main", + location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + upd: { + StackObjectsCount: 1, + sptPresetId: "5acf7dfc86f774401e19c390", + Repairable: {Durability: 32, MaxDurability: 59}, + Foldable: {Folded: true}, + }, + }, { + _id: "70b23c628fa17699d9a71e94", + _tpl: "59c6633186f7740cf0493bb9", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_gas_block", + upd: { + StackObjectsCount: 1, + sptPresetId: "5acf7dfc86f774401e19c390", + Repairable: {Durability: 32, MaxDurability: 59}, + }, + }, { + _id: "7cc2e24dc6bc0716bdddc472", + _tpl: "5943ee5a86f77413872d25ec", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_muzzle", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "7a51ebbad703082660d59d27", + _tpl: "5649ade84bdc2d1b2b8b4587", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_pistol_grip", + upd: { + StackObjectsCount: 1, + sptPresetId: "5acf7dfc86f774401e19c390", + Repairable: {Durability: 32, MaxDurability: 59}, + }, + }, { + _id: "b481bc57436ed9a0c3abe7f3", + _tpl: "5d2c76ed48f03532f2136169", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_reciever", + upd: {StackObjectsCount: 1}, + }, { + _id: "5774ef80597c7f91bff40dbb", + _tpl: "5ac50c185acfc400163398d4", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_stock", + upd: { + StackObjectsCount: 1, + sptPresetId: "5acf7dfc86f774401e19c390", + Repairable: {Durability: 32, MaxDurability: 59}, + }, + }, { + _id: "8b7c8e6ba172ac390c99a2ae", + _tpl: "5ac66c5d5acfc4001718d314", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_magazine", + upd: {StackObjectsCount: 1}, + }, { + _id: "1ed3a416b1fc7adbed1160df", + _tpl: "6130ca3fd92c473c77020dbd", + parentId: "240046eebc9040c1d7e58611", + slotId: "mod_charge", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "bbe087661947c0d9c1cde146", + _tpl: "5648b1504bdc2d9d488b4584", + parentId: "70b23c628fa17699d9a71e94", + slotId: "mod_handguard", + upd: { + StackObjectsCount: 1, + sptPresetId: "5acf7dfc86f774401e19c390", + Repairable: {Durability: 32, MaxDurability: 59}, + }, + }, { + _id: "724388f8110434efccd79b3a", + _tpl: "544a3a774bdc2d3a388b4567", + parentId: "b481bc57436ed9a0c3abe7f3", + slotId: "mod_scope", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }, { + _id: "8581038b0f795618a3d26c94", + _tpl: "58d268fc86f774111273f8c2", + parentId: "724388f8110434efccd79b3a", + slotId: "mod_scope", + upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + }], +}]; diff --git a/project/tests/controllers/InsuranceController.test.ts b/project/tests/controllers/InsuranceController.test.ts index 2c064266..af6f94a9 100644 --- a/project/tests/controllers/InsuranceController.test.ts +++ b/project/tests/controllers/InsuranceController.test.ts @@ -34,10 +34,7 @@ describe("InsuranceController", () => { const session1 = "session1"; const session2 = "session2"; - const profiles = { - [session1]: {}, - [session2]: {}, - }; + const profiles = {[session1]: {}, [session2]: {}}; const getProfilesSpy = vi.spyOn(insuranceController.saveServer, "getProfiles").mockReturnValue(profiles); const processReturnByProfileSpy = vi.spyOn(insuranceController, "processReturnByProfile").mockReturnValue( vi.fn(), @@ -75,10 +72,12 @@ describe("InsuranceController", () => const sessionId = "session-id"; // Mock internal methods. - const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems") - .mockReturnValue(insuranceFixture); - const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems") - .mockImplementation(vi.fn()); + const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems").mockReturnValue( + insuranceFixture, + ); + const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems").mockImplementation( + vi.fn(), + ); insuranceController.processReturnByProfile(sessionId); @@ -92,10 +91,10 @@ describe("InsuranceController", () => const sessionId = "session-id"; // Mock internal methods. - const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems") - .mockReturnValue([]); // Return an empty array. - const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems") - .mockImplementation(vi.fn()); + const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems").mockReturnValue([]); // Return an empty array. + const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems").mockImplementation( + vi.fn(), + ); insuranceController.processReturnByProfile(sessionId); @@ -113,8 +112,9 @@ describe("InsuranceController", () => const insured = JSON.parse(JSON.stringify(insuranceFixture)); // Mock getProfile to return the fixture. - const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile") - .mockReturnValue({insurance: insured}); + const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile").mockReturnValue({ + insurance: insured, + }); const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug"); // Execute the method. @@ -137,8 +137,9 @@ describe("InsuranceController", () => insured[0].scheduledTime = Math.floor((Date.now() / 1000) + (2 * 60 * 60)); // Mock getProfile to return the fixture. - const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile") - .mockReturnValue({insurance: insured}); + const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile").mockReturnValue({ + insurance: insured, + }); const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug"); // Execute the method. @@ -158,8 +159,9 @@ describe("InsuranceController", () => const insured = JSON.parse(JSON.stringify(insuranceFixture)); // Mock getProfile to return the fixture. - const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile") - .mockReturnValue({insurance: insured}); + const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile").mockReturnValue({ + insurance: insured, + }); const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug"); // Execute the method, passing in a time that's two hours in the past. The function should use this past @@ -241,25 +243,19 @@ describe("InsuranceController", () => { it("should return the total number of items in all insurance packages", () => { - const insurance = [ - { - _id: "1", - upd: 1234567890, - items: [ - {_id: "1", parentId: "1", slotId: "1"}, - {_id: "2", parentId: "1", slotId: "2"}, - ], - }, - { - _id: "2", - upd: 1234567890, - items: [ - {_id: "3", parentId: "2", slotId: "1"}, - {_id: "4", parentId: "2", slotId: "2"}, - {_id: "5", parentId: "2", slotId: "3"}, - ], - }, - ]; + const insurance = [{ + _id: "1", + upd: 1234567890, + items: [{_id: "1", parentId: "1", slotId: "1"}, {_id: "2", parentId: "1", slotId: "2"}], + }, { + _id: "2", + upd: 1234567890, + items: [{_id: "3", parentId: "2", slotId: "1"}, {_id: "4", parentId: "2", slotId: "2"}, { + _id: "5", + parentId: "2", + slotId: "3", + }], + }]; const expectedCount = 5; // 2 items in the first package + 3 items in the second package. // Execute the method. @@ -283,18 +279,7 @@ describe("InsuranceController", () => it("should return 0 if there are no items in any of the insurance packages", () => { - const insurance = [ - { - _id: "1", - upd: 1234567890, - items: [], - }, - { - _id: "2", - upd: 1234567890, - items: [], - }, - ]; + const insurance = [{_id: "1", upd: 1234567890, items: []}, {_id: "2", upd: 1234567890, items: []}]; const expectedCount = 0; // Execute the method. @@ -310,32 +295,13 @@ describe("InsuranceController", () => it("should remove the specified insurance package from the profile", () => { const sessionID = "session-id"; - const packageToRemove = { - date: "01.11.2023", - time: "10:51", - location: "factory4_day", - }; + const packageToRemove = {date: "01.11.2023", time: "10:51", location: "factory4_day"}; const profile = { - insurance: [ - { - messageContent: { - systemData: { - date: "01.11.2023", - time: "11:18", - location: "factory4_day", - }, - }, - }, - { // This one should be removed - messageContent: { - systemData: { - date: "01.11.2023", - time: "10:51", - location: "factory4_day", - }, - }, - }, - ], + insurance: [{ + messageContent: {systemData: {date: "01.11.2023", time: "11:18", location: "factory4_day"}}, + }, { // This one should be removed + messageContent: {systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}}, + }], }; // Mock the getProfile method to return the above profile. @@ -356,23 +322,11 @@ describe("InsuranceController", () => it("should log a message indicating that the package was removed", () => { const sessionID = "session-id"; - const packageToRemove = { - date: "01.11.2023", - time: "10:51", - location: "factory4_day", - }; + const packageToRemove = {date: "01.11.2023", time: "10:51", location: "factory4_day"}; const profile = { - insurance: [ - { - messageContent: { - systemData: { - date: "01.11.2023", - time: "10:51", - location: "factory4_day", - }, - }, - }, - ], + insurance: [{ + messageContent: {systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}}, + }], }; // Mock the getProfile method to return the above profile. @@ -393,23 +347,11 @@ describe("InsuranceController", () => it("should not remove any packages if the specified package is not found", () => { const sessionID = "session-id"; - const packageToRemove = { - date: "01.11.2023", - time: "10:51", - location: "factory4_day", - }; + const packageToRemove = {date: "01.11.2023", time: "10:51", location: "factory4_day"}; const profile = { - insurance: [ - { - messageContent: { - systemData: { - date: "02.11.2023", - time: "10:50", - location: "factory4_night", - }, - }, - }, - ], + insurance: [{ + messageContent: {systemData: {date: "02.11.2023", time: "10:50", location: "factory4_night"}}, + }], }; // Mock the getProfile method to return the above profile. @@ -975,10 +917,11 @@ describe("InsuranceController", () => { it("should log details for each attachment", () => { - const attachments = [ - {_id: "item1", name: "Item 1", maxPrice: 100}, - {_id: "item2", name: "Item 2", maxPrice: 200}, - ]; + const attachments = [{_id: "item1", name: "Item 1", maxPrice: 100}, { + _id: "item2", + name: "Item 2", + maxPrice: 200, + }]; // Mock the logger.debug function. const loggerDebugSpy = vi.spyOn(insuranceController.logger, "debug"); @@ -1018,8 +961,7 @@ describe("InsuranceController", () => // Mock rollForDelete to return true for the first two attachments. const mockRollForDelete = vi.spyOn(insuranceController, "rollForDelete").mockReturnValue(false) - .mockReturnValueOnce(true) - .mockReturnValueOnce(true); + .mockReturnValueOnce(true).mockReturnValueOnce(true); // Execute the method. const result = insuranceController.countSuccessfulRolls(attachments, insured.traderId); @@ -1298,8 +1240,9 @@ describe("InsuranceController", () => const insuranceFailedTpl = "failed-message-template"; // Mock the randomUtil to return a static failed template string. - const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue") - .mockReturnValue(insuranceFailedTpl); + const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue").mockReturnValue( + insuranceFailedTpl, + ); // Don't actually send the message. const sendMessageSpy = vi.spyOn(insuranceController.mailSendService, "sendLocalisedNpcMessageToPlayer") @@ -1332,8 +1275,9 @@ describe("InsuranceController", () => const insuranceFailedTpl = "failed-message-template"; // Mock the randomUtil to return a static failed template string. - const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue") - .mockReturnValue(insuranceFailedTpl); + const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue").mockReturnValue( + insuranceFailedTpl, + ); // Don't actually send the message. const sendMessageSpy = vi.spyOn(insuranceController.mailSendService, "sendLocalisedNpcMessageToPlayer") @@ -1452,18 +1396,10 @@ describe("InsuranceController", () => // Setup shared test data. pmcData = { - Inventory: { - items: [ - {_id: "item1", otherProps: "value1"}, - {_id: "item2", otherProps: "value2"}, - ], - }, + Inventory: {items: [{_id: "item1", otherProps: "value1"}, {_id: "item2", otherProps: "value2"}]}, InsuredItems: [], }; - body = { - items: ["item1", "item2"], - tid: "someTraderId", - }; + body = {items: ["item1", "item2"], tid: "someTraderId"}; sessionId = "session-id"; // Setup shared mocks. @@ -1488,10 +1424,7 @@ describe("InsuranceController", () => expect(mockPayMoney).toHaveBeenCalledWith( pmcData, { - scheme_items: [ - {id: "item1", count: 100}, - {id: "item2", count: 100}, - ], + scheme_items: [{id: "item1", count: 100}, {id: "item2", count: 100}], tid: "someTraderId", Action: "", type: "", @@ -1500,10 +1433,7 @@ describe("InsuranceController", () => scheme_id: 0, }, sessionId, - { - warnings: [], - otherProperty: "property-value", - }, + {warnings: [], otherProperty: "property-value"}, ); }); @@ -1529,10 +1459,7 @@ describe("InsuranceController", () => // Define the expected payment options structure based on the setup data. const expectedPaymentOptions = { - scheme_items: [ - {id: "item1", count: 100}, - {id: "item2", count: 100}, - ], + scheme_items: [{id: "item1", count: 100}, {id: "item2", count: 100}], tid: body.tid, Action: "", type: "", @@ -1571,11 +1498,7 @@ describe("InsuranceController", () => { // Override the payMoney mock to simulate a payment failure with a warning. const expectedPayMoneyReturn = { - warnings: [{ - index: 0, - errmsg: "Not enough money to complete transaction", - code: 500, - }], + warnings: [{index: 0, errmsg: "Not enough money to complete transaction", code: 500}], otherProperty: "property-value", }; mockPayMoney.mockReturnValue(expectedPayMoneyReturn); @@ -1594,11 +1517,7 @@ describe("InsuranceController", () => { // Override the payMoney mock to simulate a payment failure with a warning. const expectedPayMoneyReturn = { - warnings: [{ - index: 0, - errmsg: "Not enough money to complete transaction", - code: 500, - }], + warnings: [{index: 0, errmsg: "Not enough money to complete transaction", code: 500}], otherProperty: "property-value", }; mockPayMoney.mockReturnValue(expectedPayMoneyReturn); @@ -1623,11 +1542,11 @@ describe("InsuranceController", () => vi.spyOn(insuranceController.profileHelper, "getPmcProfile").mockReturnValue({ Inventory: { - items: [ - {_id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1"}, - {_id: "itemId2", _tpl: "itemTpl2", otherProperty: "property-value2"}, - {_id: "itemId3", _tpl: "itemTpl3", otherProperty: "property-value3"}, - ], + items: [{_id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1"}, { + _id: "itemId2", + _tpl: "itemTpl2", + otherProperty: "property-value2", + }, {_id: "itemId3", _tpl: "itemTpl3", otherProperty: "property-value3"}], }, }); }); @@ -1664,23 +1583,16 @@ describe("InsuranceController", () => it("should return the expected cost for each item and trader", () => { - const request = { - traders: ["prapor", "therapist"], - items: ["itemId1", "itemId2", "itemId3"], - }; + const request = {traders: ["prapor", "therapist"], items: ["itemId1", "itemId2", "itemId3"]}; const expected = { prapor: {itemTpl1: 100, itemTpl2: 200, itemTpl3: 300}, therapist: {itemTpl1: 150, itemTpl2: 250, itemTpl3: 350}, }; // Mock the InsuranceService.getPremium method to return the expected values. - vi.spyOn(insuranceController.insuranceService, "getPremium") - .mockReturnValueOnce(100) - .mockReturnValueOnce(200) - .mockReturnValueOnce(300) - .mockReturnValueOnce(150) - .mockReturnValueOnce(250) - .mockReturnValueOnce(350); + vi.spyOn(insuranceController.insuranceService, "getPremium").mockReturnValueOnce(100).mockReturnValueOnce( + 200, + ).mockReturnValueOnce(300).mockReturnValueOnce(150).mockReturnValueOnce(250).mockReturnValueOnce(350); const result = insuranceController.cost(request, sessionId); @@ -1697,14 +1609,12 @@ describe("InsuranceController", () => "itemId4", // Doesn't exist in the player's inventory. ], }; - const expected = { - prapor: {itemTpl1: 100, itemTpl2: 200}, - }; + const expected = {prapor: {itemTpl1: 100, itemTpl2: 200}}; // Mock the InsuranceService.getPremium method to return the expected values. - vi.spyOn(insuranceController.insuranceService, "getPremium") - .mockReturnValueOnce(100) - .mockReturnValueOnce(200); + vi.spyOn(insuranceController.insuranceService, "getPremium").mockReturnValueOnce(100).mockReturnValueOnce( + 200, + ); const result = insuranceController.cost(request, sessionId); diff --git a/project/tests/generators/BotGenerator.test.ts b/project/tests/generators/BotGenerator.test.ts index 2072430e..c8f72397 100644 --- a/project/tests/generators/BotGenerator.test.ts +++ b/project/tests/generators/BotGenerator.test.ts @@ -59,19 +59,11 @@ describe("BotGenerator", () => { botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 0; - const mockPlayerProfile = { - Info: { - Nickname: "Player Nickname", - Level: 1, - }, - }; + const mockPlayerProfile = {Info: {Nickname: "Player Nickname", Level: 1}}; vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(mockPlayerProfile); - const botJsonTemplate = { - firstName: ["test"], - lastName: [], - }; + const botJsonTemplate = {firstName: ["test"], lastName: []}; const sessionId = "sessionId"; const isPlayerScav = false; @@ -85,18 +77,10 @@ describe("BotGenerator", () => { botGenerator.botConfig.showTypeInNickname = true; - const mockPlayerProfile = { - Info: { - Nickname: "Player Nickname", - Level: 1, - }, - }; + const mockPlayerProfile = {Info: {Nickname: "Player Nickname", Level: 1}}; vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(mockPlayerProfile); - const botJsonTemplate = { - firstName: ["test"], - lastName: [], - }; + const botJsonTemplate = {firstName: ["test"], lastName: []}; const sessionId = "sessionId"; const isPlayerScav = false; @@ -111,19 +95,11 @@ describe("BotGenerator", () => botGenerator.botConfig.showTypeInNickname = false; botGenerator.pmcConfig.addPrefixToSameNamePMCAsPlayerChance = 100; - const mockPlayerProfile = { - Info: { - Nickname: "Player", - Level: 1, - }, - }; + const mockPlayerProfile = {Info: {Nickname: "Player", Level: 1}}; vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(mockPlayerProfile); vi.spyOn(botGenerator.localisationService, "getRandomTextThatMatchesPartialKey").mockReturnValue("test"); - const botJsonTemplate = { - firstName: ["Player"], - lastName: [], - }; + const botJsonTemplate = {firstName: ["Player"], lastName: []}; const sessionId = "sessionId"; const isPlayerScav = false; @@ -137,18 +113,10 @@ describe("BotGenerator", () => { botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100; - const mockPlayerProfile = { - Info: { - Nickname: "Player", - Level: 1, - }, - }; + const mockPlayerProfile = {Info: {Nickname: "Player", Level: 1}}; vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(mockPlayerProfile); - const botJsonTemplate = { - firstName: ["test"], - lastName: [], - }; + const botJsonTemplate = {firstName: ["test"], lastName: []}; const sessionId = "sessionId"; const isPlayerScav = true; @@ -164,18 +132,10 @@ describe("BotGenerator", () => botGenerator.databaseServer.getTables().bots.types.usec.firstName = ["usec"]; botGenerator.databaseServer.getTables().bots.types.bear.firstName = []; - const mockPlayerProfile = { - Info: { - Nickname: "Player", - Level: 1, - }, - }; + const mockPlayerProfile = {Info: {Nickname: "Player", Level: 1}}; vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(mockPlayerProfile); - const botJsonTemplate = { - firstName: ["test"], - lastName: [], - }; + const botJsonTemplate = {firstName: ["test"], lastName: []}; const sessionId = "sessionId"; const isPlayerScav = false; diff --git a/project/tests/generators/BotLevelGenerator.test.ts b/project/tests/generators/BotLevelGenerator.test.ts index dc04eef4..762cb99f 100644 --- a/project/tests/generators/BotLevelGenerator.test.ts +++ b/project/tests/generators/BotLevelGenerator.test.ts @@ -27,10 +27,7 @@ describe("BotLevelGenerator", () => { it("should return value between 5 and 10 when player is level 5 and max is 10", () => { - const levelDetails: MinMax = { - min: 5, - max: 10, - }; + const levelDetails: MinMax = {min: 5, max: 10}; const botGenerationDetails: BotGenerationDetails = { isPmc: false, @@ -53,10 +50,7 @@ describe("BotLevelGenerator", () => { it("should return 10 when player level is 5 and delta is 5", () => { - const levelDetails: MinMax = { - min: 5, - max: 10, - }; + const levelDetails: MinMax = {min: 5, max: 10}; const expTable = databaseServer.getTables().globals.config.exp.level.exp_table; @@ -67,10 +61,7 @@ describe("BotLevelGenerator", () => it("should return 79 when player level is above possible max (100), desired max is 100 and delta is 5", () => { - const levelDetails: MinMax = { - min: 100, - max: 100, - }; + const levelDetails: MinMax = {min: 100, max: 100}; const expTable = databaseServer.getTables().globals.config.exp.level.exp_table; const playerLevel = 100; diff --git a/project/tests/helpers/InRaidHelper.test.ts b/project/tests/helpers/InRaidHelper.test.ts index a6c65bd0..965ea126 100644 --- a/project/tests/helpers/InRaidHelper.test.ts +++ b/project/tests/helpers/InRaidHelper.test.ts @@ -24,16 +24,7 @@ describe("InRaidHelper", () => it("should return negative value when player kills 2 scavs as scav", () => { const fenceStanding = 0; - const postRaidPlayerVictims = [ - { - Side: "Savage", - Role: "assault", - }, - { - Side: "Savage", - Role: "assault", - }, - ]; // Kills + const postRaidPlayerVictims = [{Side: "Savage", Role: "assault"}, {Side: "Savage", Role: "assault"}]; // Kills const databaseServer = container.resolve("DatabaseServer"); const scavStandingChangeOnKill = databaseServer.getTables().bots.types.assault.experience.standingForKill; @@ -46,16 +37,7 @@ describe("InRaidHelper", () => it("should return positive value when player kills 2 PMCs of different sides as scav", () => { const fenceStanding = 0; - const postRaidPlayerVictims = [ - { - Side: "Usec", - Role: "sptUsec", - }, - { - Side: "Bear", - Role: "sptBear", - }, - ]; // Kills + const postRaidPlayerVictims = [{Side: "Usec", Role: "sptUsec"}, {Side: "Bear", Role: "sptBear"}]; // Kills const databaseServer = container.resolve("DatabaseServer"); const bearStandingChangeOnKill = databaseServer.getTables().bots.types.bear.experience.standingForKill; @@ -69,24 +51,10 @@ describe("InRaidHelper", () => it("should return negative value when player kills 1 PMC, 1 boss and 2 scavs as scav", () => { const fenceStanding = 0; - const postRaidPlayerVictims = [ - { - Side: "Usec", - Role: "sptUsec", - }, - { - Side: "savage", - Role: "assault", - }, - { - Side: "savage", - Role: "bossBoar", - }, - { - Side: "savage", - Role: "assault", - }, - ]; // Kills + const postRaidPlayerVictims = [{Side: "Usec", Role: "sptUsec"}, {Side: "savage", Role: "assault"}, { + Side: "savage", + Role: "bossBoar", + }, {Side: "savage", Role: "assault"}]; // Kills const databaseServer = container.resolve("DatabaseServer"); const usecStandingChangeOnKill = databaseServer.getTables().bots.types.bear.experience.standingForKill; @@ -104,12 +72,7 @@ describe("InRaidHelper", () => it("should return 0 when player kills bot with undefined standing as scav", () => { const fenceStanding = 0; - const postRaidPlayerVictims = [ - { - Side: "savage", - Role: "testRole", - }, - ]; // Kills + const postRaidPlayerVictims = [{Side: "savage", Role: "testRole"}]; // Kills // Fake getFenceStandingChangeForKillAsScav() returning null vi.spyOn(inraidHelper, "getFenceStandingChangeForKillAsScav").mockReturnValueOnce(null).mockReturnValueOnce( diff --git a/project/tests/helpers/ItemHelper.test.ts b/project/tests/helpers/ItemHelper.test.ts index ba98a991..b00addb7 100644 --- a/project/tests/helpers/ItemHelper.test.ts +++ b/project/tests/helpers/ItemHelper.test.ts @@ -249,10 +249,7 @@ describe("ItemHelper", () => { it("should set upd.StackObjectsCount to 1 if upd is undefined", () => { - const initialItem: Item = { - _id: "", - _tpl: "", - }; + const initialItem: Item = {_id: "", _tpl: ""}; const fixedItem = itemHelper.fixItemStackCount(initialItem); expect(fixedItem.upd).toBeDefined(); @@ -261,11 +258,7 @@ describe("ItemHelper", () => it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () => { - const initialItem: Item = { - _id: "", - _tpl: "", - upd: {}, - }; + const initialItem: Item = {_id: "", _tpl: "", upd: {}}; const fixedItem = itemHelper.fixItemStackCount(initialItem); expect(fixedItem.upd).toBeDefined(); @@ -274,13 +267,7 @@ describe("ItemHelper", () => it("should not change upd.StackObjectsCount if it is already defined", () => { - const initialItem: Item = { - _id: "", - _tpl: "", - upd: { - StackObjectsCount: 5, - }, - }; + const initialItem: Item = {_id: "", _tpl: "", upd: {StackObjectsCount: 5}}; const fixedItem = itemHelper.fixItemStackCount(initialItem); expect(fixedItem.upd).toBeDefined(); @@ -465,12 +452,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "5b40e1525acfc4771e1c6611", // "HighCom Striker ULACH IIIA helmet (Black)" - upd: { - Repairable: { - Durability: 19, - MaxDurability: 38, - }, - }, + upd: {Repairable: {Durability: 19, MaxDurability: 38}}, }; const result = itemHelper.getItemQualityModifier(item); @@ -484,12 +466,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "5a38e6bac4a2826c6e06d79b", // "TOZ-106 20ga bolt-action shotgun" - upd: { - Repairable: { - Durability: 20, - MaxDurability: 100, - }, - }, + upd: {Repairable: {Durability: 20, MaxDurability: 100}}, }; const result = itemHelper.getItemQualityModifier(item); @@ -521,11 +498,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key" - upd: { - Key: { - NumberOfUsages: 5, - }, - }, + upd: {Key: {NumberOfUsages: 5}}, }; const result = itemHelper.getItemQualityModifier(item); @@ -558,11 +531,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" - upd: { - RepairKit: { - Resource: 600, - }, - }, + upd: {RepairKit: {Resource: 600}}, }; const result = itemHelper.getItemQualityModifier(item); @@ -576,11 +545,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" - upd: { - RepairKit: { - Resource: 0, - }, - }, + upd: {RepairKit: {Resource: 0}}, }; const result = itemHelper.getItemQualityModifier(item); @@ -594,10 +559,7 @@ describe("ItemHelper", () => it("should return the correct quality value for armor items", () => { const armor = itemHelper.getItem("5648a7494bdc2d9d488b4583")[1]; // "PACA Soft Armor" - const repairable: Repairable = { - Durability: 25, - MaxDurability: 50, - }; + const repairable: Repairable = {Durability: 25, MaxDurability: 50}; const item: Item = { // Not used for armor, but required for the method. _id: "", _tpl: "", @@ -630,14 +592,8 @@ describe("ItemHelper", () => it("should return the correct quality value for weapon items", () => { const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" - const repairable: Repairable = { - Durability: 50, - MaxDurability: 100, - }; - const item: Item = { - _id: "", - _tpl: "", - }; + const repairable: Repairable = {Durability: 50, MaxDurability: 100}; + const item: Item = {_id: "", _tpl: ""}; // Cast the method to any to allow access to private/protected method. const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); @@ -653,10 +609,7 @@ describe("ItemHelper", () => Durability: 50, MaxDurability: 200, // This should be used now. }; - const item: Item = { - _id: "", - _tpl: "", - }; + const item: Item = {_id: "", _tpl: ""}; // Cast the method to any to allow access to private/protected method. const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); @@ -672,10 +625,7 @@ describe("ItemHelper", () => Durability: 50, MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type. }; - const item: Item = { - _id: "", - _tpl: "", - }; + const item: Item = {_id: "", _tpl: ""}; // Mock the logger's error method to prevent it from being actually called. const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() => @@ -696,10 +646,7 @@ describe("ItemHelper", () => Durability: 50, MaxDurability: 0, // This is a problem. }; - const item: Item = { - _id: "", - _tpl: "", - }; + const item: Item = {_id: "", _tpl: ""}; // Cast the method to any to allow access to private/protected method. const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); @@ -715,10 +662,7 @@ describe("ItemHelper", () => Durability: 50, MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type. }; - const item: Item = { - _id: "", - _tpl: "", - }; + const item: Item = {_id: "", _tpl: ""}; const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error"); @@ -733,44 +677,40 @@ describe("ItemHelper", () => { it("should return an array containing only the parent ID when no children are found", () => { - const items: Item[] = [ - {_id: "1", _tpl: "", parentId: null}, - {_id: "2", _tpl: "", parentId: null}, - {_id: "3", _tpl: "", parentId: "2"}, - ]; + const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: null}, { + _id: "3", + _tpl: "", + parentId: "2", + }]; const result = itemHelper.findAndReturnChildrenByItems(items, "1"); expect(result).toEqual(["1"]); }); it("should return array of child IDs when single-level children are found", () => { - const items: Item[] = [ - {_id: "1", _tpl: "", parentId: null}, - {_id: "2", _tpl: "", parentId: "1"}, - {_id: "3", _tpl: "", parentId: "1"}, - ]; + const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: "1"}, { + _id: "3", + _tpl: "", + parentId: "1", + }]; const result = itemHelper.findAndReturnChildrenByItems(items, "1"); expect(result).toEqual(["2", "3", "1"]); }); it("should return array of child IDs when multi-level children are found", () => { - const items: Item[] = [ - {_id: "1", _tpl: "", parentId: null}, - {_id: "2", _tpl: "", parentId: "1"}, - {_id: "3", _tpl: "", parentId: "2"}, - {_id: "4", _tpl: "", parentId: "3"}, - ]; + const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: "1"}, { + _id: "3", + _tpl: "", + parentId: "2", + }, {_id: "4", _tpl: "", parentId: "3"}]; const result = itemHelper.findAndReturnChildrenByItems(items, "1"); expect(result).toEqual(["4", "3", "2", "1"]); }); it("should return an array containing only the parent ID when parent ID does not exist in items", () => { - const items: Item[] = [ - {_id: "1", _tpl: "", parentId: null}, - {_id: "2", _tpl: "", parentId: "1"}, - ]; + const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: "1"}]; const result = itemHelper.findAndReturnChildrenByItems(items, "3"); expect(result).toEqual(["3"]); }); @@ -807,9 +747,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" - upd: { - StackObjectsCount: 5, - }, + upd: {StackObjectsCount: 5}, }; const result = itemHelper.getItemStackSize(item); expect(result).toBe(5); @@ -824,10 +762,7 @@ describe("ItemHelper", () => const item: Item = { _id: itemId, _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" - upd: { - BuyRestrictionCurrent: 0, - BuyRestrictionMax: 1, - }, + upd: {BuyRestrictionCurrent: 0, BuyRestrictionMax: 1}, }; const result = itemHelper.hasBuyRestrictions(item); expect(result).toBe(true); @@ -1089,15 +1024,7 @@ describe("ItemHelper", () => const mockTemplateItem = { _id: "571a29dc2459771fb2755a6a", _name: "mag_tt_toz_std_762x25tt_8", - _props: { - Cartridges: [{ - _props: { - filters: [{ - Filter: validAmmoItems, - }], - }, - }], - }, + _props: {Cartridges: [{_props: {filters: [{Filter: validAmmoItems}]}}]}, }; vi.spyOn((itemHelper as any).randomUtil, "getArrayValue").mockReturnValue(validAmmoItems[0]); @@ -1109,13 +1036,7 @@ describe("ItemHelper", () => it("should return null when passed template has empty cartridge property", () => { - const fakeTemplateItem = { - _props: { - Cartridges: [ - {}, - ], - }, - }; + const fakeTemplateItem = {_props: {Cartridges: [{}]}}; const result = itemHelper.getRandomCompatibleCaliberTemplateId(fakeTemplateItem as ITemplateItem); expect(result).toBe(null); diff --git a/project/tests/services/PaymentService.test.ts b/project/tests/services/PaymentService.test.ts index 33275d68..9e78fa02 100644 --- a/project/tests/services/PaymentService.test.ts +++ b/project/tests/services/PaymentService.test.ts @@ -50,16 +50,8 @@ describe("PaymentService", () => // Object representing the player's PMC inventory. const pmcData = { - TradersInfo: { - [traderId]: { - salesSum: 0, - unlocked: true, - disabled: false, - }, - }, - Inventory: { - items: [moneyItem], - }, + TradersInfo: {[traderId]: {salesSum: 0, unlocked: true, disabled: false}}, + Inventory: {items: [moneyItem]}, } as unknown as IPmcData; // Buy a factory map from Therapist... although it doesn't really matter what the item is as there's no @@ -71,12 +63,7 @@ describe("PaymentService", () => item_id: purchaseItemId, count: purchaseQuantity, scheme_id: 0, - scheme_items: [ - { - id: costItemId, - count: costAmount, - }, - ], + scheme_items: [{id: costItemId, count: costAmount}], } as IProcessBuyTradeRequestData; // Inconsequential profile ID @@ -84,16 +71,7 @@ describe("PaymentService", () => const itemEventRouterResponse = { warnings: [], - profileChanges: { - sessionID: { - _id: sessionID, - items: { - new: [], - change: [], - del: [], - }, - }, - }, + profileChanges: {sessionID: {_id: sessionID, items: {new: [], change: [], del: []}}}, } as unknown as IItemEventRouterResponse; // Mock the logger debug method to return void. @@ -102,25 +80,13 @@ describe("PaymentService", () => // Mock the trader helper to return a trader with the currency of Roubles. const traderHelperGetTraderSpy = vi.spyOn((paymentService as any).traderHelper, "getTrader") - .mockReturnValue({ - tid: traderId, - currency: "RUB", - } as unknown as ITraderBase); + .mockReturnValue({tid: traderId, currency: "RUB"} as unknown as ITraderBase); // Mock the addPaymentToOutput method to subtract the item cost from the money stack. const addPaymentToOutputSpy = vi.spyOn(paymentService as any, "addPaymentToOutput").mockImplementation(() => { moneyItem.upd.StackObjectsCount -= costAmount; - return { - warnings: [], - profileChanges: { - [sessionID]: { - items: { - change: [moneyItem], - }, - }, - }, - }; + return {warnings: [], profileChanges: {[sessionID]: {items: {change: [moneyItem]}}}}; }); // Mock the traderHelper lvlUp method to return void. diff --git a/project/vitest.config.ts b/project/vitest.config.ts index 44ba8b7f..166961b4 100644 --- a/project/vitest.config.ts +++ b/project/vitest.config.ts @@ -7,9 +7,7 @@ export default defineConfig({ reporters: ["default"], root: "./", include: ["**/*.{test,spec}.?(c|m)[jt]s?(x)"], - cache: { - dir: "./tests/__cache__", - }, + cache: {dir: "./tests/__cache__"}, environment: "./tests/CustomEnvironment.ts", globals: true, coverage: { @@ -22,15 +20,7 @@ export default defineConfig({ exclude: ["src/models/**", "tests/**"], }, pool: "threads", - poolOptions: { - threads: { - singleThread: true, - isolate: false, - }, - }, - alias: { - "@spt-aki": path.resolve(__dirname, "src"), - "@tests": path.resolve(__dirname, "tests"), - }, + poolOptions: {threads: {singleThread: true, isolate: false}}, + alias: {"@spt-aki": path.resolve(__dirname, "src"), "@tests": path.resolve(__dirname, "tests")}, }, });