diff --git a/project/dprint.json b/project/dprint.json index d264a421..96405138 100644 --- a/project/dprint.json +++ b/project/dprint.json @@ -22,10 +22,10 @@ "typeLiteral.separatorKind": "semiColon", "enumDeclaration.memberSpacing": "newLine", "spaceAround": false, - "spaceSurroundingProperties": false, - "objectExpression.spaceSurroundingProperties": false, - "objectPattern.spaceSurroundingProperties": false, - "typeLiteral.spaceSurroundingProperties": false, + "spaceSurroundingProperties": true, + "objectExpression.spaceSurroundingProperties": true, + "objectPattern.spaceSurroundingProperties": true, + "typeLiteral.spaceSurroundingProperties": true, "binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator": true, "commentLine.forceSpaceAfterSlashes": true, "constructor.spaceBeforeParentheses": false, diff --git a/project/gulpfile.mjs b/project/gulpfile.mjs index c856b25f..476c1797 100644 --- a/project/gulpfile.mjs +++ b/project/gulpfile.mjs @@ -8,7 +8,7 @@ import rename from "gulp-rename"; import pkg from "pkg"; import pkgfetch from "pkg-fetch"; import * as ResEdit from "resedit"; -import manifest from "./package.json" assert {type: "json"}; +import manifest from "./package.json" assert { type: "json" }; const nodeVersion = "node18"; // As of pkg-fetch v3.5, it's v18.15.0 const stdio = "inherit"; @@ -27,7 +27,7 @@ const licenseFile = "../LICENSE.md"; /** * Transpile src files into Javascript with SWC */ -const compile = async () => await exec("swc src -d obj", {stdio}); +const compile = async () => await exec("swc src -d obj", { stdio }); // Packaging const fetchPackageImage = async () => @@ -74,14 +74,14 @@ const updateBuildProperties = async () => const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0]; - vi.setStringValues({lang: 1033, codepage: 1200}, { + 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.removeStringValue({ lang: 1033, codepage: 1200 }, "OriginalFilename"); + vi.removeStringValue({ lang: 1033, codepage: 1200 }, "InternalName"); vi.setFileVersion(...manifest.version.split(".").map(Number)); vi.setProductVersion(...manifest.version.split(".").map(Number)); vi.outputToResourceEntries(res.entries); @@ -120,7 +120,7 @@ const writeCommitHashToCoreJSON = async () => const parsed = JSON.parse(coreJSON); // Fetch the latest Git commit hash - const gitResult = await exec("git rev-parse HEAD", {stdout: "pipe"}); + const gitResult = await exec("git rev-parse HEAD", { stdout: "pipe" }); // Update the commit hash in the core.json object parsed.commit = gitResult.stdout.trim() || ""; @@ -154,12 +154,12 @@ const addAssets = gulp.series(copyAssets, copyExecutables, copyLicense, writeCom /** * Cleans the build directory. */ -const cleanBuild = async () => await fs.rm(buildDir, {recursive: true, force: true}); +const cleanBuild = async () => await fs.rm(buildDir, { recursive: true, force: true }); /** * Cleans the transpiled javascript directory. */ -const cleanCompiled = async () => await fs.rm("./obj", {recursive: true, force: true}); +const cleanCompiled = async () => await fs.rm("./obj", { recursive: true, force: true }); /** * Recursively builds an array of paths for json files. @@ -305,11 +305,14 @@ gulp.task("build:debug", build("debug")); gulp.task("build:release", build("release")); gulp.task("build:bleeding", build("bleeding")); -gulp.task("run:build", async () => await exec("Aki.Server.exe", {stdio, cwd: buildDir})); -gulp.task("run:debug", async () => await exec("ts-node-dev -r tsconfig-paths/register src/ide/TestEntry.ts", {stdio})); +gulp.task("run:build", async () => await exec("Aki.Server.exe", { stdio, cwd: buildDir })); +gulp.task( + "run:debug", + async () => await exec("ts-node-dev -r tsconfig-paths/register src/ide/TestEntry.ts", { stdio }), +); gulp.task("run:profiler", async () => { await cleanCompiled(); await compile(); - await exec("node --prof --inspect --trace-warnings obj/ide/TestEntry.js", {stdio}); + await exec("node --prof --inspect --trace-warnings obj/ide/TestEntry.js", { stdio }); }); diff --git a/project/src/ErrorHandler.ts b/project/src/ErrorHandler.ts index afb88de9..b8b286ac 100644 --- a/project/src/ErrorHandler.ts +++ b/project/src/ErrorHandler.ts @@ -12,7 +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 9d4cec90..35c85210 100644 --- a/project/src/callbacks/CustomizationCallbacks.ts +++ b/project/src/callbacks/CustomizationCallbacks.ts @@ -28,7 +28,10 @@ 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 a1298527..23221dbe 100644 --- a/project/src/callbacks/DialogueCallbacks.ts +++ b/project/src/callbacks/DialogueCallbacks.ts @@ -75,7 +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]); @@ -181,7 +181,7 @@ export class DialogueCallbacks implements OnUpdate sessionID: string, ): IGetBodyResponseData { - return this.httpResponse.getBody({status: 0, requestid: "12345", retryAfter: 600}); + return this.httpResponse.getBody({ status: 0, requestid: "12345", retryAfter: 600 }); } /** @@ -215,13 +215,13 @@ export class DialogueCallbacks implements OnUpdate } /** Handle client/friend/ignore/set */ - public ignoreFriend(url: string, request: {uid: string;}, sessionID: string): any + public ignoreFriend(url: string, request: { uid: string; }, sessionID: string): any { return this.httpResponse.nullResponse(); } /** Handle client/friend/ignore/remove */ - public unIgnoreFriend(url: string, request: {uid: string;}, sessionID: string): any + public unIgnoreFriend(url: string, request: { uid: string; }, sessionID: string): any { return this.httpResponse.nullResponse(); } diff --git a/project/src/callbacks/GameCallbacks.ts b/project/src/callbacks/GameCallbacks.ts index 0b712181..20712f55 100644 --- a/project/src/callbacks/GameCallbacks.ts +++ b/project/src/callbacks/GameCallbacks.ts @@ -58,7 +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 }); } /** @@ -73,7 +73,7 @@ export class GameCallbacks implements OnLoad ): IGetBodyResponseData { this.saveServer.save(); - return this.httpResponse.getBody({status: "ok"}); + return this.httpResponse.getBody({ status: "ok" }); } /** @@ -140,7 +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/NotifierCallbacks.ts b/project/src/callbacks/NotifierCallbacks.ts index 61df5e1a..b5509d2f 100644 --- a/project/src/callbacks/NotifierCallbacks.ts +++ b/project/src/callbacks/NotifierCallbacks.ts @@ -68,7 +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/ProfileCallbacks.ts b/project/src/callbacks/ProfileCallbacks.ts index 7ba9eac8..55f89db2 100644 --- a/project/src/callbacks/ProfileCallbacks.ts +++ b/project/src/callbacks/ProfileCallbacks.ts @@ -34,7 +34,7 @@ export class ProfileCallbacks public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData { this.profileController.createProfile(info, sessionID); - return this.httpResponse.getBody({uid: `pmc${sessionID}`}); + return this.httpResponse.getBody({ uid: `pmc${sessionID}` }); } /** @@ -91,7 +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() }); } /** @@ -115,7 +115,7 @@ export class ProfileCallbacks return this.httpResponse.getBody(null, 256, "256 - "); } - return this.httpResponse.getBody({status: "ok"}); + return this.httpResponse.getBody({ status: "ok" }); } /** @@ -150,7 +150,7 @@ export class ProfileCallbacks raidMode: "Online", mode: "deathmatch", shortId: "xxx1x1", - }, {profileid: `pmc${sessionID}`, profileToken: null, status: "Free", sid: "", ip: "", port: 0}], + }, { profileid: `pmc${sessionID}`, profileToken: null, status: "Free", sid: "", ip: "", port: 0 }], }; return this.httpResponse.getBody(response); diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index 5de94655..1a8d0479 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -290,6 +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/CustomizationController.ts b/project/src/controllers/CustomizationController.ts index 62fafde6..d1aac172 100644 --- a/project/src/controllers/CustomizationController.ts +++ b/project/src/controllers/CustomizationController.ts @@ -209,7 +209,7 @@ export class CustomizationController parentId: relatedItem.parentId, slotId: relatedItem.slotId, location: relatedItem.location, - upd: {StackObjectsCount: relatedItem.upd.StackObjectsCount}, + upd: { StackObjectsCount: relatedItem.upd.StackObjectsCount }, }); } } diff --git a/project/src/controllers/DialogueController.ts b/project/src/controllers/DialogueController.ts index 6e085fe5..1c74a1c3 100644 --- a/project/src/controllers/DialogueController.ts +++ b/project/src/controllers/DialogueController.ts @@ -60,7 +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 22146dcf..fefec388 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -435,7 +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 }]; } /** @@ -443,7 +443,7 @@ export class GameController */ public getCurrentGroup(sessionId: string): ICurrentGroupResponse { - return {squad: []}; + return { squad: [] }; } /** @@ -451,7 +451,7 @@ export class GameController */ public getValidGameVersion(sessionId: string): ICheckVersionResponse { - return {isvalid: true, latestVersion: this.coreConfig.compatibleTarkovVersion}; + return { isvalid: true, latestVersion: this.coreConfig.compatibleTarkovVersion }; } /** @@ -459,7 +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 }; } /** diff --git a/project/src/controllers/HealthController.ts b/project/src/controllers/HealthController.ts index 5090b36f..afc3c39a 100644 --- a/project/src/controllers/HealthController.ts +++ b/project/src/controllers/HealthController.ts @@ -92,7 +92,7 @@ export class HealthController { // Get max healing from db const maxHp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource; - healingItemToUse.upd.MedKit = {HpResource: maxHp - request.count}; // Subtract amount used from max + healingItemToUse.upd.MedKit = { HpResource: maxHp - request.count }; // Subtract amount used from max } // Resource in medkit is spent, delete it @@ -132,7 +132,7 @@ export class HealthController { if (itemToConsume.upd.FoodDrink === undefined) { - itemToConsume.upd.FoodDrink = {HpPercent: consumedItemMaxResource - request.count}; + itemToConsume.upd.FoodDrink = { HpPercent: consumedItemMaxResource - request.count }; } else { diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index d31021bf..8cf9b2cc 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -93,7 +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 @@ -324,7 +324,7 @@ export class HideoutController } // Add new item as none exists - pmcData.Inventory.items.push({_id: dbHideoutData._id, _tpl: hideoutStage.container}); + pmcData.Inventory.items.push({ _id: dbHideoutData._id, _tpl: hideoutStage.container }); } /** @@ -372,7 +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); @@ -683,7 +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 }; } /** @@ -787,7 +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; @@ -871,7 +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); } @@ -930,7 +930,7 @@ export class HideoutController delete output.profileChanges[sessionID].production[request.recipeId]; const itemsToAdd = pmcData.Hideout.Production[prodId].Products.map( - (x: {_tpl: string; upd?: {StackObjectsCount?: number;};}) => + (x: { _tpl: string; upd?: { StackObjectsCount?: number; }; }) => { let id = x._tpl; if (this.presetHelper.hasPreset(id)) @@ -939,11 +939,11 @@ export class HideoutController } const numOfItems = !x.upd?.StackObjectsCount ? 1 : x.upd.StackObjectsCount; - return {item_id: id, count: numOfItems}; + return { item_id: id, count: numOfItems }; }, ); - const newReq = {items: itemsToAdd, tid: "ragfair"}; + const newReq = { items: itemsToAdd, tid: "ragfair" }; const callback = () => { @@ -1035,7 +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 @@ -1066,7 +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 5552fd36..9a08f430 100644 --- a/project/src/controllers/InsuranceController.ts +++ b/project/src/controllers/InsuranceController.ts @@ -423,7 +423,7 @@ export class InsuranceController */ protected countSuccessfulRolls(attachments: Item[], traderId: string): number { - const rolls = Array.from({length: attachments.length}, () => this.rollForDelete(traderId)); + const rolls = Array.from({ length: attachments.length }, () => this.rollForDelete(traderId)); return rolls.filter(Boolean).length; } @@ -440,14 +440,14 @@ export class InsuranceController toDelete: Set, ): void { - const valuableToDelete = attachments.slice(0, successfulRolls).map(({_id}) => _id); + const valuableToDelete = attachments.slice(0, successfulRolls).map(({ _id }) => _id); for (const attachmentsId of valuableToDelete) { - const valuableChild = attachments.find(({_id}) => _id === attachmentsId); + const valuableChild = attachments.find(({ _id }) => _id === attachmentsId); if (valuableChild) { - const {name, maxPrice} = valuableChild; + const { name, maxPrice } = valuableChild; this.logger.debug(`Marked for removal - Child Item: ${name}, Max Price: ${maxPrice}`); toDelete.add(attachmentsId); } @@ -625,7 +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 7885b1e1..82d0344e 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -282,12 +282,12 @@ export class InventoryController if (!(destinationItem.upd?.StackObjectsCount)) { // No stack count on destination, add one - destinationItem.upd = {StackObjectsCount: 1}; + destinationItem.upd = { StackObjectsCount: 1 }; } if (!sourceItem.upd) { - sourceItem.upd = {StackObjectsCount: 1}; + sourceItem.upd = { StackObjectsCount: 1 }; } else if (!sourceItem.upd.StackObjectsCount) { @@ -296,7 +296,7 @@ export class InventoryController } destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stack count to destination - output.profileChanges[sessionID].items.del.push({_id: sourceItem._id}); // Inform client source item being deleted + output.profileChanges[sessionID].items.del.push({ _id: sourceItem._id }); // Inform client source item being deleted const indexOfItemToRemove = inventoryItems.from.findIndex((x) => x._id === sourceItem._id); if (indexOfItemToRemove === -1) @@ -370,7 +370,7 @@ export class InventoryController let sourceStackCount = 1; if (!sourceItem.upd) { - sourceItem.upd = {StackObjectsCount: 1}; + sourceItem.upd = { StackObjectsCount: 1 }; } sourceStackCount = sourceItem.upd.StackObjectsCount; @@ -392,7 +392,7 @@ export class InventoryController } else { - Object.assign(destinationItem, {upd: {StackObjectsCount: 1}}); + Object.assign(destinationItem, { upd: { StackObjectsCount: 1 } }); } destinationItem.upd.StackObjectsCount = destinationStackCount + body.count; @@ -465,12 +465,12 @@ export class InventoryController { if (item._id && item._id === body.item) { - item.upd.Foldable = {Folded: body.value}; + item.upd.Foldable = { Folded: body.value }; return this.eventOutputHolder.getOutput(sessionID); } } - return {warnings: [], profileChanges: {}}; + return { warnings: [], profileChanges: {} }; } /** @@ -499,7 +499,7 @@ export class InventoryController itemToToggle.upd = {}; } - itemToToggle.upd.Togglable = {On: body.value}; + itemToToggle.upd.Togglable = { On: body.value }; return this.eventOutputHolder.getOutput(sessionID); } @@ -510,7 +510,7 @@ export class InventoryController ); } - return {warnings: [], profileChanges: {}}; + return { warnings: [], profileChanges: {} }; } /** @@ -528,18 +528,18 @@ export class InventoryController { if ("upd" in item) { - item.upd.Tag = {Color: body.TagColor, Name: body.TagName}; + item.upd.Tag = { Color: body.TagColor, Name: body.TagName }; } else { - item.upd = {Tag: {Color: body.TagColor, Name: body.TagName}}; + item.upd = { Tag: { Color: body.TagColor, Name: body.TagName } }; } return this.eventOutputHolder.getOutput(sessionID); } } - return {warnings: [], profileChanges: {}}; + return { warnings: [], profileChanges: {} }; } /** @@ -761,7 +761,7 @@ export class InventoryController const mapItem = pmcData.Inventory.items.find((i) => i._id === request.item); // add marker - mapItem.upd.Map = mapItem.upd.Map || {Markers: []}; + mapItem.upd.Map = mapItem.upd.Map || { Markers: [] }; request.mapMarker.Note = this.sanitiseMapMarkerText(request.mapMarker.Note); mapItem.upd.Map.Markers.push(request.mapMarker); @@ -857,7 +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 00fd78f7..d69eef58 100644 --- a/project/src/controllers/LocationController.ts +++ b/project/src/controllers/LocationController.ts @@ -135,7 +135,7 @@ export class LocationController locations[mapBase._Id] = mapBase; } - return {locations: locations, paths: locationsFromDb.base.paths}; + return { locations: locations, paths: locationsFromDb.base.paths }; } /** @@ -152,7 +152,7 @@ export class LocationController const airdropConfig = this.getAirdropLootConfigByType(airdropType); - return {dropType: airdropType, loot: this.lootGenerator.createRandomLoot(airdropConfig)}; + return { dropType: airdropType, loot: this.lootGenerator.createRandomLoot(airdropConfig) }; } /** diff --git a/project/src/controllers/MatchController.ts b/project/src/controllers/MatchController.ts index 436f7082..fa906259 100644 --- a/project/src/controllers/MatchController.ts +++ b/project/src/controllers/MatchController.ts @@ -101,7 +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({ @@ -125,7 +125,7 @@ export class MatchController /** Handle client/match/group/status */ public getGroupStatus(info: IGetGroupStatusRequestData): any { - return {players: [], maxPveCountExceeded: false}; + return { players: [], maxPveCountExceeded: false }; } /** @@ -225,7 +225,7 @@ export class MatchController _tpl: item.tpl, slotId: "main", parentId: parentId, - upd: {StackObjectsCount: item.stackCount, SpawnedInSession: true}, + upd: { StackObjectsCount: item.stackCount, SpawnedInSession: true }, }); } diff --git a/project/src/controllers/NoteController.ts b/project/src/controllers/NoteController.ts index bc56a5a0..d6689621 100644 --- a/project/src/controllers/NoteController.ts +++ b/project/src/controllers/NoteController.ts @@ -14,7 +14,7 @@ export class NoteController 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 7e44a0b0..6c19797b 100644 --- a/project/src/controllers/PresetBuildController.ts +++ b/project/src/controllers/PresetBuildController.ts @@ -33,7 +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 @@ -84,7 +84,13 @@ 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 ec391eaf..fb2c2336 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -149,7 +149,7 @@ export class ProfileController if (!pmcData.UnlockedInfo) { - pmcData.UnlockedInfo = {unlockedProductionRecipe: []}; + pmcData.UnlockedInfo = { unlockedProductionRecipe: [] }; } // Change item id's to be unique @@ -164,7 +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, @@ -348,6 +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 ce96a841..7eb07df6 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -866,7 +866,7 @@ export class QuestController let index = pmcData.Inventory.items.length; // Important: don't tell the client to remove the attachments, it will handle it - output.profileChanges[sessionID].items.del.push({_id: itemHandover.id}); + output.profileChanges[sessionID].items.del.push({ _id: itemHandover.id }); // Important: loop backward when removing items from the array we're looping on while (index-- > 0) @@ -955,6 +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 bf4a4902..b76d12e6 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -326,7 +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 @@ -340,7 +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 }; } } @@ -613,7 +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( @@ -663,7 +663,7 @@ export class RagfairController if (index === -1) { this.logger.error( - this.localisationService.getText("ragfair-offer_not_found_in_profile", {offerId: offerId}), + this.localisationService.getText("ragfair-offer_not_found_in_profile", { offerId: offerId }), ); return this.httpResponse.appendErrorToOutput( this.eventOutputHolder.getOutput(sessionID), @@ -693,7 +693,7 @@ export class RagfairController if (index === -1) { this.logger.warning( - this.localisationService.getText("ragfair-offer_not_found_in_profile", {offerId: info.offerId}), + this.localisationService.getText("ragfair-offer_not_found_in_profile", { offerId: info.offerId }), ); return this.httpResponse.appendErrorToOutput( this.eventOutputHolder.getOutput(sessionID), @@ -742,7 +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 94fd56b8..d7e2aa2c 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -313,7 +313,7 @@ export class RepeatableQuestController // Target is boss if (probabilityObject.data.isBoss) { - questPool.pool.Elimination.targets[probabilityObject.key] = {locations: ["any"]}; + questPool.pool.Elimination.targets[probabilityObject.key] = { locations: ["any"] }; } else { @@ -321,8 +321,8 @@ export class RepeatableQuestController // Set possible locations for elimination task, if target is savage, exclude labs from locations questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage") - ? {locations: possibleLocations.filter((x) => x !== "laboratory")} - : {locations: possibleLocations}; + ? { locations: possibleLocations.filter((x) => x !== "laboratory") } + : { locations: possibleLocations }; } } @@ -333,7 +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/TradeController.ts b/project/src/controllers/TradeController.ts index 53d11b83..364b6fb1 100644 --- a/project/src/controllers/TradeController.ts +++ b/project/src/controllers/TradeController.ts @@ -203,7 +203,11 @@ export class TradeController // Add item details to request // eslint-disable-next-line @typescript-eslint/naming-convention - sellRequest.items.push({id: itemToSell._id, count: itemToSell?.upd?.StackObjectsCount ?? 1, scheme_id: 0}); + sellRequest.items.push({ + id: itemToSell._id, + count: itemToSell?.upd?.StackObjectsCount ?? 1, + scheme_id: 0, + }); } this.logger.debug(`Selling scav items to fence for ${sellRequest.price} roubles`); return this.tradeHelper.sellItem(profileWithItemsToSell, profileThatGetsMoney, sellRequest, sessionId); diff --git a/project/src/controllers/WeatherController.ts b/project/src/controllers/WeatherController.ts index 90350ea9..7c695b91 100644 --- a/project/src/controllers/WeatherController.ts +++ b/project/src/controllers/WeatherController.ts @@ -24,7 +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/di/Container.ts b/project/src/di/Container.ts index a6d45798..fd2c2a5f 100644 --- a/project/src/di/Container.ts +++ b/project/src/di/Container.ts @@ -251,13 +251,13 @@ export class Container { public static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void { - container.register("AkiHttpListener", AkiHttpListener, {lifecycle: Lifecycle.Singleton}); + container.register("AkiHttpListener", AkiHttpListener, { lifecycle: Lifecycle.Singleton }); childContainer.registerType("HttpListener", "AkiHttpListener"); } public static registerTypes(con: DependencyContainer): void { - con.register("ApplicationContext", ApplicationContext, {lifecycle: Lifecycle.Singleton}); + con.register("ApplicationContext", ApplicationContext, { lifecycle: Lifecycle.Singleton }); Container.registerUtils(con); Container.registerRouters(con); Container.registerGenerators(con); @@ -271,11 +271,11 @@ export class Container public static registerListTypes(con: DependencyContainer): void { - con.register("OnLoadModService", {useValue: new OnLoadModService(con)}); - con.register("HttpListenerModService", {useValue: new HttpListenerModService(con)}); - con.register("OnUpdateModService", {useValue: new OnUpdateModService(con)}); - con.register("DynamicRouterModService", {useValue: new DynamicRouterModService(con)}); - con.register("StaticRouterModService", {useValue: new StaticRouterModService(con)}); + con.register("OnLoadModService", { useValue: new OnLoadModService(con) }); + con.register("HttpListenerModService", { useValue: new HttpListenerModService(con) }); + con.register("OnUpdateModService", { useValue: new OnUpdateModService(con) }); + con.register("DynamicRouterModService", { useValue: new DynamicRouterModService(con) }); + con.register("StaticRouterModService", { useValue: new StaticRouterModService(con) }); con.registerType("OnLoad", "DatabaseImporter"); con.registerType("OnLoad", "PostDBModLoader"); @@ -351,96 +351,100 @@ export class Container private static registerUtils(con: DependencyContainer): void { // Utils - con.register("App", App, {lifecycle: Lifecycle.Singleton}); - con.register("DatabaseImporter", DatabaseImporter, {lifecycle: Lifecycle.Singleton}); - con.register("HashUtil", HashUtil, {lifecycle: Lifecycle.Singleton}); - con.register("ImporterUtil", ImporterUtil, {lifecycle: Lifecycle.Singleton}); + con.register("App", App, { lifecycle: Lifecycle.Singleton }); + con.register("DatabaseImporter", DatabaseImporter, { lifecycle: Lifecycle.Singleton }); + con.register("HashUtil", HashUtil, { lifecycle: Lifecycle.Singleton }); + con.register("ImporterUtil", ImporterUtil, { lifecycle: Lifecycle.Singleton }); con.register("HttpResponseUtil", HttpResponseUtil); - con.register("EncodingUtil", EncodingUtil, {lifecycle: Lifecycle.Singleton}); + con.register("EncodingUtil", EncodingUtil, { lifecycle: Lifecycle.Singleton }); con.register("JsonUtil", JsonUtil); - con.register("WinstonLogger", WinstonMainLogger, {lifecycle: Lifecycle.Singleton}); - con.register("RequestsLogger", WinstonRequestLogger, {lifecycle: Lifecycle.Singleton}); - con.register("MathUtil", MathUtil, {lifecycle: Lifecycle.Singleton}); + con.register("WinstonLogger", WinstonMainLogger, { lifecycle: Lifecycle.Singleton }); + con.register("RequestsLogger", WinstonRequestLogger, { lifecycle: Lifecycle.Singleton }); + con.register("MathUtil", MathUtil, { lifecycle: Lifecycle.Singleton }); con.register("ObjectId", ObjectId); - con.register("RandomUtil", RandomUtil, {lifecycle: Lifecycle.Singleton}); - con.register("TimeUtil", TimeUtil, {lifecycle: Lifecycle.Singleton}); - con.register("VFS", VFS, {lifecycle: Lifecycle.Singleton}); - con.register("WatermarkLocale", WatermarkLocale, {lifecycle: Lifecycle.Singleton}); - con.register("Watermark", Watermark, {lifecycle: Lifecycle.Singleton}); - con.register("AsyncQueue", AsyncQueue, {lifecycle: Lifecycle.Singleton}); - con.register("HttpFileUtil", HttpFileUtil, {lifecycle: Lifecycle.Singleton}); - con.register("ModLoadOrder", ModLoadOrder, {lifecycle: Lifecycle.Singleton}); - con.register("ModTypeCheck", ModTypeCheck, {lifecycle: Lifecycle.Singleton}); + con.register("RandomUtil", RandomUtil, { lifecycle: Lifecycle.Singleton }); + con.register("TimeUtil", TimeUtil, { lifecycle: Lifecycle.Singleton }); + con.register("VFS", VFS, { lifecycle: Lifecycle.Singleton }); + con.register("WatermarkLocale", WatermarkLocale, { lifecycle: Lifecycle.Singleton }); + con.register("Watermark", Watermark, { lifecycle: Lifecycle.Singleton }); + con.register("AsyncQueue", AsyncQueue, { lifecycle: Lifecycle.Singleton }); + con.register("HttpFileUtil", HttpFileUtil, { lifecycle: Lifecycle.Singleton }); + con.register("ModLoadOrder", ModLoadOrder, { lifecycle: Lifecycle.Singleton }); + con.register("ModTypeCheck", ModTypeCheck, { lifecycle: Lifecycle.Singleton }); } private static registerRouters(con: DependencyContainer): void { // Routers - con.register("HttpRouter", HttpRouter, {lifecycle: Lifecycle.Singleton}); + con.register("HttpRouter", HttpRouter, { lifecycle: Lifecycle.Singleton }); con.register("ImageRouter", ImageRouter); - con.register("EventOutputHolder", EventOutputHolder, {lifecycle: Lifecycle.Singleton}); + con.register("EventOutputHolder", EventOutputHolder, { lifecycle: Lifecycle.Singleton }); con.register("ItemEventRouter", ItemEventRouter); // Dynamic routes - con.register("BotDynamicRouter", {useClass: BotDynamicRouter}); - con.register("BundleDynamicRouter", {useClass: BundleDynamicRouter}); - con.register("CustomizationDynamicRouter", {useClass: CustomizationDynamicRouter}); - con.register("DataDynamicRouter", {useClass: DataDynamicRouter}); - con.register("HttpDynamicRouter", {useClass: HttpDynamicRouter}); - con.register("InraidDynamicRouter", {useClass: InraidDynamicRouter}); - con.register("LocationDynamicRouter", {useClass: LocationDynamicRouter}); - con.register("NotifierDynamicRouter", {useClass: NotifierDynamicRouter}); - con.register("TraderDynamicRouter", {useClass: TraderDynamicRouter}); + con.register("BotDynamicRouter", { useClass: BotDynamicRouter }); + con.register("BundleDynamicRouter", { useClass: BundleDynamicRouter }); + con.register("CustomizationDynamicRouter", { + useClass: CustomizationDynamicRouter, + }); + con.register("DataDynamicRouter", { useClass: DataDynamicRouter }); + con.register("HttpDynamicRouter", { useClass: HttpDynamicRouter }); + con.register("InraidDynamicRouter", { useClass: InraidDynamicRouter }); + con.register("LocationDynamicRouter", { useClass: LocationDynamicRouter }); + con.register("NotifierDynamicRouter", { useClass: NotifierDynamicRouter }); + con.register("TraderDynamicRouter", { useClass: TraderDynamicRouter }); // Item event routes con.register("CustomizationItemEventRouter", { useClass: CustomizationItemEventRouter, }); - con.register("HealthItemEventRouter", {useClass: HealthItemEventRouter}); - con.register("HideoutItemEventRouter", {useClass: HideoutItemEventRouter}); - con.register("InsuranceItemEventRouter", {useClass: InsuranceItemEventRouter}); - con.register("InventoryItemEventRouter", {useClass: InventoryItemEventRouter}); - con.register("NoteItemEventRouter", {useClass: NoteItemEventRouter}); - con.register("PresetBuildItemEventRouter", {useClass: PresetBuildItemEventRouter}); - con.register("QuestItemEventRouter", {useClass: QuestItemEventRouter}); - con.register("RagfairItemEventRouter", {useClass: RagfairItemEventRouter}); - con.register("RepairItemEventRouter", {useClass: RepairItemEventRouter}); - con.register("TradeItemEventRouter", {useClass: TradeItemEventRouter}); - con.register("WishlistItemEventRouter", {useClass: WishlistItemEventRouter}); + con.register("HealthItemEventRouter", { useClass: HealthItemEventRouter }); + con.register("HideoutItemEventRouter", { useClass: HideoutItemEventRouter }); + con.register("InsuranceItemEventRouter", { useClass: InsuranceItemEventRouter }); + con.register("InventoryItemEventRouter", { useClass: InventoryItemEventRouter }); + con.register("NoteItemEventRouter", { useClass: NoteItemEventRouter }); + con.register("PresetBuildItemEventRouter", { + useClass: PresetBuildItemEventRouter, + }); + con.register("QuestItemEventRouter", { useClass: QuestItemEventRouter }); + con.register("RagfairItemEventRouter", { useClass: RagfairItemEventRouter }); + con.register("RepairItemEventRouter", { useClass: RepairItemEventRouter }); + con.register("TradeItemEventRouter", { useClass: TradeItemEventRouter }); + con.register("WishlistItemEventRouter", { useClass: WishlistItemEventRouter }); // save load routes - con.register("HealthSaveLoadRouter", {useClass: HealthSaveLoadRouter}); - con.register("InraidSaveLoadRouter", {useClass: InraidSaveLoadRouter}); - con.register("InsuranceSaveLoadRouter", {useClass: InsuranceSaveLoadRouter}); - con.register("ProfileSaveLoadRouter", {useClass: ProfileSaveLoadRouter}); + con.register("HealthSaveLoadRouter", { useClass: HealthSaveLoadRouter }); + con.register("InraidSaveLoadRouter", { useClass: InraidSaveLoadRouter }); + con.register("InsuranceSaveLoadRouter", { useClass: InsuranceSaveLoadRouter }); + con.register("ProfileSaveLoadRouter", { useClass: ProfileSaveLoadRouter }); // Route serializers - con.register("BundleSerializer", {useClass: BundleSerializer}); - con.register("ImageSerializer", {useClass: ImageSerializer}); - con.register("NotifySerializer", {useClass: NotifySerializer}); + con.register("BundleSerializer", { useClass: BundleSerializer }); + con.register("ImageSerializer", { useClass: ImageSerializer }); + con.register("NotifySerializer", { useClass: NotifySerializer }); // Static routes - con.register("BotStaticRouter", {useClass: BotStaticRouter}); - con.register("BundleStaticRouter", {useClass: BundleStaticRouter}); - con.register("ClientLogStaticRouter", {useClass: ClientLogStaticRouter}); - con.register("CustomizationStaticRouter", {useClass: CustomizationStaticRouter}); - con.register("DataStaticRouter", {useClass: DataStaticRouter}); - con.register("DialogStaticRouter", {useClass: DialogStaticRouter}); - con.register("GameStaticRouter", {useClass: GameStaticRouter}); - con.register("HealthStaticRouter", {useClass: HealthStaticRouter}); - con.register("InraidStaticRouter", {useClass: InraidStaticRouter}); - con.register("InsuranceStaticRouter", {useClass: InsuranceStaticRouter}); - con.register("ItemEventStaticRouter", {useClass: ItemEventStaticRouter}); - con.register("LauncherStaticRouter", {useClass: LauncherStaticRouter}); - con.register("LocationStaticRouter", {useClass: LocationStaticRouter}); - con.register("MatchStaticRouter", {useClass: MatchStaticRouter}); - con.register("NotifierStaticRouter", {useClass: NotifierStaticRouter}); - con.register("PresetStaticRouter", {useClass: PresetStaticRouter}); - con.register("ProfileStaticRouter", {useClass: ProfileStaticRouter}); - con.register("QuestStaticRouter", {useClass: QuestStaticRouter}); - con.register("RagfairStaticRouter", {useClass: RagfairStaticRouter}); - con.register("TraderStaticRouter", {useClass: TraderStaticRouter}); - con.register("WeatherStaticRouter", {useClass: WeatherStaticRouter}); + con.register("BotStaticRouter", { useClass: BotStaticRouter }); + con.register("BundleStaticRouter", { useClass: BundleStaticRouter }); + con.register("ClientLogStaticRouter", { useClass: ClientLogStaticRouter }); + con.register("CustomizationStaticRouter", { useClass: CustomizationStaticRouter }); + con.register("DataStaticRouter", { useClass: DataStaticRouter }); + con.register("DialogStaticRouter", { useClass: DialogStaticRouter }); + con.register("GameStaticRouter", { useClass: GameStaticRouter }); + con.register("HealthStaticRouter", { useClass: HealthStaticRouter }); + con.register("InraidStaticRouter", { useClass: InraidStaticRouter }); + con.register("InsuranceStaticRouter", { useClass: InsuranceStaticRouter }); + con.register("ItemEventStaticRouter", { useClass: ItemEventStaticRouter }); + con.register("LauncherStaticRouter", { useClass: LauncherStaticRouter }); + con.register("LocationStaticRouter", { useClass: LocationStaticRouter }); + con.register("MatchStaticRouter", { useClass: MatchStaticRouter }); + con.register("NotifierStaticRouter", { useClass: NotifierStaticRouter }); + con.register("PresetStaticRouter", { useClass: PresetStaticRouter }); + con.register("ProfileStaticRouter", { useClass: ProfileStaticRouter }); + con.register("QuestStaticRouter", { useClass: QuestStaticRouter }); + con.register("RagfairStaticRouter", { useClass: RagfairStaticRouter }); + con.register("TraderStaticRouter", { useClass: TraderStaticRouter }); + con.register("WeatherStaticRouter", { useClass: WeatherStaticRouter }); } private static registerGenerators(con: DependencyContainer): void @@ -450,27 +454,27 @@ export class Container con.register("BotWeaponGenerator", BotWeaponGenerator); con.register("BotLootGenerator", BotLootGenerator); con.register("BotInventoryGenerator", BotInventoryGenerator); - con.register("LocationGenerator", {useClass: LocationGenerator}); - con.register("PMCLootGenerator", PMCLootGenerator, {lifecycle: Lifecycle.Singleton}); + con.register("LocationGenerator", { useClass: LocationGenerator }); + con.register("PMCLootGenerator", PMCLootGenerator, { lifecycle: Lifecycle.Singleton }); con.register("ScavCaseRewardGenerator", ScavCaseRewardGenerator, { lifecycle: Lifecycle.Singleton, }); - con.register("RagfairAssortGenerator", {useClass: RagfairAssortGenerator}); - con.register("RagfairOfferGenerator", {useClass: RagfairOfferGenerator}); - con.register("WeatherGenerator", {useClass: WeatherGenerator}); - con.register("PlayerScavGenerator", {useClass: PlayerScavGenerator}); - con.register("LootGenerator", {useClass: LootGenerator}); - con.register("FenceBaseAssortGenerator", {useClass: FenceBaseAssortGenerator}); - con.register("BotLevelGenerator", {useClass: BotLevelGenerator}); - con.register("BotEquipmentModGenerator", {useClass: BotEquipmentModGenerator}); - con.register("RepeatableQuestGenerator", {useClass: RepeatableQuestGenerator}); + con.register("RagfairAssortGenerator", { useClass: RagfairAssortGenerator }); + con.register("RagfairOfferGenerator", { useClass: RagfairOfferGenerator }); + con.register("WeatherGenerator", { useClass: WeatherGenerator }); + con.register("PlayerScavGenerator", { useClass: PlayerScavGenerator }); + con.register("LootGenerator", { useClass: LootGenerator }); + con.register("FenceBaseAssortGenerator", { useClass: FenceBaseAssortGenerator }); + con.register("BotLevelGenerator", { useClass: BotLevelGenerator }); + con.register("BotEquipmentModGenerator", { useClass: BotEquipmentModGenerator }); + con.register("RepeatableQuestGenerator", { useClass: RepeatableQuestGenerator }); - con.register("BarrelInventoryMagGen", {useClass: BarrelInventoryMagGen}); - con.register("ExternalInventoryMagGen", {useClass: ExternalInventoryMagGen}); + con.register("BarrelInventoryMagGen", { useClass: BarrelInventoryMagGen }); + con.register("ExternalInventoryMagGen", { useClass: ExternalInventoryMagGen }); con.register("InternalMagazineInventoryMagGen", { useClass: InternalMagazineInventoryMagGen, }); - con.register("UbglExternalMagGen", {useClass: UbglExternalMagGen}); + con.register("UbglExternalMagGen", { useClass: UbglExternalMagGen }); con.registerType("InventoryMagGen", "BarrelInventoryMagGen"); con.registerType("InventoryMagGen", "ExternalInventoryMagGen"); @@ -481,107 +485,113 @@ export class Container private static registerHelpers(con: DependencyContainer): void { // Helpers - con.register("AssortHelper", {useClass: AssortHelper}); - con.register("BotHelper", {useClass: BotHelper}); - con.register("BotGeneratorHelper", {useClass: BotGeneratorHelper}); + con.register("AssortHelper", { useClass: AssortHelper }); + con.register("BotHelper", { useClass: BotHelper }); + con.register("BotGeneratorHelper", { useClass: BotGeneratorHelper }); con.register("ContainerHelper", ContainerHelper); - con.register("DialogueHelper", {useClass: DialogueHelper}); - con.register("DurabilityLimitsHelper", {useClass: DurabilityLimitsHelper}); + con.register("DialogueHelper", { useClass: DialogueHelper }); + con.register("DurabilityLimitsHelper", { useClass: DurabilityLimitsHelper }); con.register("GameEventHelper", GameEventHelper); - con.register("HandbookHelper", HandbookHelper, {lifecycle: Lifecycle.Singleton}); - con.register("HealthHelper", {useClass: HealthHelper}); - con.register("HideoutHelper", {useClass: HideoutHelper}); - con.register("InRaidHelper", {useClass: InRaidHelper}); - con.register("InventoryHelper", {useClass: InventoryHelper}); + con.register("HandbookHelper", HandbookHelper, { lifecycle: Lifecycle.Singleton }); + con.register("HealthHelper", { useClass: HealthHelper }); + con.register("HideoutHelper", { useClass: HideoutHelper }); + con.register("InRaidHelper", { useClass: InRaidHelper }); + con.register("InventoryHelper", { useClass: InventoryHelper }); con.register("PaymentHelper", PaymentHelper); - con.register("ItemHelper", {useClass: ItemHelper}); - con.register("PresetHelper", PresetHelper, {lifecycle: Lifecycle.Singleton}); - con.register("ProfileHelper", {useClass: ProfileHelper}); - con.register("QuestHelper", {useClass: QuestHelper}); + con.register("ItemHelper", { useClass: ItemHelper }); + con.register("PresetHelper", PresetHelper, { lifecycle: Lifecycle.Singleton }); + con.register("ProfileHelper", { useClass: ProfileHelper }); + con.register("QuestHelper", { useClass: QuestHelper }); con.register("QuestConditionHelper", QuestConditionHelper); - con.register("RagfairHelper", {useClass: RagfairHelper}); - con.register("RagfairSortHelper", {useClass: RagfairSortHelper}); - con.register("RagfairSellHelper", {useClass: RagfairSellHelper}); - con.register("RagfairOfferHelper", {useClass: RagfairOfferHelper}); - con.register("RagfairServerHelper", {useClass: RagfairServerHelper}); - con.register("RepairHelper", {useClass: RepairHelper}); + con.register("RagfairHelper", { useClass: RagfairHelper }); + con.register("RagfairSortHelper", { useClass: RagfairSortHelper }); + con.register("RagfairSellHelper", { useClass: RagfairSellHelper }); + con.register("RagfairOfferHelper", { useClass: RagfairOfferHelper }); + con.register("RagfairServerHelper", { useClass: RagfairServerHelper }); + con.register("RepairHelper", { useClass: RepairHelper }); con.register("TraderHelper", TraderHelper); - con.register("TraderAssortHelper", TraderAssortHelper, {lifecycle: Lifecycle.Singleton}); - con.register("TradeHelper", {useClass: TradeHelper}); - con.register("NotifierHelper", {useClass: NotifierHelper}); + con.register("TraderAssortHelper", TraderAssortHelper, { lifecycle: Lifecycle.Singleton }); + con.register("TradeHelper", { useClass: TradeHelper }); + con.register("NotifierHelper", { useClass: NotifierHelper }); con.register("UtilityHelper", UtilityHelper); - con.register("WeightedRandomHelper", {useClass: WeightedRandomHelper}); - con.register("HttpServerHelper", {useClass: HttpServerHelper}); - con.register("NotificationSendHelper", {useClass: NotificationSendHelper}); - con.register("SecureContainerHelper", {useClass: SecureContainerHelper}); - con.register("ProbabilityHelper", {useClass: ProbabilityHelper}); - con.register("BotWeaponGeneratorHelper", {useClass: BotWeaponGeneratorHelper}); - con.register("BotDifficultyHelper", {useClass: BotDifficultyHelper}); - con.register("RepeatableQuestHelper", {useClass: RepeatableQuestHelper}); + con.register("WeightedRandomHelper", { useClass: WeightedRandomHelper }); + con.register("HttpServerHelper", { useClass: HttpServerHelper }); + con.register("NotificationSendHelper", { useClass: NotificationSendHelper }); + con.register("SecureContainerHelper", { useClass: SecureContainerHelper }); + con.register("ProbabilityHelper", { useClass: ProbabilityHelper }); + con.register("BotWeaponGeneratorHelper", { useClass: BotWeaponGeneratorHelper }); + con.register("BotDifficultyHelper", { useClass: BotDifficultyHelper }); + con.register("RepeatableQuestHelper", { useClass: RepeatableQuestHelper }); } private static registerLoaders(con: DependencyContainer): void { // Loaders - con.register("BundleLoader", BundleLoader, {lifecycle: Lifecycle.Singleton}); - con.register("PreAkiModLoader", PreAkiModLoader, {lifecycle: Lifecycle.Singleton}); - con.register("PostAkiModLoader", PostAkiModLoader, {lifecycle: Lifecycle.Singleton}); + con.register("BundleLoader", BundleLoader, { lifecycle: Lifecycle.Singleton }); + con.register("PreAkiModLoader", PreAkiModLoader, { lifecycle: Lifecycle.Singleton }); + con.register("PostAkiModLoader", PostAkiModLoader, { lifecycle: Lifecycle.Singleton }); } private static registerCallbacks(con: DependencyContainer): void { // Callbacks - con.register("BotCallbacks", {useClass: BotCallbacks}); - con.register("BundleCallbacks", {useClass: BundleCallbacks}); - con.register("ClientLogCallbacks", {useClass: ClientLogCallbacks}); - con.register("CustomizationCallbacks", {useClass: CustomizationCallbacks}); - con.register("DataCallbacks", {useClass: DataCallbacks}); - con.register("DialogueCallbacks", {useClass: DialogueCallbacks}); - con.register("GameCallbacks", {useClass: GameCallbacks}); - con.register("HandbookCallbacks", {useClass: HandbookCallbacks}); - con.register("HealthCallbacks", {useClass: HealthCallbacks}); - con.register("HideoutCallbacks", {useClass: HideoutCallbacks}); - con.register("HttpCallbacks", {useClass: HttpCallbacks}); - con.register("InraidCallbacks", {useClass: InraidCallbacks}); - con.register("InsuranceCallbacks", {useClass: InsuranceCallbacks}); - con.register("InventoryCallbacks", {useClass: InventoryCallbacks}); - con.register("ItemEventCallbacks", {useClass: ItemEventCallbacks}); - con.register("LauncherCallbacks", {useClass: LauncherCallbacks}); - con.register("LocationCallbacks", {useClass: LocationCallbacks}); - con.register("MatchCallbacks", {useClass: MatchCallbacks}); - con.register("ModCallbacks", {useClass: ModCallbacks}); - con.register("PostDBModLoader", {useClass: PostDBModLoader}); - con.register("NoteCallbacks", {useClass: NoteCallbacks}); - con.register("NotifierCallbacks", {useClass: NotifierCallbacks}); - con.register("PresetBuildCallbacks", {useClass: PresetBuildCallbacks}); - con.register("PresetCallbacks", {useClass: PresetCallbacks}); - con.register("ProfileCallbacks", {useClass: ProfileCallbacks}); - con.register("QuestCallbacks", {useClass: QuestCallbacks}); - con.register("RagfairCallbacks", {useClass: RagfairCallbacks}); - con.register("RepairCallbacks", {useClass: RepairCallbacks}); - con.register("SaveCallbacks", {useClass: SaveCallbacks}); - con.register("TradeCallbacks", {useClass: TradeCallbacks}); - con.register("TraderCallbacks", {useClass: TraderCallbacks}); - con.register("WeatherCallbacks", {useClass: WeatherCallbacks}); - con.register("WishlistCallbacks", {useClass: WishlistCallbacks}); + con.register("BotCallbacks", { useClass: BotCallbacks }); + con.register("BundleCallbacks", { useClass: BundleCallbacks }); + con.register("ClientLogCallbacks", { useClass: ClientLogCallbacks }); + con.register("CustomizationCallbacks", { useClass: CustomizationCallbacks }); + con.register("DataCallbacks", { useClass: DataCallbacks }); + con.register("DialogueCallbacks", { useClass: DialogueCallbacks }); + con.register("GameCallbacks", { useClass: GameCallbacks }); + con.register("HandbookCallbacks", { useClass: HandbookCallbacks }); + con.register("HealthCallbacks", { useClass: HealthCallbacks }); + con.register("HideoutCallbacks", { useClass: HideoutCallbacks }); + con.register("HttpCallbacks", { useClass: HttpCallbacks }); + con.register("InraidCallbacks", { useClass: InraidCallbacks }); + con.register("InsuranceCallbacks", { useClass: InsuranceCallbacks }); + con.register("InventoryCallbacks", { useClass: InventoryCallbacks }); + con.register("ItemEventCallbacks", { useClass: ItemEventCallbacks }); + con.register("LauncherCallbacks", { useClass: LauncherCallbacks }); + con.register("LocationCallbacks", { useClass: LocationCallbacks }); + con.register("MatchCallbacks", { useClass: MatchCallbacks }); + con.register("ModCallbacks", { useClass: ModCallbacks }); + con.register("PostDBModLoader", { useClass: PostDBModLoader }); + con.register("NoteCallbacks", { useClass: NoteCallbacks }); + con.register("NotifierCallbacks", { useClass: NotifierCallbacks }); + con.register("PresetBuildCallbacks", { useClass: PresetBuildCallbacks }); + con.register("PresetCallbacks", { useClass: PresetCallbacks }); + con.register("ProfileCallbacks", { useClass: ProfileCallbacks }); + con.register("QuestCallbacks", { useClass: QuestCallbacks }); + con.register("RagfairCallbacks", { useClass: RagfairCallbacks }); + con.register("RepairCallbacks", { useClass: RepairCallbacks }); + con.register("SaveCallbacks", { useClass: SaveCallbacks }); + con.register("TradeCallbacks", { useClass: TradeCallbacks }); + con.register("TraderCallbacks", { useClass: TraderCallbacks }); + con.register("WeatherCallbacks", { useClass: WeatherCallbacks }); + con.register("WishlistCallbacks", { useClass: WishlistCallbacks }); } private static registerServices(con: DependencyContainer): void { // Services - con.register("ImageRouteService", ImageRouteService, {lifecycle: Lifecycle.Singleton}); + con.register("ImageRouteService", ImageRouteService, { lifecycle: Lifecycle.Singleton }); - con.register("FenceService", FenceService, {lifecycle: Lifecycle.Singleton}); - con.register("PlayerService", {useClass: PlayerService}); - con.register("PaymentService", {useClass: PaymentService}); - con.register("InsuranceService", InsuranceService, {lifecycle: Lifecycle.Singleton}); - con.register("TraderAssortService", TraderAssortService, {lifecycle: Lifecycle.Singleton}); + con.register("FenceService", FenceService, { lifecycle: Lifecycle.Singleton }); + con.register("PlayerService", { useClass: PlayerService }); + con.register("PaymentService", { useClass: PaymentService }); + con.register("InsuranceService", InsuranceService, { lifecycle: Lifecycle.Singleton }); + con.register("TraderAssortService", TraderAssortService, { + lifecycle: Lifecycle.Singleton, + }); - con.register("RagfairPriceService", RagfairPriceService, {lifecycle: Lifecycle.Singleton}); + con.register("RagfairPriceService", RagfairPriceService, { + lifecycle: Lifecycle.Singleton, + }); con.register("RagfairCategoriesService", RagfairCategoriesService, { lifecycle: Lifecycle.Singleton, }); - con.register("RagfairOfferService", RagfairOfferService, {lifecycle: Lifecycle.Singleton}); + con.register("RagfairOfferService", RagfairOfferService, { + lifecycle: Lifecycle.Singleton, + }); con.register("RagfairLinkedItemService", RagfairLinkedItemService, { lifecycle: Lifecycle.Singleton, }); @@ -589,30 +599,36 @@ export class Container lifecycle: Lifecycle.Singleton, }); - con.register("NotificationService", NotificationService, {lifecycle: Lifecycle.Singleton}); + con.register("NotificationService", NotificationService, { + lifecycle: Lifecycle.Singleton, + }); con.register("MatchLocationService", MatchLocationService, { lifecycle: Lifecycle.Singleton, }); con.register("ModCompilerService", ModCompilerService); - con.register("HashCacheService", HashCacheService, {lifecycle: Lifecycle.Singleton}); - con.register("LocaleService", LocaleService, {lifecycle: Lifecycle.Singleton}); + con.register("HashCacheService", HashCacheService, { lifecycle: Lifecycle.Singleton }); + con.register("LocaleService", LocaleService, { lifecycle: Lifecycle.Singleton }); con.register("ProfileFixerService", ProfileFixerService); con.register("RepairService", RepairService); - con.register("BotLootCacheService", BotLootCacheService, {lifecycle: Lifecycle.Singleton}); + con.register("BotLootCacheService", BotLootCacheService, { + lifecycle: Lifecycle.Singleton, + }); con.register("CustomItemService", CustomItemService); con.register("BotEquipmentFilterService", BotEquipmentFilterService); con.register("ProfileSnapshotService", ProfileSnapshotService, { lifecycle: Lifecycle.Singleton, }); - con.register("ItemFilterService", ItemFilterService, {lifecycle: Lifecycle.Singleton}); + con.register("ItemFilterService", ItemFilterService, { lifecycle: Lifecycle.Singleton }); 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, }); - con.register("OpenZoneService", OpenZoneService, {lifecycle: Lifecycle.Singleton}); + con.register("OpenZoneService", OpenZoneService, { lifecycle: Lifecycle.Singleton }); con.register("ItemBaseClassService", ItemBaseClassService, { lifecycle: Lifecycle.Singleton, }); @@ -628,7 +644,7 @@ export class Container con.register("MatchBotDetailsCacheService", MatchBotDetailsCacheService, { lifecycle: Lifecycle.Singleton, }); - con.register("RagfairTaxService", RagfairTaxService, {lifecycle: Lifecycle.Singleton}); + con.register("RagfairTaxService", RagfairTaxService, { lifecycle: Lifecycle.Singleton }); con.register("TraderPurchasePersisterService", TraderPurchasePersisterService); con.register("PmcChatResponseService", PmcChatResponseService); con.register("GiftService", GiftService); @@ -638,43 +654,43 @@ export class Container private static registerServers(con: DependencyContainer): void { // Servers - con.register("DatabaseServer", DatabaseServer, {lifecycle: Lifecycle.Singleton}); - con.register("HttpServer", HttpServer, {lifecycle: Lifecycle.Singleton}); - con.register("WebSocketServer", WebSocketServer, {lifecycle: Lifecycle.Singleton}); + con.register("DatabaseServer", DatabaseServer, { lifecycle: Lifecycle.Singleton }); + con.register("HttpServer", HttpServer, { lifecycle: Lifecycle.Singleton }); + con.register("WebSocketServer", WebSocketServer, { lifecycle: Lifecycle.Singleton }); con.register("RagfairServer", RagfairServer); - con.register("SaveServer", SaveServer, {lifecycle: Lifecycle.Singleton}); - con.register("ConfigServer", ConfigServer, {lifecycle: Lifecycle.Singleton}); + con.register("SaveServer", SaveServer, { lifecycle: Lifecycle.Singleton }); + con.register("ConfigServer", ConfigServer, { lifecycle: Lifecycle.Singleton }); } private static registerControllers(con: DependencyContainer): void { // Controllers - con.register("BotController", {useClass: BotController}); - con.register("ClientLogController", {useClass: ClientLogController}); - con.register("CustomizationController", {useClass: CustomizationController}); - con.register("DialogueController", {useClass: DialogueController}); - con.register("GameController", {useClass: GameController}); - con.register("HandbookController", {useClass: HandbookController}); - con.register("HealthController", {useClass: HealthController}); - con.register("HideoutController", {useClass: HideoutController}); - con.register("InraidController", {useClass: InraidController}); - con.register("InsuranceController", {useClass: InsuranceController}); - con.register("InventoryController", {useClass: InventoryController}); - con.register("LauncherController", {useClass: LauncherController}); - con.register("LocationController", {useClass: LocationController}); + con.register("BotController", { useClass: BotController }); + con.register("ClientLogController", { useClass: ClientLogController }); + con.register("CustomizationController", { useClass: CustomizationController }); + con.register("DialogueController", { useClass: DialogueController }); + con.register("GameController", { useClass: GameController }); + con.register("HandbookController", { useClass: HandbookController }); + con.register("HealthController", { useClass: HealthController }); + con.register("HideoutController", { useClass: HideoutController }); + con.register("InraidController", { useClass: InraidController }); + con.register("InsuranceController", { useClass: InsuranceController }); + con.register("InventoryController", { useClass: InventoryController }); + con.register("LauncherController", { useClass: LauncherController }); + con.register("LocationController", { useClass: LocationController }); con.register("MatchController", MatchController); - con.register("NoteController", {useClass: NoteController}); - con.register("NotifierController", {useClass: NotifierController}); - con.register("PresetBuildController", {useClass: PresetBuildController}); - con.register("PresetController", {useClass: PresetController}); - con.register("ProfileController", {useClass: ProfileController}); - con.register("QuestController", {useClass: QuestController}); - con.register("RagfairController", {useClass: RagfairController}); - con.register("RepairController", {useClass: RepairController}); - con.register("RepeatableQuestController", {useClass: RepeatableQuestController}); - con.register("TradeController", {useClass: TradeController}); - con.register("TraderController", {useClass: TraderController}); - con.register("WeatherController", {useClass: WeatherController}); + con.register("NoteController", { useClass: NoteController }); + con.register("NotifierController", { useClass: NotifierController }); + con.register("PresetBuildController", { useClass: PresetBuildController }); + con.register("PresetController", { useClass: PresetController }); + con.register("ProfileController", { useClass: ProfileController }); + con.register("QuestController", { useClass: QuestController }); + con.register("RagfairController", { useClass: RagfairController }); + con.register("RepairController", { useClass: RepairController }); + con.register("RepeatableQuestController", { useClass: RepeatableQuestController }); + con.register("TradeController", { useClass: TradeController }); + con.register("TraderController", { useClass: TraderController }); + con.register("WeatherController", { useClass: WeatherController }); con.register("WishlistController", WishlistController); } } diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index 658938b4..d105e602 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -642,7 +642,10 @@ export class BotEquipmentModGenerator // Pick random mod and check it's compatible const exhaustableModPool = new ExhaustableArray(itemModPool[modSlot], this.randomUtil, this.jsonUtil); - let modCompatibilityResult: {incompatible: boolean; reason: string;} = {incompatible: false, reason: ""}; + let modCompatibilityResult: { incompatible: boolean; reason: string; } = { + incompatible: false, + reason: "", + }; while (exhaustableModPool.hasValues()) { modTpl = exhaustableModPool.getRandomValue(); @@ -1011,7 +1014,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 a8c3f794..df914f37 100644 --- a/project/src/generators/BotGenerator.ts +++ b/project/src/generators/BotGenerator.ts @@ -430,7 +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 6128e349..482c4497 100644 --- a/project/src/generators/BotInventoryGenerator.ts +++ b/project/src/generators/BotInventoryGenerator.ts @@ -112,11 +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, @@ -403,10 +403,10 @@ export class BotInventoryGenerator * @param equipmentChances Chances bot has certain equipment * @returns What slots bot should have weapons generated for */ - protected getDesiredWeaponsForBot(equipmentChances: Chances): {slot: EquipmentSlots; shouldSpawn: boolean;}[] + protected getDesiredWeaponsForBot(equipmentChances: Chances): { slot: EquipmentSlots; shouldSpawn: boolean; }[] { const shouldSpawnPrimary = this.randomUtil.getChance100(equipmentChances.equipment.FirstPrimaryWeapon); - return [{slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary}, { + return [{ slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary }, { slot: EquipmentSlots.SECOND_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary ? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon) @@ -432,7 +432,7 @@ export class BotInventoryGenerator */ protected addWeaponAndMagazinesToInventory( sessionId: string, - weaponSlot: {slot: EquipmentSlots; shouldSpawn: boolean;}, + weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, diff --git a/project/src/generators/BotLevelGenerator.ts b/project/src/generators/BotLevelGenerator.ts index 8b2be669..38778504 100644 --- a/project/src/generators/BotLevelGenerator.ts +++ b/project/src/generators/BotLevelGenerator.ts @@ -55,7 +55,7 @@ export class BotLevelGenerator exp += this.randomUtil.getInt(0, expTable[level].exp - 1); } - return {level, exp}; + return { level, exp }; } /** diff --git a/project/src/generators/BotWeaponGenerator.ts b/project/src/generators/BotWeaponGenerator.ts index 854399f7..e0f2551a 100644 --- a/project/src/generators/BotWeaponGenerator.ts +++ b/project/src/generators/BotWeaponGenerator.ts @@ -252,13 +252,13 @@ export class BotWeaponGenerator _tpl: ammoTpl, parentId: weaponWithModsArray[0]._id, slotId: desiredSlotId, - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }); } else { // Already exists, update values - existingItemWithSlot.upd = {StackObjectsCount: 1}; + existingItemWithSlot.upd = { StackObjectsCount: 1 }; existingItemWithSlot._tpl = ammoTpl; } } @@ -486,7 +486,7 @@ export class BotWeaponGenerator // Define min/max of how many grenades bot will have const ubglMinMax: GenerationData = { // eslint-disable-next-line @typescript-eslint/naming-convention - weights: {"1": 1, "2": 1}, + weights: { "1": 1, "2": 1 }, whitelist: [], }; @@ -530,7 +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, ); } @@ -704,7 +704,7 @@ export class BotWeaponGenerator _tpl: ubglAmmoTpl, parentId: ubglMod._id, slotId: "patron_in_weapon", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }); } @@ -763,7 +763,7 @@ export class BotWeaponGenerator } else { - camora.upd = {StackObjectsCount: 1}; + camora.upd = { StackObjectsCount: 1 }; } } } diff --git a/project/src/generators/FenceBaseAssortGenerator.ts b/project/src/generators/FenceBaseAssortGenerator.ts index 30c50dce..e7232944 100644 --- a/project/src/generators/FenceBaseAssortGenerator.ts +++ b/project/src/generators/FenceBaseAssortGenerator.ts @@ -97,7 +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 6f5f5316..a05df10b 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -338,7 +338,7 @@ export class LocationGenerator // Add an empty group for containers without a group id but still have a < 100% chance to spawn // Likely bad BSG data, will be fixed...eventually, example of the groupids: `NEED_TO_BE_FIXED1`,`NEED_TO_BE_FIXED_SE02`, `NEED_TO_BE_FIXED_NW_01` - mapping[""] = {containerIdsWithProbability: {}, chosenCount: -1}; + mapping[""] = { containerIdsWithProbability: {}, chosenCount: -1 }; // Iterate over all containers and add to group keyed by groupId // Containers without a group go into a group with empty key "" @@ -449,7 +449,7 @@ export class LocationGenerator const rotation = result.rotation ? 1 : 0; items[0].slotId = "main"; - items[0].location = {x: result.x, y: result.y, r: rotation}; + items[0].location = { x: result.x, y: result.y, r: rotation }; // Add loot to container before returning for (const item of items) @@ -780,13 +780,17 @@ 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); } @@ -794,7 +798,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, @@ -821,7 +825,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 }; } /** @@ -873,7 +877,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) @@ -890,7 +894,7 @@ export class LocationGenerator const stackCount = itemTemplate._props.StackMaxSize === 1 ? 1 : this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); - items[0].upd = {StackObjectsCount: stackCount}; + items[0].upd = { StackObjectsCount: stackCount }; } // No spawn point, use default template else if (this.itemHelper.isOfBaseclass(tpl, BaseClasses.WEAPON)) @@ -930,7 +934,7 @@ export class LocationGenerator if (!rootItem) { this.logger.error( - this.localisationService.getText("location-missing_root_item", {tpl: tpl, parentId: parentId}), + this.localisationService.getText("location-missing_root_item", { tpl: tpl, parentId: parentId }), ); throw new Error(this.localisationService.getText("location-critical_error_see_log")); @@ -1004,6 +1008,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 2dce664f..cf5f57ce 100644 --- a/project/src/generators/LootGenerator.ts +++ b/project/src/generators/LootGenerator.ts @@ -19,7 +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 @@ -131,7 +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; @@ -147,7 +147,7 @@ export class LootGenerator */ protected findAndAddRandomItemToLoot( items: [string, ITemplateItem][], - itemTypeCounts: Record, + itemTypeCounts: Record, options: LootRequest, result: LootItem[], ): boolean @@ -225,7 +225,7 @@ export class LootGenerator */ protected findAndAddRandomPresetToLoot( globalDefaultPresets: [string, IPreset][], - itemTypeCounts: Record, + itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[], ): boolean @@ -268,7 +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); @@ -505,7 +505,7 @@ export class LootGenerator else { // eslint-disable-next-line @typescript-eslint/naming-convention - resultsArray.push({item_id: itemTplToAdd, count: 1, isPreset: false}); + resultsArray.push({ item_id: itemTplToAdd, count: 1, isPreset: false }); } } } diff --git a/project/src/generators/PlayerScavGenerator.ts b/project/src/generators/PlayerScavGenerator.ts index 14fe59fc..ce557c24 100644 --- a/project/src/generators/PlayerScavGenerator.ts +++ b/project/src/generators/PlayerScavGenerator.ts @@ -112,8 +112,8 @@ export class PlayerScavGenerator scavData.Info.Level = this.getScavLevel(existingScavData); scavData.Info.Experience = this.getScavExperience(existingScavData); scavData.Quests = existingScavData.Quests ?? []; - scavData.ConditionCounters = existingScavData.ConditionCounters ?? {Counters: []}; - scavData.Notes = existingScavData.Notes ?? {Notes: []}; + scavData.ConditionCounters = existingScavData.ConditionCounters ?? { Counters: [] }; + scavData.Notes = existingScavData.Notes ?? { Notes: [] }; scavData.WishList = existingScavData.WishList ?? []; // Add an extra labs card to pscav backpack based on config chance @@ -256,7 +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 4e343613..b88944ee 100644 --- a/project/src/generators/RagfairAssortGenerator.ts +++ b/project/src/generators/RagfairAssortGenerator.ts @@ -135,7 +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 68071f03..3fba7154 100644 --- a/project/src/generators/RagfairOfferGenerator.ts +++ b/project/src/generators/RagfairOfferGenerator.ts @@ -33,7 +33,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; - protected allowedFleaPriceItemsForBarter: {tpl: string; price: number;}[]; + protected allowedFleaPriceItemsForBarter: { tpl: string; price: number; }[]; constructor( @inject("WinstonLogger") protected logger: ILogger, @@ -636,7 +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 }; } } @@ -687,27 +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; @@ -762,20 +762,20 @@ 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 }]; } /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ - protected getFleaPricesAsArray(): {tpl: string; price: number;}[] + protected getFleaPricesAsArray(): { tpl: string; price: number; }[] { // Generate if needed if (!this.allowedFleaPriceItemsForBarter) { const fleaPrices = this.databaseServer.getTables().templates.prices; - const fleaArray = Object.entries(fleaPrices).map(([tpl, price]) => ({tpl: tpl, price: price})); + const fleaArray = Object.entries(fleaPrices).map(([tpl, price]) => ({ tpl: tpl, price: price })); // Only get item prices for items that also exist in items.json const filteredItems = fleaArray.filter((x) => this.itemHelper.getItem(x.tpl)[0]); @@ -801,6 +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 c2c219a8..aa65f9ff 100644 --- a/project/src/generators/RepeatableQuestGenerator.ts +++ b/project/src/generators/RepeatableQuestGenerator.ts @@ -273,7 +273,7 @@ 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, @@ -415,7 +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", }; @@ -461,7 +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 @@ -476,7 +476,7 @@ export class RepeatableQuestGenerator killConditionProps.weaponCategories = [allowedWeaponCategory]; } - return {_props: killConditionProps, _parent: "Kills"}; + return { _props: killConditionProps, _parent: "Kills" }; } /** @@ -699,11 +699,11 @@ 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(); @@ -797,7 +797,10 @@ 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 }, + }; } /** @@ -869,7 +872,11 @@ 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) { @@ -946,7 +953,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); } @@ -1010,9 +1017,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) { diff --git a/project/src/generators/ScavCaseRewardGenerator.ts b/project/src/generators/ScavCaseRewardGenerator.ts index 21ca83a9..6ceddaa7 100644 --- a/project/src/generators/ScavCaseRewardGenerator.ts +++ b/project/src/generators/ScavCaseRewardGenerator.ts @@ -279,7 +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); @@ -302,13 +302,13 @@ export class ScavCaseRewardGenerator */ protected addStackCountToAmmoAndMoney( item: ITemplateItem, - resultItem: {_id: string; _tpl: string; upd: Upd;}, + resultItem: { _id: string; _tpl: string; upd: Upd; }, rarity: string, ): void { if (item._parent === BaseClasses.AMMO || item._parent === BaseClasses.MONEY) { - resultItem.upd = {StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity)}; + resultItem.upd = { StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity) }; } } diff --git a/project/src/helpers/AssortHelper.ts b/project/src/helpers/AssortHelper.ts index 04148c2c..83fa16a3 100644 --- a/project/src/helpers/AssortHelper.ts +++ b/project/src/helpers/AssortHelper.ts @@ -75,7 +75,7 @@ export class AssortHelper protected getQuestIdAndStatusThatShowAssort( mergedQuestAssorts: Record>, assortId: string, - ): {questId: string; status: QuestStatus[];} + ): { questId: string; status: QuestStatus[]; } { if (assortId in mergedQuestAssorts.started) { @@ -87,11 +87,11 @@ export class AssortHelper } else if (assortId in mergedQuestAssorts.success) { - return {questId: mergedQuestAssorts.success[assortId], status: [QuestStatus.Success]}; + return { questId: mergedQuestAssorts.success[assortId], status: [QuestStatus.Success] }; } else if (assortId in mergedQuestAssorts.fail) { - return {questId: mergedQuestAssorts.fail[assortId], status: [QuestStatus.Fail]}; + return { questId: mergedQuestAssorts.fail[assortId], status: [QuestStatus.Fail] }; } return undefined; diff --git a/project/src/helpers/BotGeneratorHelper.ts b/project/src/helpers/BotGeneratorHelper.ts index 97ac6b87..2263d6bb 100644 --- a/project/src/helpers/BotGeneratorHelper.ts +++ b/project/src/helpers/BotGeneratorHelper.ts @@ -46,7 +46,7 @@ export class BotGeneratorHelper * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): {upd?: Upd;} + public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; } { // Get raid settings, if no raid, default to day const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue< @@ -70,23 +70,23 @@ export class BotGeneratorHelper if (itemTemplate._props.HasHinge) { - itemProperties.Togglable = {On: true}; + itemProperties.Togglable = { On: true }; } if (itemTemplate._props.Foldable) { - itemProperties.Foldable = {Folded: false}; + itemProperties.Foldable = { Folded: false }; } if (itemTemplate._props.weapFireType?.length) { if (itemTemplate._props.weapFireType.includes("fullauto")) { - itemProperties.FireMode = {FireMode: "fullauto"}; + itemProperties.FireMode = { FireMode: "fullauto" }; } else { - itemProperties.FireMode = {FireMode: this.randomUtil.getArrayValue(itemTemplate._props.weapFireType)}; + itemProperties.FireMode = { FireMode: this.randomUtil.getArrayValue(itemTemplate._props.weapFireType) }; } } @@ -116,7 +116,10 @@ export class BotGeneratorHelper const lightLaserActiveChance = raidIsNight ? this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50) : this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveDayChancePercent", 25); - itemProperties.Light = {IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0}; + itemProperties.Light = { + IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), + SelectedMode: 0, + }; } else if (itemTemplate._parent === BaseClasses.TACTICAL_COMBO) { @@ -126,7 +129,10 @@ export class BotGeneratorHelper "laserIsActiveChancePercent", 50, ); - itemProperties.Light = {IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0}; + itemProperties.Light = { + IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), + SelectedMode: 0, + }; } if (itemTemplate._parent === BaseClasses.NIGHTVISION) @@ -135,7 +141,7 @@ export class BotGeneratorHelper const nvgActiveChance = raidIsNight ? this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceNightPercent", 90) : this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceDayPercent", 15); - itemProperties.Togglable = {On: (this.randomUtil.getChance100(nvgActiveChance))}; + itemProperties.Togglable = { On: (this.randomUtil.getChance100(nvgActiveChance)) }; } // Togglable face shield @@ -147,10 +153,10 @@ export class BotGeneratorHelper "faceShieldIsActiveChancePercent", 75, ); - itemProperties.Togglable = {On: (this.randomUtil.getChance100(faceShieldActiveChance))}; + itemProperties.Togglable = { On: (this.randomUtil.getChance100(faceShieldActiveChance)) }; } - return Object.keys(itemProperties).length ? {upd: itemProperties} : {}; + return Object.keys(itemProperties).length ? { upd: itemProperties } : {}; } /** @@ -238,7 +244,7 @@ export class BotGeneratorHelper maxDurability, ); - return {Durability: currentDurability, MaxDurability: maxDurability}; + return { Durability: currentDurability, MaxDurability: maxDurability }; } /** @@ -266,7 +272,7 @@ export class BotGeneratorHelper ); } - return {Durability: currentDurability, MaxDurability: maxDurability}; + return { Durability: currentDurability, MaxDurability: maxDurability }; } /** @@ -280,12 +286,12 @@ export class BotGeneratorHelper items: Item[], tplToCheck: string, equipmentSlot: string, - ): {incompatible: boolean; reason: string;} + ): { incompatible: boolean; reason: string; } { // Skip slots that have no incompatibilities if (["Scabbard", "Backpack", "SecureContainer", "Holster", "ArmBand"].includes(equipmentSlot)) { - return {incompatible: false, reason: ""}; + return { incompatible: false, reason: "" }; } // TODO: Can probably be optimized to cache itemTemplates as items are added to inventory @@ -350,7 +356,7 @@ export class BotGeneratorHelper }; } - return {incompatible: false, reason: ""}; + return { incompatible: false, reason: "" }; } /** diff --git a/project/src/helpers/BotWeaponGeneratorHelper.ts b/project/src/helpers/BotWeaponGeneratorHelper.ts index 8be17470..fe9afb69 100644 --- a/project/src/helpers/BotWeaponGeneratorHelper.ts +++ b/project/src/helpers/BotWeaponGeneratorHelper.ts @@ -96,7 +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); @@ -120,7 +120,7 @@ export class BotWeaponGeneratorHelper const ammoItems = this.itemHelper.splitStack({ _id: this.hashUtil.generate(), _tpl: ammoTpl, - upd: {StackObjectsCount: cartridgeCount}, + upd: { StackObjectsCount: cartridgeCount }, }); for (const ammoItem of ammoItems) diff --git a/project/src/helpers/DialogueHelper.ts b/project/src/helpers/DialogueHelper.ts index 47c4a799..90a69dfc 100644 --- a/project/src/helpers/DialogueHelper.ts +++ b/project/src/helpers/DialogueHelper.ts @@ -39,7 +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) { @@ -66,7 +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; } @@ -79,7 +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/HealthHelper.ts b/project/src/helpers/HealthHelper.ts index f9247e8a..d5b2d3a0 100644 --- a/project/src/helpers/HealthHelper.ts +++ b/project/src/helpers/HealthHelper.ts @@ -38,7 +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, @@ -255,7 +255,7 @@ export class HealthHelper profileBodyPart.Effects = {}; } - profileBodyPart.Effects[effectType] = {Time: duration}; + profileBodyPart.Effects[effectType] = { Time: duration }; // Delete empty property to prevent client bugs if (this.isEmpty(profileBodyPart.Effects)) @@ -264,7 +264,7 @@ export class HealthHelper } } - protected isEmpty(map: Record): boolean + protected isEmpty(map: Record): boolean { for (const key in map) { diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index b6449457..9fff70fd 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -187,7 +187,7 @@ export class HideoutHelper */ protected getHideoutProperties( pmcData: IPmcData, - ): {btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;} + ): { btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; } { const bitcoinFarm = pmcData.Hideout.Areas.find((x) => x.type === HideoutAreas.BITCOIN_FARM); const bitcoinCount = bitcoinFarm?.slots.filter((slot) => slot.item).length ?? 0; // Get slots with an item property @@ -224,7 +224,7 @@ export class HideoutHelper protected updateWaterCollectorProductionTimer( pmcData: IPmcData, productionId: string, - hideoutProperties: {btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;}, + hideoutProperties: { btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }, ): void { const timeElapsed = this.getTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.isGeneratorOn); @@ -241,7 +241,7 @@ export class HideoutHelper */ protected updateProductionTimers( pmcData: IPmcData, - hideoutProperties: {btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;}, + hideoutProperties: { btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }, ): void { const recipes = this.databaseServer.getTables().hideout.production; @@ -310,7 +310,7 @@ export class HideoutHelper pmcData: IPmcData, prodId: string, recipe: IHideoutProduction, - hideoutProperties: {btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter?: boolean;}, + hideoutProperties: { btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter?: boolean; }, ): void { // Production is complete, no need to do any calculations @@ -367,7 +367,7 @@ export class HideoutHelper protected updateAreasWithResources( sessionID: string, pmcData: IPmcData, - hideoutProperties: {btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;}, + hideoutProperties: { btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }, ): void { for (const area of pmcData.Hideout.Areas) @@ -651,7 +651,10 @@ 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 @@ -699,7 +702,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 @@ -806,7 +809,7 @@ export class HideoutHelper btcProd.Products.push({ _id: this.hashUtil.generate(), _tpl: "59faff1d86f7746c51718c9c", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }); btcProd.Progress -= coinCraftTimeSeconds; diff --git a/project/src/helpers/HttpServerHelper.ts b/project/src/helpers/HttpServerHelper.ts index d8f0c1e6..d647c047 100644 --- a/project/src/helpers/HttpServerHelper.ts +++ b/project/src/helpers/HttpServerHelper.ts @@ -58,7 +58,7 @@ export class HttpServerHelper public sendTextJson(resp: any, output: any): void { // eslint-disable-next-line @typescript-eslint/naming-convention - resp.writeHead(200, "OK", {"Content-Type": this.mime.json}); + resp.writeHead(200, "OK", { "Content-Type": this.mime.json }); resp.end(output); } } diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index c5c35953..891f4f74 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -294,7 +294,7 @@ export class InRaidHelper } // Add effect to server profile - profileBodyPartEffects[effect] = {Time: effectDetails.Time ?? -1}; + profileBodyPartEffects[effect] = { Time: effectDetails.Time ?? -1 }; } } } diff --git a/project/src/helpers/InventoryHelper.ts b/project/src/helpers/InventoryHelper.ts index e94f4ba9..66b98fa0 100644 --- a/project/src/helpers/InventoryHelper.ts +++ b/project/src/helpers/InventoryHelper.ts @@ -103,7 +103,7 @@ export class InventoryHelper } else if (this.paymentHelper.isMoneyTpl(requestItem.item_id)) { - itemLib.push({_id: requestItem.item_id, _tpl: requestItem.item_id}); + itemLib.push({ _id: requestItem.item_id, _tpl: requestItem.item_id }); } else if (request.tid === Traders.FENCE) { @@ -125,7 +125,7 @@ export class InventoryHelper } else if (request.tid === "RandomLootContainer") { - itemLib.push({_id: requestItem.item_id, _tpl: requestItem.item_id}); + itemLib.push({ _id: requestItem.item_id, _tpl: requestItem.item_id }); } else { @@ -185,7 +185,7 @@ export class InventoryHelper { let idForItemToAdd = this.hashUtil.generate(); const toDo: string[][] = [[itemToAdd.itemRef._id, idForItemToAdd]]; // WHAT IS THIS?! - let upd: Upd = {StackObjectsCount: itemToAdd.count}; + let upd: Upd = { StackObjectsCount: itemToAdd.count }; // If item being added is preset, load preset's upd data too. if (itemToAdd.isPreset) @@ -213,7 +213,7 @@ export class InventoryHelper // add ragfair upd properties if (addUpd) { - upd = {...addUpd, ...upd}; + upd = { ...addUpd, ...upd }; } // Hideout items need to be marked as found in raid @@ -244,7 +244,7 @@ export class InventoryHelper _tpl: itemToAdd.itemRef._tpl, parentId: itemToAdd.containerId, slotId: "hideout", - location: {x: itemToAdd.location.x, y: itemToAdd.location.y, r: itemToAdd.location.rotation ? 1 : 0}, + location: { x: itemToAdd.location.x, y: itemToAdd.location.y, r: itemToAdd.location.rotation ? 1 : 0 }, upd: this.jsonUtil.clone(upd), }); @@ -253,7 +253,7 @@ export class InventoryHelper _tpl: itemToAdd.itemRef._tpl, parentId: itemToAdd.containerId, slotId: "hideout", - location: {x: itemToAdd.location.x, y: itemToAdd.location.y, r: itemToAdd.location.rotation ? 1 : 0}, + location: { x: itemToAdd.location.x, y: itemToAdd.location.y, r: itemToAdd.location.rotation ? 1 : 0 }, upd: this.jsonUtil.clone(upd), // Clone upd to prevent multi-purchases of same item referencing same upd object in memory }); @@ -277,7 +277,7 @@ export class InventoryHelper // If its from ItemPreset, load preset's upd data too. if (itemToAdd.isPreset) { - upd = {StackObjectsCount: itemToAdd.count}; + upd = { StackObjectsCount: itemToAdd.count }; for (const updID in itemLib[tmpKey].upd) { @@ -297,7 +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), }); @@ -306,7 +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), }); } @@ -506,7 +506,7 @@ export class InventoryHelper parentId: parentId, slotId: "cartridges", location: location, - upd: {StackObjectsCount: ammoStackSize}, + upd: { StackObjectsCount: ammoStackSize }, }; if (foundInRaid) @@ -622,7 +622,7 @@ export class InventoryHelper // We have output object, inform client of item deletion if (output) { - output.profileChanges[sessionID].items.del.push({_id: itemId}); + output.profileChanges[sessionID].items.del.push({ _id: itemId }); } for (const childId of itemToRemoveWithChildren) @@ -885,7 +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) { @@ -1144,7 +1144,7 @@ export class InventoryHelper pmcData: IPmcData, inventoryItems: Item[], moveRequest: IInventoryMoveRequestData, - ): {success: boolean; errorMessage?: string;} + ): { success: boolean; errorMessage?: string; } { this.handleCartridges(inventoryItems, moveRequest); @@ -1155,7 +1155,7 @@ export class InventoryHelper const errorMesage = `Unable to move item: ${moveRequest.item}, cannot find in inventory`; this.logger.error(errorMesage); - return {success: false, errorMessage: errorMesage}; + return { success: false, errorMessage: errorMesage }; } this.logger.debug( @@ -1172,7 +1172,7 @@ export class InventoryHelper }), ); - return {success: true}; + return { success: true }; } // Edit items details to match its new location @@ -1193,7 +1193,7 @@ export class InventoryHelper } } - return {success: true}; + return { success: true }; } /** diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index cc9731ca..fa076340 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -176,7 +176,7 @@ class ItemHelper { if (item.upd === undefined) { - item.upd = {StackObjectsCount: 1}; + item.upd = { StackObjectsCount: 1 }; } if (item.upd.StackObjectsCount === undefined) @@ -241,7 +241,7 @@ class ItemHelper parentId: parentId, slotId: slotId, location: 0, - upd: {StackObjectsCount: count}, + upd: { StackObjectsCount: count }, }; stackSlotItems.push(stackSlotItem); } @@ -1113,7 +1113,7 @@ class ItemHelper parentId: parentId, slotId: "cartridges", location: location, - upd: {StackObjectsCount: stackCount}, + upd: { StackObjectsCount: stackCount }, }; } diff --git a/project/src/helpers/NotifierHelper.ts b/project/src/helpers/NotifierHelper.ts index fb170a45..a32e24f8 100644 --- a/project/src/helpers/NotifierHelper.ts +++ b/project/src/helpers/NotifierHelper.ts @@ -10,7 +10,7 @@ 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) {} diff --git a/project/src/helpers/ProfileHelper.ts b/project/src/helpers/ProfileHelper.ts index 120b65d9..5afba25e 100644 --- a/project/src/helpers/ProfileHelper.ts +++ b/project/src/helpers/ProfileHelper.ts @@ -217,7 +217,7 @@ export class ProfileHelper public getDefaultAkiDataObject(): any { - return {version: this.getServerVersion()}; + return { version: this.getServerVersion() }; } public getFullProfile(sessionID: string): IAkiProfile @@ -255,14 +255,14 @@ export class ProfileHelper return { Eft: { CarriedQuestItems: [], - DamageHistory: {LethalDamagePart: "Head", LethalDamage: undefined, BodyParts: []}, + DamageHistory: { LethalDamagePart: "Head", LethalDamage: undefined, BodyParts: [] }, DroppedItems: [], ExperienceBonusMult: 0, FoundInRaidItems: [], LastPlayerState: undefined, LastSessionDate: 0, - OverallCounters: {Items: []}, - SessionCounters: {Items: []}, + OverallCounters: { Items: [] }, + SessionCounters: { Items: [] }, SessionExperienceMult: 0, SurvivorClass: "Unknown", TotalInGameTime: 0, @@ -321,7 +321,7 @@ export class ProfileHelper profileToUpdate.aki.receivedGifts = []; } - profileToUpdate.aki.receivedGifts.push({giftId: giftId, timestampAccepted: this.timeUtil.getTimestamp()}); + profileToUpdate.aki.receivedGifts.push({ giftId: giftId, timestampAccepted: this.timeUtil.getTimestamp() }); } /** diff --git a/project/src/helpers/QuestHelper.ts b/project/src/helpers/QuestHelper.ts index 30d9ebfa..506350b3 100644 --- a/project/src/helpers/QuestHelper.ts +++ b/project/src/helpers/QuestHelper.ts @@ -551,7 +551,7 @@ export class QuestHelper { // this case is probably dead Code right now, since the only calling function // checks explicitly for Value > 0. - output.profileChanges[sessionID].items.del.push({_id: itemId}); + output.profileChanges[sessionID].items.del.push({ _id: itemId }); pmcData.Inventory.items.splice(inventoryItemIndex, 1); } } @@ -574,7 +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/RagfairOfferHelper.ts b/project/src/helpers/RagfairOfferHelper.ts index 0a53a8bc..1c09f087 100644 --- a/project/src/helpers/RagfairOfferHelper.ts +++ b/project/src/helpers/RagfairOfferHelper.ts @@ -432,7 +432,7 @@ export class RagfairOfferHelper const requestedItem: Item = { _id: this.hashUtil.generate(), _tpl: requirement._tpl, - upd: {StackObjectsCount: requirement.count * boughtAmount}, + upd: { StackObjectsCount: requirement.count * boughtAmount }, }; const stacks = this.itemHelper.splitStack(requestedItem); diff --git a/project/src/helpers/RagfairSellHelper.ts b/project/src/helpers/RagfairSellHelper.ts index 5f5d174f..8cbf6545 100644 --- a/project/src/helpers/RagfairSellHelper.ts +++ b/project/src/helpers/RagfairSellHelper.ts @@ -112,7 +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/RepairHelper.ts b/project/src/helpers/RepairHelper.ts index 2b0e48f9..0e031ecd 100644 --- a/project/src/helpers/RepairHelper.ts +++ b/project/src/helpers/RepairHelper.ts @@ -68,7 +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 diff --git a/project/src/helpers/TraderAssortHelper.ts b/project/src/helpers/TraderAssortHelper.ts index 3ee329fc..fb6a4431 100644 --- a/project/src/helpers/TraderAssortHelper.ts +++ b/project/src/helpers/TraderAssortHelper.ts @@ -26,7 +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 aaae8ecd..7730ff34 100644 --- a/project/src/helpers/TraderHelper.ts +++ b/project/src/helpers/TraderHelper.ts @@ -268,7 +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 @@ -303,7 +303,7 @@ export class TraderHelper // eslint-disable-next-line @typescript-eslint/naming-convention public addTraderPurchasesToPlayerProfile( sessionID: string, - newPurchaseDetails: {items: {item_id: string; count: number;}[]; tid: string;}, + newPurchaseDetails: { items: { item_id: string; count: number; }[]; tid: string; }, ): void { const profile = this.profileHelper.getFullProfile(sessionID); diff --git a/project/src/helpers/WeightedRandomHelper.ts b/project/src/helpers/WeightedRandomHelper.ts index 7e66a3e0..7b5f8169 100644 --- a/project/src/helpers/WeightedRandomHelper.ts +++ b/project/src/helpers/WeightedRandomHelper.ts @@ -9,7 +9,7 @@ export class WeightedRandomHelper * @param {tplId: weighting[]} itemArray * @returns tplId */ - public getWeightedInventoryItem(itemArray: {[tplId: string]: unknown;} | ArrayLike): string + public getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string { const itemKeys = Object.keys(itemArray); const weights = Object.values(itemArray); @@ -18,7 +18,7 @@ export class WeightedRandomHelper return chosenItem.item; } - public getWeightedValue(itemArray: {[key: string]: unknown;} | ArrayLike): T + public getWeightedValue(itemArray: { [key: string]: unknown; } | ArrayLike): T { const itemKeys = Object.keys(itemArray); const weights = Object.values(itemArray); @@ -41,7 +41,7 @@ export class WeightedRandomHelper * @param {number[]} weights * @returns {{item: any, index: number}} */ - public weightedRandom(items: string | any[], weights: string | any[]): {item: any; index: number;} + public weightedRandom(items: string | any[], weights: string | any[]): { item: any; index: number; } { if (items.length !== weights.length) { @@ -77,7 +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/loaders/PreAkiModLoader.ts b/project/src/loaders/PreAkiModLoader.ts index 17f98067..297eca6b 100644 --- a/project/src/loaders/PreAkiModLoader.ts +++ b/project/src/loaders/PreAkiModLoader.ts @@ -139,11 +139,11 @@ export class PreAkiModLoader implements IModLoader this.logger.info(this.localisationService.getText("modloader-mod_order_missing")); // Write file with empty order array to disk - this.vfs.writeFile(this.modOrderPath, this.jsonUtil.serializeAdvanced({order: []}, null, 4)); + this.vfs.writeFile(this.modOrderPath, this.jsonUtil.serializeAdvanced({ order: [] }, null, 4)); } else { - const modOrder = this.vfs.readFile(this.modOrderPath, {encoding: "utf8"}); + const modOrder = this.vfs.readFile(this.modOrderPath, { encoding: "utf8" }); try { for (const [index, mod] of (this.jsonUtil.deserialize(modOrder).order as string[]).entries()) @@ -225,7 +225,7 @@ export class PreAkiModLoader implements IModLoader if (this.shouldSkipMod(pkg)) { - this.logger.warning(this.localisationService.getText("modloader-skipped_mod", {mod: mod})); + this.logger.warning(this.localisationService.getText("modloader-skipped_mod", { mod: mod })); continue; } @@ -473,7 +473,7 @@ export class PreAkiModLoader implements IModLoader pkg.scripts = {}; // Add mod to imported list - this.imported[mod] = {...pkg, dependencies: pkg.modDependencies}; + this.imported[mod] = { ...pkg, dependencies: pkg.modDependencies }; this.logger.info( this.localisationService.getText("modloader-loaded_mod", { name: pkg.name, @@ -557,7 +557,7 @@ export class PreAkiModLoader implements IModLoader ); let command = `${pnpmPath} install `; command += dependenciesToInstall.map(([depName, depVersion]) => `${depName}@${depVersion}`).join(" "); - execSync(command, {cwd: modPath}); + execSync(command, { cwd: modPath }); // Delete the new blank package.json then rename the backup back to the original name this.vfs.removeFile(`${modPath}/package.json`); diff --git a/project/src/models/external/HttpFramework.ts b/project/src/models/external/HttpFramework.ts index ffc28468..9ac9db8b 100644 --- a/project/src/models/external/HttpFramework.ts +++ b/project/src/models/external/HttpFramework.ts @@ -13,7 +13,7 @@ export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) = */ export const Listen = (basePath: string) => { - return (Base: T): T => + return (Base: T): T => { // Used for the base class to be able to use DI injectable()(Base); @@ -35,7 +35,7 @@ export const Listen = (basePath: string) => } // Add each flagged handler to the Record - for (const {handlerName, path, httpMethod} of handlersArray) + for (const { handlerName, path, httpMethod } of handlersArray) { if (!this.handlers[httpMethod]) { @@ -111,7 +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 73ce43ed..acd72d6e 100644 --- a/project/src/models/spt/server/IDatabaseTables.ts +++ b/project/src/models/spt/server/IDatabaseTables.ts @@ -24,7 +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 dca76e78..abbc9da2 100644 --- a/project/src/routers/EventOutputHolder.ts +++ b/project/src/routers/EventOutputHolder.ts @@ -12,7 +12,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil"; export class EventOutputHolder { /** What has client been informed of this game session */ - protected clientActiveSessionStorage: Record = {}; + protected clientActiveSessionStorage: Record = {}; constructor( @inject("JsonUtil") protected jsonUtil: JsonUtil, @@ -22,7 +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 { @@ -51,10 +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: {}, @@ -170,7 +170,7 @@ export class EventOutputHolder // Flag started craft as having been seen by client if (production.Progress > 0 && !this.clientActiveSessionStorage[productionKey]?.clientInformed) { - this.clientActiveSessionStorage[productionKey] = {clientInformed: true}; + this.clientActiveSessionStorage[productionKey] = { clientInformed: true }; } } diff --git a/project/src/routers/save_load/HealthSaveLoadRouter.ts b/project/src/routers/save_load/HealthSaveLoadRouter.ts index 343490d2..b32f49ce 100644 --- a/project/src/routers/save_load/HealthSaveLoadRouter.ts +++ b/project/src/routers/save_load/HealthSaveLoadRouter.ts @@ -15,7 +15,7 @@ export class HealthSaveLoadRouter extends SaveLoadRouter { 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 bea4532f..241300dd 100644 --- a/project/src/routers/save_load/InraidSaveLoadRouter.ts +++ b/project/src/routers/save_load/InraidSaveLoadRouter.ts @@ -15,7 +15,7 @@ export class InraidSaveLoadRouter extends SaveLoadRouter { 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/ProfileSaveLoadRouter.ts b/project/src/routers/save_load/ProfileSaveLoadRouter.ts index bab47117..97d1309f 100644 --- a/project/src/routers/save_load/ProfileSaveLoadRouter.ts +++ b/project/src/routers/save_load/ProfileSaveLoadRouter.ts @@ -16,7 +16,7 @@ export class ProfileSaveLoadRouter extends SaveLoadRouter { 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/servers/SaveServer.ts b/project/src/servers/SaveServer.ts index 5599b361..95152dee 100644 --- a/project/src/servers/SaveServer.ts +++ b/project/src/servers/SaveServer.ts @@ -142,7 +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: {} } }; } /** @@ -195,7 +195,7 @@ export class SaveServer } catch (error) { - this.logger.error(this.localisationService.getText("profile_save_callback_error", {callback, error})); + this.logger.error(this.localisationService.getText("profile_save_callback_error", { callback, error })); this.profiles[sessionID] = previous; } } diff --git a/project/src/servers/WebSocketServer.ts b/project/src/servers/WebSocketServer.ts index fcf3ea16..19fa82eb 100644 --- a/project/src/servers/WebSocketServer.ts +++ b/project/src/servers/WebSocketServer.ts @@ -28,14 +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 bc74db94..cc48eb62 100644 --- a/project/src/servers/http/AkiHttpListener.ts +++ b/project/src/servers/http/AkiHttpListener.ts @@ -168,14 +168,14 @@ export class AkiHttpListener implements IHttpListener public sendJson(resp: ServerResponse, output: string, sessionID: string): void { // eslint-disable-next-line @typescript-eslint/naming-convention - resp.writeHead(200, "OK", {"Content-Type": "application/json", "Set-Cookie": `PHPSESSID=${sessionID}`}); + resp.writeHead(200, "OK", { "Content-Type": "application/json", "Set-Cookie": `PHPSESSID=${sessionID}` }); resp.end(output); } public sendZlibJson(resp: ServerResponse, output: string, sessionID: string): void { // eslint-disable-next-line @typescript-eslint/naming-convention - resp.writeHead(200, "OK", {"Content-Type": "application/json", "Set-Cookie": `PHPSESSID=${sessionID}`}); + resp.writeHead(200, "OK", { "Content-Type": "application/json", "Set-Cookie": `PHPSESSID=${sessionID}` }); zlib.deflate(output, (_, buf) => resp.end(buf)); } } diff --git a/project/src/services/BotWeaponModLimitService.ts b/project/src/services/BotWeaponModLimitService.ts index 99020cd8..6fbf9f35 100644 --- a/project/src/services/BotWeaponModLimitService.ts +++ b/project/src/services/BotWeaponModLimitService.ts @@ -46,7 +46,7 @@ export class BotWeaponModLimitService public getWeaponModLimits(botRole: string): BotModLimits { return { - scope: {count: 0}, + scope: { count: 0 }, scopeMax: this.botConfig.equipment[botRole]?.weaponModLimits?.scopeLimit, scopeBaseTypes: [ BaseClasses.OPTIC_SCOPE, @@ -55,7 +55,7 @@ export class BotWeaponModLimitService BaseClasses.COMPACT_COLLIMATOR, BaseClasses.SPECIAL_SCOPE, ], - flashlightLaser: {count: 0}, + flashlightLaser: { count: 0 }, flashlightLaserMax: this.botConfig.equipment[botRole]?.weaponModLimits?.lightLaserLimit, flashlgihtLaserBaseTypes: [ BaseClasses.TACTICAL_COMBO, @@ -166,7 +166,7 @@ export class BotWeaponModLimitService */ protected weaponModLimitReached( modTpl: string, - currentCount: {count: number;}, + currentCount: { count: number; }, maxLimit: number, botRole: string, ): boolean diff --git a/project/src/services/FenceService.ts b/project/src/services/FenceService.ts index 9eb4afed..eacc3908 100644 --- a/project/src/services/FenceService.ts +++ b/project/src/services/FenceService.ts @@ -421,7 +421,7 @@ export class FenceService fenceAssortIds: string[], assorts: ITraderAssort, fenceAssort: ITraderAssort, - itemTypeCounts: Record, + itemTypeCounts: Record, loyaltyLevel: number, ): void { @@ -585,7 +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; @@ -675,7 +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 @@ -694,7 +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; } @@ -709,14 +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; } @@ -740,7 +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 }; } } @@ -749,13 +749,13 @@ export class FenceService * @param limits limits as defined in config * @returns record, key: item tplId, value: current/max item count allowed */ - protected initItemLimitCounter(limits: Record): Record + protected initItemLimitCounter(limits: Record): Record { - const itemTypeCounts: Record = {}; + const itemTypeCounts: Record = {}; 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/GiftService.ts b/project/src/services/GiftService.ts index 1a82e920..4193f2a5 100644 --- a/project/src/services/GiftService.ts +++ b/project/src/services/GiftService.ts @@ -133,7 +133,7 @@ export class GiftService const details: ISendMessageDetails = { recipientId: playerId, sender: this.getMessageType(giftData), - senderDetails: {_id: this.getSenderId(giftData), info: null}, + senderDetails: { _id: this.getSenderId(giftData), info: null }, messageText: giftData.messageText, items: giftData.items, itemsMaxStorageLifetimeSeconds: this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours), diff --git a/project/src/services/InsuranceService.ts b/project/src/services/InsuranceService.ts index b32d9bbd..c7ac6a21 100644 --- a/project/src/services/InsuranceService.ts +++ b/project/src/services/InsuranceService.ts @@ -158,7 +158,7 @@ export class InsuranceService randomResponseId, [], null, - {location: locationName}, + { location: locationName }, ); } @@ -334,7 +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 { @@ -391,7 +391,7 @@ export class InsuranceService * @param traderId Id of trader item was insured with */ protected addGearToSend( - gear: {sessionID: string; pmcData: IPmcData; itemToReturnToPlayer: Item; traderId: string;}, + gear: { sessionID: string; pmcData: IPmcData; itemToReturnToPlayer: Item; traderId: string; }, ): void { const sessionId = gear.sessionID; diff --git a/project/src/services/MailSendService.ts b/project/src/services/MailSendService.ts index d5accb8a..242dd658 100644 --- a/project/src/services/MailSendService.ts +++ b/project/src/services/MailSendService.ts @@ -420,7 +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/ModCompilerService.ts b/project/src/services/ModCompilerService.ts index d02e72fb..833c22d7 100644 --- a/project/src/services/ModCompilerService.ts +++ b/project/src/services/ModCompilerService.ts @@ -109,7 +109,7 @@ export class ModCompilerService replacedText = text.replace(/(@spt-aki)/g, path.join(__dirname, "..").replace(/\\/g, "/")); } - const output = ts.transpileModule(replacedText, {compilerOptions: options}); + const output = ts.transpileModule(replacedText, { compilerOptions: options }); if (output.sourceMapText) { diff --git a/project/src/services/PaymentService.ts b/project/src/services/PaymentService.ts index ed6334c2..0b5c5ebd 100644 --- a/project/src/services/PaymentService.ts +++ b/project/src/services/PaymentService.ts @@ -49,7 +49,7 @@ export class PaymentService const trader = this.traderHelper.getTrader(request.tid, sessionID); // Track the amounts of each type of currency involved in the trade. - const currencyAmounts: {[key: string]: number;} = {}; + const currencyAmounts: { [key: string]: number; } = {}; // Delete barter items and track currencies if the action is "TradingConfirm". if (request.Action === "TradingConfirm") diff --git a/project/src/services/PlayerService.ts b/project/src/services/PlayerService.ts index ee66ee84..c416f7a8 100644 --- a/project/src/services/PlayerService.ts +++ b/project/src/services/PlayerService.ts @@ -26,7 +26,7 @@ export class PlayerService { let accExp = 0; - for (const [level, {exp}] of this.databaseServer.getTables().globals.config.exp.level.exp_table.entries()) + for (const [level, { exp }] of this.databaseServer.getTables().globals.config.exp.level.exp_table.entries()) { accExp += exp; diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 2dcb1547..59731787 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -196,7 +196,7 @@ export class ProfileFixerService } else { - pmcProfile.Inventory.items.push({_id: hideoutStandAreaDb._id, _tpl: stageCurrentAt.container}); + pmcProfile.Inventory.items.push({ _id: hideoutStandAreaDb._id, _tpl: stageCurrentAt.container }); this.logger.debug( `Added missing gun stand inventory stash: ${hideoutStandAreaDb._id} tpl to ${stageCurrentAt.container}`, ); @@ -215,7 +215,10 @@ export class ProfileFixerService } else { - pmcProfile.Inventory.items.push({_id: hideoutStandSecondaryAreaDb._id, _tpl: stageCurrentAt.container}); + pmcProfile.Inventory.items.push({ + _id: hideoutStandSecondaryAreaDb._id, + _tpl: stageCurrentAt.container, + }); this.logger.debug( `Added missing gun stand inventory secondary stash: ${hideoutStandSecondaryAreaDb._id} tpl to ${stageCurrentAt.container}`, ); @@ -352,7 +355,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: [] }; } } @@ -396,7 +399,7 @@ export class ProfileFixerService if (!pmcProfile.UnlockedInfo) { this.logger.debug("Adding UnlockedInfo object to profile"); - pmcProfile.UnlockedInfo = {unlockedProductionRecipe: []}; + pmcProfile.UnlockedInfo = { unlockedProductionRecipe: [] }; } } @@ -685,7 +688,7 @@ export class ProfileFixerService { if (!slots.find((x) => x.locationIndex === i)) { - slots.push({locationIndex: i}); + slots.push({ locationIndex: i }); } } @@ -1085,7 +1088,7 @@ export class ProfileFixerService const statsCopy = this.jsonUtil.clone(fullProfile.characters.pmc.Stats); // Clear stats object - fullProfile.characters.pmc.Stats = {Eft: null}; + fullProfile.characters.pmc.Stats = { Eft: null }; fullProfile.characters.pmc.Stats.Eft = statsCopy; } diff --git a/project/src/services/RagfairPriceService.ts b/project/src/services/RagfairPriceService.ts index 22b57672..1bc169e5 100644 --- a/project/src/services/RagfairPriceService.ts +++ b/project/src/services/RagfairPriceService.ts @@ -29,7 +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, @@ -153,12 +153,12 @@ export class RagfairPriceService implements OnLoad public getAllFleaPrices(): Record { // assign static values first, then overwrite them with dynamic, any values not stored in dynamic data will be covered by static data - return {...this.prices.static, ...this.prices.dynamic}; + return { ...this.prices.static, ...this.prices.dynamic }; } public getAllStaticPrices(): Record { - return {...this.prices.static}; + return { ...this.prices.static }; } /** @@ -409,12 +409,12 @@ export class RagfairPriceService implements OnLoad * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: IPreset[], weapon: Item): {isDefault: boolean; preset: IPreset;} + protected getWeaponPreset(presets: IPreset[], weapon: Item): { isDefault: boolean; preset: IPreset; } { const defaultPreset = presets.find((x) => x._encyclopedia); if (defaultPreset) { - return {isDefault: true, preset: defaultPreset}; + return { isDefault: true, preset: defaultPreset }; } if (presets.length === 1) @@ -434,6 +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 4064fd87..de1f86f6 100644 --- a/project/src/services/RepairService.ts +++ b/project/src/services/RepairService.ts @@ -122,7 +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: "", @@ -262,7 +262,7 @@ export class RepairService ): RepairDetails { // Find item to repair in inventory - const itemToRepair = pmcData.Inventory.items.find((x: {_id: string;}) => x._id === itemToRepairId); + const itemToRepair = pmcData.Inventory.items.find((x: { _id: string; }) => x._id === itemToRepairId); if (itemToRepair === undefined) { throw new Error(`Item ${itemToRepairId} not found, unable to repair`); @@ -405,11 +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/mod/CustomItemService.ts b/project/src/services/mod/CustomItemService.ts index 45835d5a..507fb962 100644 --- a/project/src/services/mod/CustomItemService.ts +++ b/project/src/services/mod/CustomItemService.ts @@ -155,7 +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/DynamicRouterModService.ts b/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts index a980bc5b..58675ee4 100644 --- a/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts +++ b/project/src/services/mod/dynamicRouter/DynamicRouterModService.ts @@ -10,7 +10,7 @@ export class DynamicRouterModService {} public registerDynamicRouter(name: string, routes: RouteAction[], topLevelRoute: string): void { - this.container.register(name, {useValue: new DynamicRouterMod(routes, topLevelRoute)}); + this.container.register(name, { useValue: new DynamicRouterMod(routes, topLevelRoute) }); this.container.registerType("DynamicRoutes", name); } } diff --git a/project/src/services/mod/onLoad/OnLoadModService.ts b/project/src/services/mod/onLoad/OnLoadModService.ts index 8145d480..f86887db 100644 --- a/project/src/services/mod/onLoad/OnLoadModService.ts +++ b/project/src/services/mod/onLoad/OnLoadModService.ts @@ -10,7 +10,7 @@ export class OnLoadModService public registerOnLoad(name: string, onLoad: () => void, getRoute: () => string): void { - this.container.register(name, {useValue: new OnLoadMod(onLoad, getRoute)}); + 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 5c55e677..fdb384c5 100644 --- a/project/src/services/mod/onUpdate/OnUpdateModService.ts +++ b/project/src/services/mod/onUpdate/OnUpdateModService.ts @@ -10,7 +10,7 @@ export class OnUpdateModService public registerOnUpdate(name: string, onUpdate: (timeSinceLastRun: number) => boolean, getRoute: () => string): void { - this.container.register(name, {useValue: new OnUpdateMod(onUpdate, getRoute)}); + this.container.register(name, { useValue: new OnUpdateMod(onUpdate, getRoute) }); this.container.registerType("OnUpdate", name); } } diff --git a/project/src/services/mod/staticRouter/StaticRouterModService.ts b/project/src/services/mod/staticRouter/StaticRouterModService.ts index 14047c09..7b3d1e65 100644 --- a/project/src/services/mod/staticRouter/StaticRouterModService.ts +++ b/project/src/services/mod/staticRouter/StaticRouterModService.ts @@ -10,7 +10,7 @@ export class StaticRouterModService {} public registerStaticRouter(name: string, routes: RouteAction[], topLevelRoute: string): void { - this.container.register(name, {useValue: new StaticRouterMod(routes, topLevelRoute)}); + this.container.register(name, { useValue: new StaticRouterMod(routes, topLevelRoute) }); this.container.registerType("StaticRoutes", name); } } diff --git a/project/src/utils/HttpResponseUtil.ts b/project/src/utils/HttpResponseUtil.ts index 5549dfa0..c2ed1011 100644 --- a/project/src/utils/HttpResponseUtil.ts +++ b/project/src/utils/HttpResponseUtil.ts @@ -41,7 +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 @@ -65,7 +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/JsonUtil.ts b/project/src/utils/JsonUtil.ts index a4cbe075..534ac2bf 100644 --- a/project/src/utils/JsonUtil.ts +++ b/project/src/utils/JsonUtil.ts @@ -181,7 +181,7 @@ export class JsonUtil { try { - const {data, changed} = fixJson(jsonString); + const { data, changed } = fixJson(jsonString); if (changed) { // data invalid, return it this.logger.error(`${filePath} - Detected faulty json, please fix your json file using VSCodium`); diff --git a/project/src/utils/RandomUtil.ts b/project/src/utils/RandomUtil.ts index 5b45bf82..8323fa53 100644 --- a/project/src/utils/RandomUtil.ts +++ b/project/src/utils/RandomUtil.ts @@ -136,12 +136,12 @@ export class ProbabilityObjectArray extends Array = []): K[] { - const {probArray, keyArray} = this.reduce((acc, x) => + const { probArray, keyArray } = this.reduce((acc, x) => { acc.probArray.push(x.relativeProbability); acc.keyArray.push(x.key); return acc; - }, {probArray: [], keyArray: []}); + }, { probArray: [], keyArray: [] }); let probCumsum = this.cumulativeProbability(probArray); const drawnKeys = []; @@ -257,7 +257,7 @@ export class RandomUtil return this.getArrayValue(Object.keys(node)); } - public getKeyValue(node: {[x: string]: any;}): any + public getKeyValue(node: { [x: string]: any; }): any { return node[this.getKey(node)]; } @@ -374,7 +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) diff --git a/project/src/utils/VFS.ts b/project/src/utils/VFS.ts index fd835750..fa24c8ce 100644 --- a/project/src/utils/VFS.ts +++ b/project/src/utils/VFS.ts @@ -14,14 +14,14 @@ export class VFS { accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise; - mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & {recursive: true;}) => Promise; + mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { recursive: true; }) => Promise; readFilePromisify: (path: fs.PathLike) => Promise; writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; readdirPromisify: ( path: fs.PathLike, - options?: BufferEncoding | {encoding: BufferEncoding; withFileTypes?: false;}, + options?: BufferEncoding | { encoding: BufferEncoding; withFileTypes?: false; }, ) => Promise; - statPromisify: (path: fs.PathLike, options?: fs.StatOptions & {bigint?: false;}) => Promise; + statPromisify: (path: fs.PathLike, options?: fs.StatOptions & { bigint?: false; }) => Promise; unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; @@ -50,7 +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); @@ -71,13 +71,13 @@ 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); } public createDir(filepath: string): void { - fs.mkdirSync(filepath.substr(0, filepath.lastIndexOf("/")), {recursive: true}); + fs.mkdirSync(filepath.substr(0, filepath.lastIndexOf("/")), { recursive: true }); } public async createDirAsync(filepath: string): Promise @@ -85,7 +85,7 @@ export class VFS const command = { uuid: crypto.randomUUID(), cmd: async () => - await this.mkdirPromisify(filepath.substr(0, filepath.lastIndexOf("/")), {recursive: true}), + await this.mkdirPromisify(filepath.substr(0, filepath.lastIndexOf("/")), { recursive: true }), }; await this.asyncQueue.waitFor(command); } @@ -167,7 +167,7 @@ export class VFS public writeFile(filepath: any, data = "", append = false, atomic = true): void { - const options = append ? {flag: "a"} : {flag: "w"}; + const options = append ? { flag: "a" } : { flag: "w" }; if (!this.exists(filepath)) { @@ -194,7 +194,7 @@ export class VFS public async writeFileAsync(filepath: any, data = "", append = false, atomic = true): Promise { - const options = append ? {flag: "a"} : {flag: "w"}; + const options = append ? { flag: "a" } : { flag: "w" }; if (!await this.exists(filepath)) { @@ -376,7 +376,7 @@ export class VFS return files; } - const dirents = fs.readdirSync(directory, {encoding: "utf-8", withFileTypes: true}); + const dirents = fs.readdirSync(directory, { encoding: "utf-8", withFileTypes: true }); for (const dirent of dirents) { const res = resolve(directory, dirent.name); diff --git a/project/src/utils/logging/AbstractWinstonLogger.ts b/project/src/utils/logging/AbstractWinstonLogger.ts index 1facf66a..51a744ef 100644 --- a/project/src/utils/logging/AbstractWinstonLogger.ts +++ b/project/src/utils/logging/AbstractWinstonLogger.ts @@ -17,8 +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", @@ -41,7 +41,7 @@ export abstract class AbstractWinstonLogger implements ILogger this.showDebugInConsole = globalThis.G_DEBUG_CONFIGURATION; if (!fs.existsSync(this.getFilePath())) { - fs.mkdirSync(this.getFilePath(), {recursive: true}); + fs.mkdirSync(this.getFilePath(), { recursive: true }); } const transportsList: winston.transport[] = []; @@ -52,8 +52,8 @@ export abstract class AbstractWinstonLogger implements ILogger new transports.Console({ level: this.showDebugInConsole ? "debug" : "custom", format: format.combine( - format.colorize({all: true, colors: this.logLevels.colors}), - format.printf(({message}) => + format.colorize({ all: true, colors: this.logLevels.colors }), + format.printf(({ message }) => { return `${message}`; }), @@ -75,7 +75,7 @@ export abstract class AbstractWinstonLogger implements ILogger format.timestamp(), format.align(), format.json(), - format.printf(({timestamp, level, message}) => + format.printf(({ timestamp, level, message }) => { return `[${timestamp}] ${level}: ${message}`; }), @@ -85,7 +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()) { @@ -130,13 +130,13 @@ export abstract class AbstractWinstonLogger implements ILogger { const textColor = `${color} ${backgroundColor}`.trimEnd(); const tmpLogger = createLogger({ - levels: {custom: 0}, + levels: { custom: 0 }, level: "custom", transports: [ new transports.Console({ format: format.combine( - format.colorize({all: true, colors: {custom: textColor}}), - format.printf(({message}) => message), + format.colorize({ all: true, colors: { custom: textColor } }), + format.printf(({ message }) => message), ), }), ], @@ -146,7 +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 { @@ -161,25 +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); } @@ -209,11 +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/tests/CustomEnvironment.ts b/project/tests/CustomEnvironment.ts index 4dd917dd..e295b1aa 100644 --- a/project/tests/CustomEnvironment.ts +++ b/project/tests/CustomEnvironment.ts @@ -21,7 +21,7 @@ export default { Container.registerListTypes(container); // Override registration to the container. - container.register("WinstonLogger", WinstonLogger, {lifecycle: Lifecycle.Singleton}); + container.register("WinstonLogger", WinstonLogger, { lifecycle: Lifecycle.Singleton }); // Import the database. await importDatabase(container); diff --git a/project/tests/__factories__/ProfileInsurance.factory.ts b/project/tests/__factories__/ProfileInsurance.factory.ts index 88e8d501..83ea5629 100644 --- a/project/tests/__factories__/ProfileInsurance.factory.ts +++ b/project/tests/__factories__/ProfileInsurance.factory.ts @@ -6,7 +6,7 @@ import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; import { profileInsuranceFixture } from "@tests/__fixture__/profileInsurance.fixture"; import { format } from "date-fns"; -type DateInput = number | number[] | {[index: number]: number;}; +type DateInput = number | number[] | { [index: number]: number; }; export class ProfileInsuranceFactory { diff --git a/project/tests/__fixture__/profileInsurance.fixture.ts b/project/tests/__fixture__/profileInsurance.fixture.ts index 1e9008d2..dd26a560 100644 --- a/project/tests/__fixture__/profileInsurance.fixture.ts +++ b/project/tests/__fixture__/profileInsurance.fixture.ts @@ -9,387 +9,387 @@ export const profileInsuranceFixture: Insurance[] = [{ maxStorageTime: 345600, text: "", profileChangeEvents: [], - systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}, + 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}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 97.7862549, MaxDurability: 100 } }, }, { _id: "695b13896108f765e8985698", _tpl: "5648a69d4bdc2ded0b8b457b", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "bb49d6ceb3e87d8563a06455", _tpl: "5df8a4d786f77412672a1e3b", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "631f8492de748dec852f7ddf", _tpl: "64abd93857958b4249003418", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1, Repairable: {Durability: 49.2865, MaxDurability: 60}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 49.2865, MaxDurability: 60 } }, }, { _id: "a2b0c716162c5e31ec28c55a", _tpl: "5a16b8a9fcdbcb00165aa6ca", parentId: "3679078e05f5b14466d6a730", slotId: "mod_nvg", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "dc565f750342cb2d19eeda06", _tpl: "5d6d3be5a4b9361bc73bc763", parentId: "3679078e05f5b14466d6a730", slotId: "mod_equipment_001", - upd: {StackObjectsCount: 1, Repairable: {Durability: 29.33, MaxDurability: 29.33}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 29.33, MaxDurability: 29.33 } }, }, { _id: "e9ff62601669d9e2ea9c2fbb", _tpl: "5d6d3943a4b9360dbc46d0cc", parentId: "3679078e05f5b14466d6a730", slotId: "mod_equipment_002", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "ac134d7cf6c9d8e25edd0015", _tpl: "5c11046cd174af02a012e42b", parentId: "a2b0c716162c5e31ec28c55a", slotId: "mod_nvg", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "22274b895ecc80d51c3cba1c", _tpl: "5c110624d174af029e69734c", parentId: "ac134d7cf6c9d8e25edd0015", slotId: "mod_nvg", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}, Togglable: {On: true}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 }, Togglable: { On: true } }, }, { _id: "c9278dd8251e99578bf7a274", _tpl: "59c6633186f7740cf0493bb9", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_gas_block", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "677c209ebb45445ebb42c405", _tpl: "5649ab884bdc2ded0b8b457f", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_muzzle", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "8ada5c9cc26585281577c6eb", _tpl: "5649ae4a4bdc2d1b2b8b4588", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_pistol_grip", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "4bd10f89836fd9f86aedcac1", _tpl: "5649af094bdc2df8348b4586", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_reciever", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "8b1327270791b142ac341b03", _tpl: "5649d9a14bdc2d79388b4580", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_sight_rear", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "566335b3df586f34b47f5e35", _tpl: "5649b2314bdc2d79388b4576", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_stock", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "da8cde1b3024c336f6e06152", _tpl: "55d482194bdc2d1d4e8b456b", parentId: "911a0f04d5d9c7e239807ae0", slotId: "mod_magazine", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "1e0b177df108c0c117028812", _tpl: "57cffddc24597763133760c6", parentId: "c9278dd8251e99578bf7a274", slotId: "mod_handguard", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "bc041c0011d76f714b898400", _tpl: "57cffcd624597763133760c5", parentId: "1e0b177df108c0c117028812", slotId: "mod_mount_003", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "9f8d7880a6e0a47a211ec5d3", _tpl: "58491f3324597764bc48fa02", parentId: "8b1327270791b142ac341b03", slotId: "mod_scope", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "402b4086535a50ef7d9cef88", _tpl: "5649be884bdc2d79388b4577", parentId: "566335b3df586f34b47f5e35", slotId: "mod_stock", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "db2ef9442178910eba985b51", _tpl: "58d2946386f774496974c37e", parentId: "402b4086535a50ef7d9cef88", slotId: "mod_stock_000", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "3c32b7d47ad80e83749fa906", _tpl: "58d2912286f7744e27117493", parentId: "db2ef9442178910eba985b51", slotId: "mod_stock", - upd: {StackObjectsCount: 1}, + 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}}, + 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}}, + 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}}, + 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}}, + 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}, + 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}, + 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}}, + 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}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "757211a0b648fe27b0475ded", _tpl: "59f8a37386f7747af3328f06", parentId: "b16c2a938954cd69c687c51a", slotId: "mod_foregrip", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "870a887c63ca30fb15736b3d", _tpl: "62a1b7fbc30cfa1d366af586", parentId: "bb49d6ceb3e87d8563a06455", slotId: "main", - upd: {StackObjectsCount: 1}, - location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, + 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}}, + 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}}, + 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}, + location: { x: 0, y: 3, r: "Horizontal", isSearched: true }, + upd: { StackObjectsCount: 1 }, }, { _id: "d0cf00aff56ea520cdd94330", _tpl: "57c44dd02459772d2e0ae249", parentId: "351180f3248d45c71cb2ebdc", slotId: "mod_muzzle", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "5119653b2c66d57ee219e26f", _tpl: "57c44f4f2459772d2c627113", parentId: "351180f3248d45c71cb2ebdc", slotId: "mod_reciever", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "ed1ac0183a8af587110aa74e", _tpl: "5a9e81fba2750c00164f6b11", parentId: "351180f3248d45c71cb2ebdc", slotId: "mod_magazine", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "310a7d1bb07ae0e522f3f8e3", _tpl: "5a69a2ed8dc32e000d46d1f1", parentId: "351180f3248d45c71cb2ebdc", slotId: "mod_pistol_grip", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "e818616e11ae07aa05388759", _tpl: "5dff8db859400025ea5150d4", parentId: "351180f3248d45c71cb2ebdc", slotId: "mod_mount_000", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "768812984debf2756bece089", _tpl: "57c44e7b2459772d28133248", parentId: "d0cf00aff56ea520cdd94330", slotId: "mod_sight_rear", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "67c610585ed668baf4604931", _tpl: "59eb7ebe86f7740b373438ce", parentId: "d0cf00aff56ea520cdd94330", slotId: "mod_mount_000", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "80e9dffa49bfe263ab0128c7", _tpl: "6267c6396b642f77f56f5c1c", parentId: "67c610585ed668baf4604931", slotId: "mod_tactical_000", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "dee323443ce23ba8c54b9f1c", _tpl: "5cc9c20cd7f00c001336c65d", parentId: "67c610585ed668baf4604931", slotId: "mod_tactical_001", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "3008088022dd55f1c99e5a32", _tpl: "5c1cd46f2e22164bef5cfedb", parentId: "67c610585ed668baf4604931", slotId: "mod_foregrip", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "71e9f8d005c72940d857fe64", _tpl: "59d790f486f77403cb06aec6", parentId: "80e9dffa49bfe263ab0128c7", slotId: "mod_flashlight", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "8c610c6cc67115a5fc1662ff", _tpl: "56eabf3bd2720b75698b4569", parentId: "310a7d1bb07ae0e522f3f8e3", slotId: "mod_stock_000", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "7dd43ffa6e03c2da6cddc56e", _tpl: "6171407e50224f204c1da3c5", parentId: "e818616e11ae07aa05388759", slotId: "mod_scope", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "fa9da4ccf3630cb173c293f9", _tpl: "5b3b99475acfc432ff4dcbee", parentId: "7dd43ffa6e03c2da6cddc56e", slotId: "mod_scope_000", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "2c868d4676adc934f897e9a7", _tpl: "61605d88ffa6e502ac5e7eeb", parentId: "7dd43ffa6e03c2da6cddc56e", slotId: "mod_scope_002", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "1b159fdc14c350f8a4a7e19e", _tpl: "58d39b0386f77443380bf13c", parentId: "6e2727806fb12e12123e9a57", slotId: "mod_scope", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + 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}}, + 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}, + 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}}, + 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}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }], }, { scheduledTime: 1698945140, @@ -400,272 +400,272 @@ export const profileInsuranceFixture: Insurance[] = [{ maxStorageTime: 518400, text: "", profileChangeEvents: [], - systemData: {date: "01.11.2023", time: "11:18", location: "factory4_day"}, + 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}, + upd: { StackObjectsCount: 1 }, }, { _id: "30f4bcb87bcc4604e27c02c1", _tpl: "5cc70146e4a949000d73bf6b", parentId: "ad018df9da0cbf2726394ef1", slotId: "mod_mount_001", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "ad018df9da0cbf2726394ef1", _tpl: "5cc70102e4a949035e43ba74", parentId: "3bc4ff5bd99f165dc75cbd25", slotId: "main", - upd: {StackObjectsCount: 1}, - location: {x: 3, y: 0, r: "Horizontal", isSearched: true}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 99.93771, MaxDurability: 100 } }, }, { _id: "760652d86ee78eed513e0ad7", _tpl: "5ab8f39486f7745cd93a1cca", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "61ab4afefac354dfc64c7874", _tpl: "5b432d215acfc4771e1c6624", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1, Repairable: {Durability: 30, MaxDurability: 30}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 30, MaxDurability: 30 } }, }, { _id: "285e9d9ae196ae4e336cd04f", _tpl: "5d5d87f786f77427997cfaef", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1, Repairable: {Durability: 75, MaxDurability: 80}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 75, MaxDurability: 80 } }, }, { _id: "3bc4ff5bd99f165dc75cbd25", _tpl: "5f5e467b0bc58666c37e7821", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "6bf5d8ee81a3c9aec21bbbad", _tpl: "5d5fca1ea4b93635fd598c07", parentId: "5fe49444ae6628187a2e77b8", slotId: "hideout", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "2371438cf809b5e483bf5d85", _tpl: "5cc70093e4a949033c734312", parentId: "12c243bd6b3e486e61325f81", slotId: "mod_magazine", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "7f890346ea5b2cbc68c3170f", _tpl: "5cc700b9e4a949000f0f0f25", parentId: "12c243bd6b3e486e61325f81", slotId: "mod_stock", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "12fb79a9c4929009ff8d89e1", _tpl: "5cc700ede4a949033c734315", parentId: "12c243bd6b3e486e61325f81", slotId: "mod_reciever", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "d4c5274082ed716e19447f46", _tpl: "5cc701d7e4a94900100ac4e7", parentId: "12c243bd6b3e486e61325f81", slotId: "mod_barrel", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "d819dd4d2b13de10e9d6d805", _tpl: "5cc6ea85e4a949000e1ea3c3", parentId: "12c243bd6b3e486e61325f81", slotId: "mod_charge", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "fc9a664cacc477c4e725a81a", _tpl: "5cc700d4e4a949000f0f0f28", parentId: "7f890346ea5b2cbc68c3170f", slotId: "mod_stock_000", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "372891c593cf14e176b93ce2", _tpl: "5cc7012ae4a949001252b43e", parentId: "12fb79a9c4929009ff8d89e1", slotId: "mod_mount_000", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "bd196435a57bdc433df1e49d", _tpl: "5cc7012ae4a949001252b43e", parentId: "12fb79a9c4929009ff8d89e1", slotId: "mod_mount_001", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "ea3349d29797354d835c2192", _tpl: "58491f3324597764bc48fa02", parentId: "12fb79a9c4929009ff8d89e1", slotId: "mod_scope", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "4ccf7c74ca7d2167deb0ae5c", _tpl: "626becf9582c3e319310b837", parentId: "372891c593cf14e176b93ce2", slotId: "mod_tactical", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "adfd3640fc93daf21c721ca6", _tpl: "5cc9c20cd7f00c001336c65d", parentId: "bd196435a57bdc433df1e49d", slotId: "mod_tactical", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "deeb36b1812790b0145d2532", _tpl: "5a16badafcdbcb001865f72d", parentId: "61ab4afefac354dfc64c7874", slotId: "mod_equipment_000", - upd: {StackObjectsCount: 1, Repairable: {Durability: 12, MaxDurability: 25}}, + 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}}, + 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}}, + 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}}, + 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}}, + 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}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 }, Togglable: { On: true } }, }, { _id: "1883b955ab202fa099809278", _tpl: "57d17c5e2459775a5c57d17d", parentId: "da82c293cabc705b30fef93a", slotId: "mod_flashlight", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "e3c9e50ce31900c950b4ff6f", _tpl: "5cc70093e4a949033c734312", parentId: "285e9d9ae196ae4e336cd04f", slotId: "1", - location: {x: 0, y: 0, r: "Vertical", isSearched: true}, - upd: {StackObjectsCount: 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}, + 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}, + 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}, + 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}, + 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}, + 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}, + 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}, + 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}, + 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}, + 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}, + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, }, { _id: "bdb46107abbf1d92edaaf14e", _tpl: "6272379924e29f06af4d5ecb", parentId: "3aeb18aac0b532f34255f162", slotId: "mod_tactical", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "0caadd8507a36d9ea871e88e", _tpl: "5ab8f04f86f774585f4237d8", parentId: "3bc4ff5bd99f165dc75cbd25", slotId: "main", - location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, - upd: {StackObjectsCount: 1}, + 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}, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, upd: { StackObjectsCount: 1, sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: {Durability: 32, MaxDurability: 59}, - Foldable: {Folded: true}, + Repairable: { Durability: 32, MaxDurability: 59 }, + Foldable: { Folded: true }, }, }, { _id: "70b23c628fa17699d9a71e94", @@ -675,14 +675,14 @@ export const profileInsuranceFixture: Insurance[] = [{ upd: { StackObjectsCount: 1, sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: {Durability: 32, MaxDurability: 59}, + Repairable: { Durability: 32, MaxDurability: 59 }, }, }, { _id: "7cc2e24dc6bc0716bdddc472", _tpl: "5943ee5a86f77413872d25ec", parentId: "240046eebc9040c1d7e58611", slotId: "mod_muzzle", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "7a51ebbad703082660d59d27", _tpl: "5649ade84bdc2d1b2b8b4587", @@ -691,14 +691,14 @@ export const profileInsuranceFixture: Insurance[] = [{ upd: { StackObjectsCount: 1, sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: {Durability: 32, MaxDurability: 59}, + Repairable: { Durability: 32, MaxDurability: 59 }, }, }, { _id: "b481bc57436ed9a0c3abe7f3", _tpl: "5d2c76ed48f03532f2136169", parentId: "240046eebc9040c1d7e58611", slotId: "mod_reciever", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "5774ef80597c7f91bff40dbb", _tpl: "5ac50c185acfc400163398d4", @@ -707,20 +707,20 @@ export const profileInsuranceFixture: Insurance[] = [{ upd: { StackObjectsCount: 1, sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: {Durability: 32, MaxDurability: 59}, + Repairable: { Durability: 32, MaxDurability: 59 }, }, }, { _id: "8b7c8e6ba172ac390c99a2ae", _tpl: "5ac66c5d5acfc4001718d314", parentId: "240046eebc9040c1d7e58611", slotId: "mod_magazine", - upd: {StackObjectsCount: 1}, + upd: { StackObjectsCount: 1 }, }, { _id: "1ed3a416b1fc7adbed1160df", _tpl: "6130ca3fd92c473c77020dbd", parentId: "240046eebc9040c1d7e58611", slotId: "mod_charge", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { _id: "bbe087661947c0d9c1cde146", _tpl: "5648b1504bdc2d9d488b4584", @@ -729,19 +729,19 @@ export const profileInsuranceFixture: Insurance[] = [{ upd: { StackObjectsCount: 1, sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: {Durability: 32, MaxDurability: 59}, + Repairable: { Durability: 32, MaxDurability: 59 }, }, }, { _id: "724388f8110434efccd79b3a", _tpl: "544a3a774bdc2d3a388b4567", parentId: "b481bc57436ed9a0c3abe7f3", slotId: "mod_scope", - upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, + 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}}, + 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 af6f94a9..4f2cd9e1 100644 --- a/project/tests/controllers/InsuranceController.test.ts +++ b/project/tests/controllers/InsuranceController.test.ts @@ -34,7 +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(), @@ -246,11 +246,11 @@ describe("InsuranceController", () => const insurance = [{ _id: "1", upd: 1234567890, - items: [{_id: "1", parentId: "1", slotId: "1"}, {_id: "2", parentId: "1", slotId: "2"}], + 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"}, { + items: [{ _id: "3", parentId: "2", slotId: "1" }, { _id: "4", parentId: "2", slotId: "2" }, { _id: "5", parentId: "2", slotId: "3", @@ -279,7 +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. @@ -295,12 +295,12 @@ 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"}}, + 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"}}, + messageContent: { systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" } }, }], }; @@ -322,10 +322,10 @@ 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"}}, + messageContent: { systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" } }, }], }; @@ -347,10 +347,10 @@ 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"}}, + messageContent: { systemData: { date: "02.11.2023", time: "10:50", location: "factory4_night" } }, }], }; @@ -917,7 +917,7 @@ describe("InsuranceController", () => { it("should log details for each attachment", () => { - const attachments = [{_id: "item1", name: "Item 1", maxPrice: 100}, { + const attachments = [{ _id: "item1", name: "Item 1", maxPrice: 100 }, { _id: "item2", name: "Item 2", maxPrice: 200, @@ -1165,7 +1165,7 @@ describe("InsuranceController", () => // Manually set one of the items to be orphaned. insured.items[0].parentId = "9999"; // Should not exist in the items array. insured.items[0].slotId = "main"; // Should not be "hideout". - insured.items[0].location = {x: 1, y: 2, r: 3, isSearched: true}; // Should be removed. + insured.items[0].location = { x: 1, y: 2, r: 3, isSearched: true }; // Should be removed. // Iterate over the items and find an individual orphaned item. const orphanedItem = insured.items.find((item) => @@ -1396,10 +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. @@ -1424,7 +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: "", @@ -1433,7 +1433,7 @@ describe("InsuranceController", () => scheme_id: 0, }, sessionId, - {warnings: [], otherProperty: "property-value"}, + { warnings: [], otherProperty: "property-value" }, ); }); @@ -1459,7 +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: "", @@ -1498,7 +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); @@ -1517,7 +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); @@ -1542,18 +1542,18 @@ describe("InsuranceController", () => vi.spyOn(insuranceController.profileHelper, "getPmcProfile").mockReturnValue({ Inventory: { - items: [{_id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1"}, { + items: [{ _id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1" }, { _id: "itemId2", _tpl: "itemTpl2", otherProperty: "property-value2", - }, {_id: "itemId3", _tpl: "itemTpl3", otherProperty: "property-value3"}], + }, { _id: "itemId3", _tpl: "itemTpl3", otherProperty: "property-value3" }], }, }); }); it("should return an empty object if no traders and items are specified", () => { - const request = {traders: [], items: []}; + const request = { traders: [], items: [] }; const expected = {}; const result = insuranceController.cost(request, sessionId); @@ -1563,8 +1563,8 @@ describe("InsuranceController", () => it("should return an empty object if no items are specified", () => { - const request = {traders: ["prapor"], items: []}; - const expected = {prapor: {}}; + const request = { traders: ["prapor"], items: [] }; + const expected = { prapor: {} }; const result = insuranceController.cost(request, sessionId); @@ -1573,7 +1573,7 @@ describe("InsuranceController", () => it("should return an empty object if no trader is specified but items are", () => { - const request = {traders: [], items: ["itemId1", "itemId2"]}; + const request = { traders: [], items: ["itemId1", "itemId2"] }; const expected = {}; const result = insuranceController.cost(request, sessionId); @@ -1583,10 +1583,10 @@ 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}, + prapor: { itemTpl1: 100, itemTpl2: 200, itemTpl3: 300 }, + therapist: { itemTpl1: 150, itemTpl2: 250, itemTpl3: 350 }, }; // Mock the InsuranceService.getPremium method to return the expected values. @@ -1609,7 +1609,7 @@ 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( diff --git a/project/tests/generators/BotGenerator.test.ts b/project/tests/generators/BotGenerator.test.ts index c8f72397..05d9f402 100644 --- a/project/tests/generators/BotGenerator.test.ts +++ b/project/tests/generators/BotGenerator.test.ts @@ -59,11 +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; @@ -77,10 +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; @@ -95,11 +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; @@ -113,10 +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; @@ -132,10 +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 762cb99f..8d8815a6 100644 --- a/project/tests/generators/BotLevelGenerator.test.ts +++ b/project/tests/generators/BotLevelGenerator.test.ts @@ -27,7 +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, @@ -50,7 +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; @@ -61,7 +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 965ea126..d13f2e91 100644 --- a/project/tests/helpers/InRaidHelper.test.ts +++ b/project/tests/helpers/InRaidHelper.test.ts @@ -24,7 +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; @@ -37,7 +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; @@ -51,10 +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"}, { + const postRaidPlayerVictims = [{ Side: "Usec", Role: "sptUsec" }, { Side: "savage", Role: "assault" }, { Side: "savage", Role: "bossBoar", - }, {Side: "savage", Role: "assault"}]; // Kills + }, { Side: "savage", Role: "assault" }]; // Kills const databaseServer = container.resolve("DatabaseServer"); const usecStandingChangeOnKill = databaseServer.getTables().bots.types.bear.experience.standingForKill; @@ -72,7 +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 b00addb7..8e875727 100644 --- a/project/tests/helpers/ItemHelper.test.ts +++ b/project/tests/helpers/ItemHelper.test.ts @@ -249,7 +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(); @@ -258,7 +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(); @@ -267,7 +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(); @@ -452,7 +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); @@ -466,7 +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); @@ -498,7 +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); @@ -531,7 +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); @@ -545,7 +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); @@ -559,7 +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: "", @@ -592,8 +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); @@ -609,7 +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); @@ -625,7 +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(() => @@ -646,7 +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); @@ -662,7 +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"); @@ -677,7 +677,7 @@ 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}, { + const items: Item[] = [{ _id: "1", _tpl: "", parentId: null }, { _id: "2", _tpl: "", parentId: null }, { _id: "3", _tpl: "", parentId: "2", @@ -688,7 +688,7 @@ describe("ItemHelper", () => 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"}, { + const items: Item[] = [{ _id: "1", _tpl: "", parentId: null }, { _id: "2", _tpl: "", parentId: "1" }, { _id: "3", _tpl: "", parentId: "1", @@ -699,18 +699,18 @@ describe("ItemHelper", () => 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"}, { + const items: Item[] = [{ _id: "1", _tpl: "", parentId: null }, { _id: "2", _tpl: "", parentId: "1" }, { _id: "3", _tpl: "", parentId: "2", - }, {_id: "4", _tpl: "", parentId: "3"}]; + }, { _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"]); }); @@ -747,7 +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); @@ -762,7 +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); @@ -1024,7 +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]); @@ -1036,7 +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 9e78fa02..cea1dae3 100644 --- a/project/tests/services/PaymentService.test.ts +++ b/project/tests/services/PaymentService.test.ts @@ -50,8 +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 @@ -63,7 +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 @@ -71,7 +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. @@ -80,13 +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 166961b4..d3290ec2 100644 --- a/project/vitest.config.ts +++ b/project/vitest.config.ts @@ -7,7 +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: { @@ -20,7 +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") }, }, });