0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Formatting Change - Space is now given around object properties.

This commit is contained in:
Refringe 2023-11-13 12:38:16 -05:00
parent 32b47bdc18
commit 0793df60c2
No known key found for this signature in database
GPG Key ID: 64E03E5F892C6F9E
100 changed files with 813 additions and 755 deletions

View File

@ -22,10 +22,10 @@
"typeLiteral.separatorKind": "semiColon", "typeLiteral.separatorKind": "semiColon",
"enumDeclaration.memberSpacing": "newLine", "enumDeclaration.memberSpacing": "newLine",
"spaceAround": false, "spaceAround": false,
"spaceSurroundingProperties": false, "spaceSurroundingProperties": true,
"objectExpression.spaceSurroundingProperties": false, "objectExpression.spaceSurroundingProperties": true,
"objectPattern.spaceSurroundingProperties": false, "objectPattern.spaceSurroundingProperties": true,
"typeLiteral.spaceSurroundingProperties": false, "typeLiteral.spaceSurroundingProperties": true,
"binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator": true, "binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator": true,
"commentLine.forceSpaceAfterSlashes": true, "commentLine.forceSpaceAfterSlashes": true,
"constructor.spaceBeforeParentheses": false, "constructor.spaceBeforeParentheses": false,

View File

@ -8,7 +8,7 @@ import rename from "gulp-rename";
import pkg from "pkg"; import pkg from "pkg";
import pkgfetch from "pkg-fetch"; import pkgfetch from "pkg-fetch";
import * as ResEdit from "resedit"; import * as ResEdit from "resedit";
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 nodeVersion = "node18"; // As of pkg-fetch v3.5, it's v18.15.0
const stdio = "inherit"; const stdio = "inherit";
@ -27,7 +27,7 @@ const licenseFile = "../LICENSE.md";
/** /**
* Transpile src files into Javascript with SWC * Transpile src files into Javascript with SWC
*/ */
const compile = async () => await exec("swc src -d obj", {stdio}); const compile = async () => await exec("swc src -d obj", { stdio });
// Packaging // Packaging
const fetchPackageImage = async () => const fetchPackageImage = async () =>
@ -74,14 +74,14 @@ const updateBuildProperties = async () =>
const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0]; const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0];
vi.setStringValues({lang: 1033, codepage: 1200}, { vi.setStringValues({ lang: 1033, codepage: 1200 }, {
ProductName: manifest.author, ProductName: manifest.author,
FileDescription: manifest.description, FileDescription: manifest.description,
CompanyName: manifest.name, CompanyName: manifest.name,
LegalCopyright: manifest.license, LegalCopyright: manifest.license,
}); });
vi.removeStringValue({lang: 1033, codepage: 1200}, "OriginalFilename"); vi.removeStringValue({ lang: 1033, codepage: 1200 }, "OriginalFilename");
vi.removeStringValue({lang: 1033, codepage: 1200}, "InternalName"); vi.removeStringValue({ lang: 1033, codepage: 1200 }, "InternalName");
vi.setFileVersion(...manifest.version.split(".").map(Number)); vi.setFileVersion(...manifest.version.split(".").map(Number));
vi.setProductVersion(...manifest.version.split(".").map(Number)); vi.setProductVersion(...manifest.version.split(".").map(Number));
vi.outputToResourceEntries(res.entries); vi.outputToResourceEntries(res.entries);
@ -120,7 +120,7 @@ const writeCommitHashToCoreJSON = async () =>
const parsed = JSON.parse(coreJSON); const parsed = JSON.parse(coreJSON);
// Fetch the latest Git commit hash // 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 // Update the commit hash in the core.json object
parsed.commit = gitResult.stdout.trim() || ""; parsed.commit = gitResult.stdout.trim() || "";
@ -154,12 +154,12 @@ const addAssets = gulp.series(copyAssets, copyExecutables, copyLicense, writeCom
/** /**
* Cleans the build directory. * 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. * 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. * 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:release", build("release"));
gulp.task("build:bleeding", build("bleeding")); gulp.task("build:bleeding", build("bleeding"));
gulp.task("run:build", async () => await exec("Aki.Server.exe", {stdio, cwd: buildDir})); 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:debug",
async () => await exec("ts-node-dev -r tsconfig-paths/register src/ide/TestEntry.ts", { stdio }),
);
gulp.task("run:profiler", async () => gulp.task("run:profiler", async () =>
{ {
await cleanCompiled(); await cleanCompiled();
await compile(); 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 });
}); });

View File

@ -12,7 +12,7 @@ export class ErrorHandler
constructor() constructor()
{ {
this.logger = new WinstonMainLogger(new AsyncQueue()); 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 public handleCriticalError(err: Error): void

View File

@ -28,7 +28,10 @@ export class CustomizationCallbacks
*/ */
public getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetSuitsResponse> public getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetSuitsResponse>
{ {
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); return this.httpResponse.getBody(result);
} }

View File

@ -75,7 +75,7 @@ export class DialogueCallbacks implements OnUpdate
VersionId: "bgkidft87ddd", // TODO: Is this... correct? VersionId: "bgkidft87ddd", // TODO: Is this... correct?
Ip: "", Ip: "",
Port: 0, Port: 0,
Chats: [{_id: "0", Members: 0}], Chats: [{ _id: "0", Members: 0 }],
}; };
return this.httpResponse.getBody([chatServer]); return this.httpResponse.getBody([chatServer]);
@ -181,7 +181,7 @@ export class DialogueCallbacks implements OnUpdate
sessionID: string, sessionID: string,
): IGetBodyResponseData<IFriendRequestSendResponse> ): IGetBodyResponseData<IFriendRequestSendResponse>
{ {
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 */ /** 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(); return this.httpResponse.nullResponse();
} }
/** Handle client/friend/ignore/remove */ /** 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(); return this.httpResponse.nullResponse();
} }

View File

@ -58,7 +58,7 @@ export class GameCallbacks implements OnLoad
const today = new Date().toUTCString(); const today = new Date().toUTCString();
const startTimeStampMS = Date.parse(today); const startTimeStampMS = Date.parse(today);
this.gameController.gameStart(url, info, sessionID, startTimeStampMS); this.gameController.gameStart(url, info, sessionID, startTimeStampMS);
return this.httpResponse.getBody({utc_time: startTimeStampMS / 1000}); return this.httpResponse.getBody({ utc_time: startTimeStampMS / 1000 });
} }
/** /**
@ -73,7 +73,7 @@ export class GameCallbacks implements OnLoad
): IGetBodyResponseData<IGameLogoutResponseData> ): IGetBodyResponseData<IGameLogoutResponseData>
{ {
this.saveServer.save(); 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 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 public reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData

View File

@ -68,7 +68,7 @@ export class NotifierCallbacks
sessionID: string, sessionID: string,
): IGetBodyResponseData<ISelectProfileResponse> ): IGetBodyResponseData<ISelectProfileResponse>
{ {
return this.httpResponse.getBody({status: "ok"}); return this.httpResponse.getBody({ status: "ok" });
} }
public notify(url: string, info: any, sessionID: string): string public notify(url: string, info: any, sessionID: string): string

View File

@ -34,7 +34,7 @@ export class ProfileCallbacks
public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<any> public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<any>
{ {
this.profileController.createProfile(info, sessionID); 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(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(null, 256, "256 - ");
} }
return this.httpResponse.getBody({status: "ok"}); return this.httpResponse.getBody({ status: "ok" });
} }
/** /**
@ -150,7 +150,7 @@ export class ProfileCallbacks
raidMode: "Online", raidMode: "Online",
mode: "deathmatch", mode: "deathmatch",
shortId: "xxx1x1", 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); return this.httpResponse.getBody(response);

View File

@ -290,6 +290,6 @@ export class BotController
public getAiBotBrainTypes(): any public getAiBotBrainTypes(): any
{ {
return {pmc: this.pmcConfig.pmcType, assault: this.botConfig.assaultBrainType}; return { pmc: this.pmcConfig.pmcType, assault: this.botConfig.assaultBrainType };
} }
} }

View File

@ -209,7 +209,7 @@ export class CustomizationController
parentId: relatedItem.parentId, parentId: relatedItem.parentId,
slotId: relatedItem.slotId, slotId: relatedItem.slotId,
location: relatedItem.location, location: relatedItem.location,
upd: {StackObjectsCount: relatedItem.upd.StackObjectsCount}, upd: { StackObjectsCount: relatedItem.upd.StackObjectsCount },
}); });
} }
} }

View File

@ -60,7 +60,7 @@ export class DialogueController
public getFriendList(sessionID: string): IGetFriendListDataResponse public getFriendList(sessionID: string): IGetFriendListDataResponse
{ {
// Force a fake friend called SPT into friend list // Force a fake friend called SPT into friend list
return {Friends: [this.getSptFriendData()], Ignore: [], InIgnoreList: []}; return { Friends: [this.getSptFriendData()], Ignore: [], InIgnoreList: [] };
} }
/** /**

View File

@ -435,7 +435,7 @@ export class GameController
*/ */
public getServer(sessionId: string): IServerDetails[] 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 public getCurrentGroup(sessionId: string): ICurrentGroupResponse
{ {
return {squad: []}; return { squad: [] };
} }
/** /**
@ -451,7 +451,7 @@ export class GameController
*/ */
public getValidGameVersion(sessionId: string): ICheckVersionResponse 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 public getKeepAlive(sessionId: string): IGameKeepAliveResponse
{ {
return {msg: "OK", utc_time: new Date().getTime() / 1000}; return { msg: "OK", utc_time: new Date().getTime() / 1000 };
} }
/** /**

View File

@ -92,7 +92,7 @@ export class HealthController
{ {
// Get max healing from db // Get max healing from db
const maxHp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource; const maxHp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource;
healingItemToUse.upd.MedKit = {HpResource: maxHp - request.count}; // Subtract amount used from max healingItemToUse.upd.MedKit = { HpResource: maxHp - request.count }; // Subtract amount used from max
} }
// Resource in medkit is spent, delete it // Resource in medkit is spent, delete it
@ -132,7 +132,7 @@ export class HealthController
{ {
if (itemToConsume.upd.FoodDrink === undefined) if (itemToConsume.upd.FoodDrink === undefined)
{ {
itemToConsume.upd.FoodDrink = {HpPercent: consumedItemMaxResource - request.count}; itemToConsume.upd.FoodDrink = { HpPercent: consumedItemMaxResource - request.count };
} }
else else
{ {

View File

@ -93,7 +93,7 @@ export class HideoutController
const items = request.items.map((reqItem) => const items = request.items.map((reqItem) =>
{ {
const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id); const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id);
return {inventoryItem: item, requestedItem: reqItem}; return { inventoryItem: item, requestedItem: reqItem };
}); });
// If it's not money, its construction / barter items // If it's not money, its construction / barter items
@ -324,7 +324,7 @@ export class HideoutController
} }
// Add new item as none exists // 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 itemsToAdd = Object.entries(addItemToHideoutRequest.items).map((kvp) =>
{ {
const item = pmcData.Inventory.items.find((invItem) => invItem._id === kvp[1].id); const item = pmcData.Inventory.items.find((invItem) => invItem._id === kvp[1].id);
return {inventoryItem: item, requestedItem: kvp[1], slot: kvp[0]}; return { inventoryItem: item, requestedItem: kvp[1], slot: kvp[0] };
}); });
const hideoutArea = pmcData.Hideout.Areas.find((area) => area.type === addItemToHideoutRequest.areaType); 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 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; 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); const entries = Object.entries(pmcData.Hideout.Production);
let prodId: string; let prodId: string;
@ -871,7 +871,7 @@ export class HideoutController
// Handle the isEncoded flag from recipe // Handle the isEncoded flag from recipe
if (recipe.isEncoded) 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); 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]; delete output.profileChanges[sessionID].production[request.recipeId];
const itemsToAdd = pmcData.Hideout.Production[prodId].Products.map( const itemsToAdd = pmcData.Hideout.Production[prodId].Products.map(
(x: {_tpl: string; upd?: {StackObjectsCount?: number;};}) => (x: { _tpl: string; upd?: { StackObjectsCount?: number; }; }) =>
{ {
let id = x._tpl; let id = x._tpl;
if (this.presetHelper.hasPreset(id)) if (this.presetHelper.hasPreset(id))
@ -939,11 +939,11 @@ export class HideoutController
} }
const numOfItems = !x.upd?.StackObjectsCount ? 1 : x.upd.StackObjectsCount; 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 = () => const callback = () =>
{ {
@ -1035,7 +1035,7 @@ export class HideoutController
// Check if counter exists, add placeholder if it doesn't // Check if counter exists, add placeholder if it doesn't
if (!pmcData.Stats.Eft.OverallCounters.Items.find((x) => x.Key.includes("ShootingRangePoints"))) if (!pmcData.Stats.Eft.OverallCounters.Items.find((x) => x.Key.includes("ShootingRangePoints")))
{ {
pmcData.Stats.Eft.OverallCounters.Items.push({Key: ["ShootingRangePoints"], Value: 0}); pmcData.Stats.Eft.OverallCounters.Items.push({ Key: ["ShootingRangePoints"], Value: 0 });
} }
// Find counter by key and update value // Find counter by key and update value
@ -1066,7 +1066,7 @@ export class HideoutController
const items = request.items.map((reqItem) => const items = request.items.map((reqItem) =>
{ {
const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id); const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id);
return {inventoryItem: item, requestedItem: reqItem}; return { inventoryItem: item, requestedItem: reqItem };
}); });
// If it's not money, its construction / barter items // If it's not money, its construction / barter items

View File

@ -423,7 +423,7 @@ export class InsuranceController
*/ */
protected countSuccessfulRolls(attachments: Item[], traderId: string): number 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; return rolls.filter(Boolean).length;
} }
@ -440,14 +440,14 @@ export class InsuranceController
toDelete: Set<string>, toDelete: Set<string>,
): void ): void
{ {
const valuableToDelete = attachments.slice(0, successfulRolls).map(({_id}) => _id); const valuableToDelete = attachments.slice(0, successfulRolls).map(({ _id }) => _id);
for (const attachmentsId of valuableToDelete) for (const attachmentsId of valuableToDelete)
{ {
const valuableChild = attachments.find(({_id}) => _id === attachmentsId); const valuableChild = attachments.find(({ _id }) => _id === attachmentsId);
if (valuableChild) if (valuableChild)
{ {
const {name, maxPrice} = valuableChild; const { name, maxPrice } = valuableChild;
this.logger.debug(`Marked for removal - Child Item: ${name}, Max Price: ${maxPrice}`); this.logger.debug(`Marked for removal - Child Item: ${name}, Max Price: ${maxPrice}`);
toDelete.add(attachmentsId); toDelete.add(attachmentsId);
} }
@ -625,7 +625,7 @@ export class InsuranceController
// add items to InsuredItems list once money has been paid // add items to InsuredItems list once money has been paid
for (const key of body.items) 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); this.profileHelper.addSkillPointsToPlayer(pmcData, SkillTypes.CHARISMA, itemsToInsureCount * 0.01);

View File

@ -282,12 +282,12 @@ export class InventoryController
if (!(destinationItem.upd?.StackObjectsCount)) if (!(destinationItem.upd?.StackObjectsCount))
{ {
// No stack count on destination, add one // No stack count on destination, add one
destinationItem.upd = {StackObjectsCount: 1}; destinationItem.upd = { StackObjectsCount: 1 };
} }
if (!sourceItem.upd) if (!sourceItem.upd)
{ {
sourceItem.upd = {StackObjectsCount: 1}; sourceItem.upd = { StackObjectsCount: 1 };
} }
else if (!sourceItem.upd.StackObjectsCount) else if (!sourceItem.upd.StackObjectsCount)
{ {
@ -296,7 +296,7 @@ export class InventoryController
} }
destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stack count to destination destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stack count to destination
output.profileChanges[sessionID].items.del.push({_id: sourceItem._id}); // Inform client source item being deleted output.profileChanges[sessionID].items.del.push({ _id: sourceItem._id }); // Inform client source item being deleted
const indexOfItemToRemove = inventoryItems.from.findIndex((x) => x._id === sourceItem._id); const indexOfItemToRemove = inventoryItems.from.findIndex((x) => x._id === sourceItem._id);
if (indexOfItemToRemove === -1) if (indexOfItemToRemove === -1)
@ -370,7 +370,7 @@ export class InventoryController
let sourceStackCount = 1; let sourceStackCount = 1;
if (!sourceItem.upd) if (!sourceItem.upd)
{ {
sourceItem.upd = {StackObjectsCount: 1}; sourceItem.upd = { StackObjectsCount: 1 };
} }
sourceStackCount = sourceItem.upd.StackObjectsCount; sourceStackCount = sourceItem.upd.StackObjectsCount;
@ -392,7 +392,7 @@ export class InventoryController
} }
else else
{ {
Object.assign(destinationItem, {upd: {StackObjectsCount: 1}}); Object.assign(destinationItem, { upd: { StackObjectsCount: 1 } });
} }
destinationItem.upd.StackObjectsCount = destinationStackCount + body.count; destinationItem.upd.StackObjectsCount = destinationStackCount + body.count;
@ -465,12 +465,12 @@ export class InventoryController
{ {
if (item._id && item._id === body.item) 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 this.eventOutputHolder.getOutput(sessionID);
} }
} }
return {warnings: [], profileChanges: {}}; return { warnings: [], profileChanges: {} };
} }
/** /**
@ -499,7 +499,7 @@ export class InventoryController
itemToToggle.upd = {}; itemToToggle.upd = {};
} }
itemToToggle.upd.Togglable = {On: body.value}; itemToToggle.upd.Togglable = { On: body.value };
return this.eventOutputHolder.getOutput(sessionID); 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) if ("upd" in item)
{ {
item.upd.Tag = {Color: body.TagColor, Name: body.TagName}; item.upd.Tag = { Color: body.TagColor, Name: body.TagName };
} }
else 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 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); const mapItem = pmcData.Inventory.items.find((i) => i._id === request.item);
// add marker // add marker
mapItem.upd.Map = mapItem.upd.Map || {Markers: []}; mapItem.upd.Map = mapItem.upd.Map || { Markers: [] };
request.mapMarker.Note = this.sanitiseMapMarkerText(request.mapMarker.Note); request.mapMarker.Note = this.sanitiseMapMarkerText(request.mapMarker.Note);
mapItem.upd.Map.Markers.push(request.mapMarker); mapItem.upd.Map.Markers.push(request.mapMarker);
@ -857,7 +857,7 @@ export class InventoryController
const containerDetails = this.itemHelper.getItem(openedItem._tpl); const containerDetails = this.itemHelper.getItem(openedItem._tpl);
const isSealedWeaponBox = containerDetails[1]._name.includes("event_container_airdrop"); const isSealedWeaponBox = containerDetails[1]._name.includes("event_container_airdrop");
const newItemRequest: IAddItemRequestData = {tid: "RandomLootContainer", items: []}; const newItemRequest: IAddItemRequestData = { tid: "RandomLootContainer", items: [] };
let foundInRaid = false; let foundInRaid = false;
if (isSealedWeaponBox) if (isSealedWeaponBox)

View File

@ -135,7 +135,7 @@ export class LocationController
locations[mapBase._Id] = mapBase; 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); const airdropConfig = this.getAirdropLootConfigByType(airdropType);
return {dropType: airdropType, loot: this.lootGenerator.createRandomLoot(airdropConfig)}; return { dropType: airdropType, loot: this.lootGenerator.createRandomLoot(airdropConfig) };
} }
/** /**

View File

@ -101,7 +101,7 @@ export class MatchController
/** Handle match/group/start_game */ /** Handle match/group/start_game */
public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult 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 // get list of players joining into the match
output.profiles.push({ output.profiles.push({
@ -125,7 +125,7 @@ export class MatchController
/** Handle client/match/group/status */ /** Handle client/match/group/status */
public getGroupStatus(info: IGetGroupStatusRequestData): any public getGroupStatus(info: IGetGroupStatusRequestData): any
{ {
return {players: [], maxPveCountExceeded: false}; return { players: [], maxPveCountExceeded: false };
} }
/** /**
@ -225,7 +225,7 @@ export class MatchController
_tpl: item.tpl, _tpl: item.tpl,
slotId: "main", slotId: "main",
parentId: parentId, parentId: parentId,
upd: {StackObjectsCount: item.stackCount, SpawnedInSession: true}, upd: { StackObjectsCount: item.stackCount, SpawnedInSession: true },
}); });
} }

View File

@ -14,7 +14,7 @@ export class NoteController
public addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse 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); pmcData.Notes.Notes.push(newNote);
return this.eventOutputHolder.getOutput(sessionID); return this.eventOutputHolder.getOutput(sessionID);

View File

@ -33,7 +33,7 @@ export class PresetBuildController
const profile = this.saveServer.getProfile(sessionID); const profile = this.saveServer.getProfile(sessionID);
if (!profile.userbuilds) 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 // 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 // Create new object ready to save into profile userbuilds.weaponBuilds
const newId = this.hashUtil.generate(); // Id is empty, generate it 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 savedWeaponBuilds = this.saveServer.getProfile(sessionId).userbuilds.weaponBuilds;
const existingBuild = savedWeaponBuilds.find((x) => x.id === body.id); const existingBuild = savedWeaponBuilds.find((x) => x.id === body.id);

View File

@ -149,7 +149,7 @@ export class ProfileController
if (!pmcData.UnlockedInfo) if (!pmcData.UnlockedInfo)
{ {
pmcData.UnlockedInfo = {unlockedProductionRecipe: []}; pmcData.UnlockedInfo = { unlockedProductionRecipe: [] };
} }
// Change item id's to be unique // Change item id's to be unique
@ -164,7 +164,7 @@ export class ProfileController
// Create profile // Create profile
const profileDetails: IAkiProfile = { const profileDetails: IAkiProfile = {
info: account, info: account,
characters: {pmc: pmcData, scav: {} as IPmcData}, characters: { pmc: pmcData, scav: {} as IPmcData },
suits: profile.suits, suits: profile.suits,
userbuilds: profile.userbuilds, userbuilds: profile.userbuilds,
dialogues: profile.dialogues, dialogues: profile.dialogues,
@ -348,6 +348,6 @@ export class ProfileController
*/ */
public getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[] 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 } }];
} }
} }

View File

@ -866,7 +866,7 @@ export class QuestController
let index = pmcData.Inventory.items.length; let index = pmcData.Inventory.items.length;
// Important: don't tell the client to remove the attachments, it will handle it // 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 // Important: loop backward when removing items from the array we're looping on
while (index-- > 0) while (index-- > 0)
@ -955,6 +955,6 @@ export class QuestController
return; return;
} }
pmcData.BackendCounters[conditionId] = {id: conditionId, qid: questId, value: counterValue}; pmcData.BackendCounters[conditionId] = { id: conditionId, qid: questId, value: counterValue };
} }
} }

View File

@ -326,7 +326,7 @@ export class RagfairController
const min = offers[0].requirementsCost; // Get first item from array as its pre-sorted 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 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 // No offers listed, get price from live ragfair price list prices.json
else else
@ -340,7 +340,7 @@ export class RagfairController
tplPrice = this.handbookHelper.getTemplatePrice(getPriceRequest.templateId); 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) => 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( return this.ragfairOfferGenerator.createFleaOffer(
@ -663,7 +663,7 @@ export class RagfairController
if (index === -1) if (index === -1)
{ {
this.logger.error( 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( return this.httpResponse.appendErrorToOutput(
this.eventOutputHolder.getOutput(sessionID), this.eventOutputHolder.getOutput(sessionID),
@ -693,7 +693,7 @@ export class RagfairController
if (index === -1) if (index === -1)
{ {
this.logger.warning( 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( return this.httpResponse.appendErrorToOutput(
this.eventOutputHolder.getOutput(sessionID), this.eventOutputHolder.getOutput(sessionID),
@ -742,7 +742,7 @@ export class RagfairController
return { return {
tid: "ragfair", tid: "ragfair",
Action: "TradingConfirm", 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: "", type: "",
item_id: "", item_id: "",
count: 0, count: 0,

View File

@ -313,7 +313,7 @@ export class RepeatableQuestController
// Target is boss // Target is boss
if (probabilityObject.data.isBoss) if (probabilityObject.data.isBoss)
{ {
questPool.pool.Elimination.targets[probabilityObject.key] = {locations: ["any"]}; questPool.pool.Elimination.targets[probabilityObject.key] = { locations: ["any"] };
} }
else else
{ {
@ -321,8 +321,8 @@ export class RepeatableQuestController
// Set possible locations for elimination task, if target is savage, exclude labs from locations // Set possible locations for elimination task, if target is savage, exclude labs from locations
questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage") questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage")
? {locations: possibleLocations.filter((x) => x !== "laboratory")} ? { locations: possibleLocations.filter((x) => x !== "laboratory") }
: {locations: possibleLocations}; : { locations: possibleLocations };
} }
} }
@ -333,7 +333,7 @@ export class RepeatableQuestController
{ {
return { return {
types: repeatableConfig.types.slice(), types: repeatableConfig.types.slice(),
pool: {Exploration: {locations: {}}, Elimination: {targets: {}}, Pickup: {locations: {}}}, pool: { Exploration: { locations: {} }, Elimination: { targets: {} }, Pickup: { locations: {} } },
}; };
} }

View File

@ -203,7 +203,11 @@ export class TradeController
// Add item details to request // Add item details to request
// eslint-disable-next-line @typescript-eslint/naming-convention // 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`); this.logger.debug(`Selling scav items to fence for ${sellRequest.price} roubles`);
return this.tradeHelper.sellItem(profileWithItemsToSell, profileThatGetsMoney, sellRequest, sessionId); return this.tradeHelper.sellItem(profileWithItemsToSell, profileThatGetsMoney, sellRequest, sessionId);

View File

@ -24,7 +24,7 @@ export class WeatherController
/** Handle client/weather */ /** Handle client/weather */
public generate(): IWeatherData 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 = this.weatherGenerator.calculateGameTime(result);
result.weather = this.weatherGenerator.generateWeather(); result.weather = this.weatherGenerator.generateWeather();

View File

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

View File

@ -642,7 +642,10 @@ export class BotEquipmentModGenerator
// Pick random mod and check it's compatible // Pick random mod and check it's compatible
const exhaustableModPool = new ExhaustableArray(itemModPool[modSlot], this.randomUtil, this.jsonUtil); 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()) while (exhaustableModPool.hasValues())
{ {
modTpl = exhaustableModPool.getRandomValue(); modTpl = exhaustableModPool.getRandomValue();
@ -1011,7 +1014,7 @@ export class BotEquipmentModGenerator
{ {
const modSlotId = slot._name; const modSlotId = slot._name;
const modId = this.hashUtil.generate(); 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 });
} }
} }

View File

@ -430,7 +430,7 @@ export class BotGenerator
} }
// All skills have id and progress props // 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 // Common skills have additional props
if (isCommonSkills) if (isCommonSkills)

View File

@ -112,11 +112,11 @@ export class BotInventoryGenerator
return { return {
items: [ items: [
{_id: equipmentId, _tpl: equipmentTpl}, { _id: equipmentId, _tpl: equipmentTpl },
{_id: stashId, _tpl: stashTpl}, { _id: stashId, _tpl: stashTpl },
{_id: questRaidItemsId, _tpl: questRaidItemsTpl}, { _id: questRaidItemsId, _tpl: questRaidItemsTpl },
{_id: questStashItemsId, _tpl: questStashItemsTpl}, { _id: questStashItemsId, _tpl: questStashItemsTpl },
{_id: sortingTableId, _tpl: sortingTableTpl}, { _id: sortingTableId, _tpl: sortingTableTpl },
], ],
equipment: equipmentId, equipment: equipmentId,
stash: stashId, stash: stashId,
@ -403,10 +403,10 @@ export class BotInventoryGenerator
* @param equipmentChances Chances bot has certain equipment * @param equipmentChances Chances bot has certain equipment
* @returns What slots bot should have weapons generated for * @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); 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, slot: EquipmentSlots.SECOND_PRIMARY_WEAPON,
shouldSpawn: shouldSpawnPrimary shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon) ? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon)
@ -432,7 +432,7 @@ export class BotInventoryGenerator
*/ */
protected addWeaponAndMagazinesToInventory( protected addWeaponAndMagazinesToInventory(
sessionId: string, sessionId: string,
weaponSlot: {slot: EquipmentSlots; shouldSpawn: boolean;}, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; },
templateInventory: Inventory, templateInventory: Inventory,
botInventory: PmcInventory, botInventory: PmcInventory,
equipmentChances: Chances, equipmentChances: Chances,

View File

@ -55,7 +55,7 @@ export class BotLevelGenerator
exp += this.randomUtil.getInt(0, expTable[level].exp - 1); exp += this.randomUtil.getInt(0, expTable[level].exp - 1);
} }
return {level, exp}; return { level, exp };
} }
/** /**

View File

@ -252,13 +252,13 @@ export class BotWeaponGenerator
_tpl: ammoTpl, _tpl: ammoTpl,
parentId: weaponWithModsArray[0]._id, parentId: weaponWithModsArray[0]._id,
slotId: desiredSlotId, slotId: desiredSlotId,
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}); });
} }
else else
{ {
// Already exists, update values // Already exists, update values
existingItemWithSlot.upd = {StackObjectsCount: 1}; existingItemWithSlot.upd = { StackObjectsCount: 1 };
existingItemWithSlot._tpl = ammoTpl; existingItemWithSlot._tpl = ammoTpl;
} }
} }
@ -486,7 +486,7 @@ export class BotWeaponGenerator
// Define min/max of how many grenades bot will have // Define min/max of how many grenades bot will have
const ubglMinMax: GenerationData = { const ubglMinMax: GenerationData = {
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
weights: {"1": 1, "2": 1}, weights: { "1": 1, "2": 1 },
whitelist: [], whitelist: [],
}; };
@ -530,7 +530,7 @@ export class BotWeaponGenerator
[EquipmentSlots.SECURED_CONTAINER], [EquipmentSlots.SECURED_CONTAINER],
id, id,
ammoTpl, ammoTpl,
[{_id: id, _tpl: ammoTpl, upd: {StackObjectsCount: stackSize}}], [{ _id: id, _tpl: ammoTpl, upd: { StackObjectsCount: stackSize } }],
inventory, inventory,
); );
} }
@ -704,7 +704,7 @@ export class BotWeaponGenerator
_tpl: ubglAmmoTpl, _tpl: ubglAmmoTpl,
parentId: ubglMod._id, parentId: ubglMod._id,
slotId: "patron_in_weapon", slotId: "patron_in_weapon",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}); });
} }
@ -763,7 +763,7 @@ export class BotWeaponGenerator
} }
else else
{ {
camora.upd = {StackObjectsCount: 1}; camora.upd = { StackObjectsCount: 1 };
} }
} }
} }

View File

@ -97,7 +97,7 @@ export class FenceBaseAssortGenerator
_tpl: item._id, _tpl: item._id,
parentId: "hideout", parentId: "hideout",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 9999999, UnlimitedCount: true}, upd: { StackObjectsCount: 9999999, UnlimitedCount: true },
}; };
// Add item to base // Add item to base

View File

@ -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 // 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` // 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 // Iterate over all containers and add to group keyed by groupId
// Containers without a group go into a group with empty key "" // Containers without a group go into a group with empty key ""
@ -449,7 +449,7 @@ export class LocationGenerator
const rotation = result.rotation ? 1 : 0; const rotation = result.rotation ? 1 : 0;
items[0].slotId = "main"; 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 // Add loot to container before returning
for (const item of items) for (const item of items)
@ -780,13 +780,17 @@ export class LocationGenerator
? 1 ? 1
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); : 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)) else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX))
{ {
// Fill with cartrdiges // Fill with cartrdiges
const ammoBoxTemplate = this.itemHelper.getItem(chosenTpl)[1]; 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); this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, ammoBoxTemplate);
itemWithMods.push(...ammoBoxItem); itemWithMods.push(...ammoBoxItem);
} }
@ -794,7 +798,7 @@ export class LocationGenerator
{ {
// Create array with just magazine + randomised amount of cartridges // Create array with just magazine + randomised amount of cartridges
const magazineTemplate = this.itemHelper.getItem(chosenTpl)[1]; 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( this.itemHelper.fillMagazineWithRandomCartridge(
magazineItem, magazineItem,
magazineTemplate, magazineTemplate,
@ -821,7 +825,7 @@ export class LocationGenerator
// Get inventory size of item // Get inventory size of item
const size = this.itemHelper.getItemSize(itemWithMods, itemWithMods[0]._id); 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]; const itemTemplate = this.itemHelper.getItem(tpl)[1];
let width = itemTemplate._props.Width; let width = itemTemplate._props.Width;
let height = itemTemplate._props.Height; 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 // Use passed in parentId as override for new item
if (parentId) if (parentId)
@ -890,7 +894,7 @@ export class LocationGenerator
const stackCount = itemTemplate._props.StackMaxSize === 1 const stackCount = itemTemplate._props.StackMaxSize === 1
? 1 ? 1
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); : 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 // No spawn point, use default template
else if (this.itemHelper.isOfBaseclass(tpl, BaseClasses.WEAPON)) else if (this.itemHelper.isOfBaseclass(tpl, BaseClasses.WEAPON))
@ -930,7 +934,7 @@ export class LocationGenerator
if (!rootItem) if (!rootItem)
{ {
this.logger.error( 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")); 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); items.splice(items.indexOf(items[0]), 1, ...magazineWithCartridges);
} }
return {items: items, width: width, height: height}; return { items: items, width: width, height: height };
} }
} }

View File

@ -19,7 +19,7 @@ import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemSer
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil";
type ItemLimit = {current: number; max: number;}; type ItemLimit = { current: number; max: number; };
@injectable() @injectable()
export class LootGenerator export class LootGenerator
@ -131,7 +131,7 @@ export class LootGenerator
const itemTypeCounts: Record<string, ItemLimit> = {}; const itemTypeCounts: Record<string, ItemLimit> = {};
for (const itemTypeId in limits) for (const itemTypeId in limits)
{ {
itemTypeCounts[itemTypeId] = {current: 0, max: limits[itemTypeId]}; itemTypeCounts[itemTypeId] = { current: 0, max: limits[itemTypeId] };
} }
return itemTypeCounts; return itemTypeCounts;
@ -147,7 +147,7 @@ export class LootGenerator
*/ */
protected findAndAddRandomItemToLoot( protected findAndAddRandomItemToLoot(
items: [string, ITemplateItem][], items: [string, ITemplateItem][],
itemTypeCounts: Record<string, {current: number; max: number;}>, itemTypeCounts: Record<string, { current: number; max: number; }>,
options: LootRequest, options: LootRequest,
result: LootItem[], result: LootItem[],
): boolean ): boolean
@ -225,7 +225,7 @@ export class LootGenerator
*/ */
protected findAndAddRandomPresetToLoot( protected findAndAddRandomPresetToLoot(
globalDefaultPresets: [string, IPreset][], globalDefaultPresets: [string, IPreset][],
itemTypeCounts: Record<string, {current: number; max: number;}>, itemTypeCounts: Record<string, { current: number; max: number; }>,
itemBlacklist: string[], itemBlacklist: string[],
result: LootItem[], result: LootItem[],
): boolean ): boolean
@ -268,7 +268,7 @@ export class LootGenerator
return false; 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); result.push(newLootItem);
@ -505,7 +505,7 @@ export class LootGenerator
else else
{ {
// eslint-disable-next-line @typescript-eslint/naming-convention // 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 });
} }
} }
} }

View File

@ -112,8 +112,8 @@ export class PlayerScavGenerator
scavData.Info.Level = this.getScavLevel(existingScavData); scavData.Info.Level = this.getScavLevel(existingScavData);
scavData.Info.Experience = this.getScavExperience(existingScavData); scavData.Info.Experience = this.getScavExperience(existingScavData);
scavData.Quests = existingScavData.Quests ?? []; scavData.Quests = existingScavData.Quests ?? [];
scavData.ConditionCounters = existingScavData.ConditionCounters ?? {Counters: []}; scavData.ConditionCounters = existingScavData.ConditionCounters ?? { Counters: [] };
scavData.Notes = existingScavData.Notes ?? {Notes: []}; scavData.Notes = existingScavData.Notes ?? { Notes: [] };
scavData.WishList = existingScavData.WishList ?? []; scavData.WishList = existingScavData.WishList ?? [];
// Add an extra labs card to pscav backpack based on config chance // Add an extra labs card to pscav backpack based on config chance
@ -256,7 +256,7 @@ export class PlayerScavGenerator
protected getDefaultScavSkills(): Skills protected getDefaultScavSkills(): Skills
{ {
return {Common: [], Mastering: [], Points: 0}; return { Common: [], Mastering: [], Points: 0 };
} }
protected getScavStats(scavProfile: IPmcData): Stats protected getScavStats(scavProfile: IPmcData): Stats

View File

@ -135,7 +135,7 @@ export class RagfairAssortGenerator
_tpl: tplId, _tpl: tplId,
parentId: "hideout", parentId: "hideout",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 99999999, UnlimitedCount: true}, upd: { StackObjectsCount: 99999999, UnlimitedCount: true },
}; };
} }
} }

View File

@ -33,7 +33,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export class RagfairOfferGenerator export class RagfairOfferGenerator
{ {
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected allowedFleaPriceItemsForBarter: {tpl: string; price: number;}[]; protected allowedFleaPriceItemsForBarter: { tpl: string; price: number; }[];
constructor( constructor(
@inject("WinstonLogger") protected logger: ILogger, @inject("WinstonLogger") protected logger: ILogger,
@ -636,7 +636,7 @@ export class RagfairOfferGenerator
{ {
const totalCapacity = itemDetails._props.MaxResource; const totalCapacity = itemDetails._props.MaxResource;
const remainingFuel = Math.round(totalCapacity * multiplier); 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) 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) if (isMedkit && props.MaxHpResource > 0)
{ {
item.upd.MedKit = {HpResource: props.MaxHpResource}; item.upd.MedKit = { HpResource: props.MaxHpResource };
} }
if (isKey) if (isKey)
{ {
item.upd.Key = {NumberOfUsages: 0}; item.upd.Key = { NumberOfUsages: 0 };
} }
if (isConsumable) if (isConsumable)
{ {
item.upd.FoodDrink = {HpPercent: props.MaxResource}; item.upd.FoodDrink = { HpPercent: props.MaxResource };
} }
if (isRepairKit) if (isRepairKit)
{ {
item.upd.RepairKit = {Resource: props.MaxRepairResource}; item.upd.RepairKit = { Resource: props.MaxRepairResource };
} }
return item; return item;
@ -762,20 +762,20 @@ export class RagfairOfferGenerator
// Choose random item from price-filtered flea items // Choose random item from price-filtered flea items
const randomItem = this.randomUtil.getArrayValue(filtered); 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` * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter`
* @returns array with tpl/price values * @returns array with tpl/price values
*/ */
protected getFleaPricesAsArray(): {tpl: string; price: number;}[] protected getFleaPricesAsArray(): { tpl: string; price: number; }[]
{ {
// Generate if needed // Generate if needed
if (!this.allowedFleaPriceItemsForBarter) if (!this.allowedFleaPriceItemsForBarter)
{ {
const fleaPrices = this.databaseServer.getTables().templates.prices; 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 // Only get item prices for items that also exist in items.json
const filteredItems = fleaArray.filter((x) => this.itemHelper.getItem(x.tpl)[0]); 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) const price = this.ragfairPriceService.getDynamicOfferPriceForOffer(offerItems, currency, isPackOffer)
* multipler; * multipler;
return [{count: price, _tpl: currency}]; return [{ count: price, _tpl: currency }];
} }
} }

View File

@ -273,7 +273,7 @@ export class RepeatableQuestGenerator
// get all boss spawn information // get all boss spawn information
const bossSpawns = Object.values(this.databaseServer.getTables().locations).filter((x) => const bossSpawns = Object.values(this.databaseServer.getTables().locations).filter((x) =>
"base" in x && "Id" in x.base "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 // filter for the current boss to spawn on map
const thisBossSpawns = bossSpawns.map((x) => ({ const thisBossSpawns = bossSpawns.map((x) => ({
Id: x.Id, Id: x.Id,
@ -415,7 +415,7 @@ export class RepeatableQuestGenerator
protected generateEliminationLocation(location: string[]): IEliminationCondition protected generateEliminationLocation(location: string[]): IEliminationCondition
{ {
const propsObject: IEliminationCondition = { const propsObject: IEliminationCondition = {
_props: {target: location, id: this.objectId.generate(), dynamicLocale: true}, _props: { target: location, id: this.objectId.generate(), dynamicLocale: true },
_parent: "Location", _parent: "Location",
}; };
@ -461,7 +461,7 @@ export class RepeatableQuestGenerator
// Dont allow distance + melee requirement // Dont allow distance + melee requirement
if (distance && allowedWeaponCategory !== "5b5f7a0886f77409407a7f96") if (distance && allowedWeaponCategory !== "5b5f7a0886f77409407a7f96")
{ {
killConditionProps.distance = {compareMethod: ">=", value: distance}; killConditionProps.distance = { compareMethod: ">=", value: distance };
} }
// Has specific weapon requirement // Has specific weapon requirement
@ -476,7 +476,7 @@ export class RepeatableQuestGenerator
killConditionProps.weaponCategories = [allowedWeaponCategory]; killConditionProps.weaponCategories = [allowedWeaponCategory];
} }
return {_props: killConditionProps, _parent: "Kills"}; return { _props: killConditionProps, _parent: "Kills" };
} }
/** /**
@ -699,11 +699,11 @@ export class RepeatableQuestGenerator
const exitStatusCondition: IExplorationCondition = { const exitStatusCondition: IExplorationCondition = {
_parent: "ExitStatus", _parent: "ExitStatus",
_props: {id: this.objectId.generate(), dynamicLocale: true, status: ["Survived"]}, _props: { id: this.objectId.generate(), dynamicLocale: true, status: ["Survived"] },
}; };
const locationCondition: IExplorationCondition = { const locationCondition: IExplorationCondition = {
_parent: "Location", _parent: "Location",
_props: {id: this.objectId.generate(), dynamicLocale: true, target: locationTarget}, _props: { id: this.objectId.generate(), dynamicLocale: true, target: locationTarget },
}; };
quest.conditions.AvailableForFinish[0]._props.counter.id = this.objectId.generate(); quest.conditions.AvailableForFinish[0]._props.counter.id = this.objectId.generate();
@ -797,7 +797,10 @@ export class RepeatableQuestGenerator
*/ */
protected generateExplorationExitCondition(exit: Exit): IExplorationCondition 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 roublesBudget = rewardRoubles;
let chosenRewardItems = this.chooseRewardItemsWithinBudget(repeatableConfig, roublesBudget); 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) if (traderId === Traders.PEACEKEEPER)
{ {
@ -946,7 +953,7 @@ export class RepeatableQuestGenerator
// Add rep reward to rewards array // Add rep reward to rewards array
if (rewardReputation > 0) 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); rewards.Success.push(reward);
} }
@ -1010,9 +1017,9 @@ export class RepeatableQuestGenerator
protected generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward protected generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward
{ {
const id = this.objectId.generate(); 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) if (preset)
{ {

View File

@ -279,7 +279,7 @@ export class ScavCaseRewardGenerator
const result: Product[] = []; const result: Product[] = [];
for (const item of rewardItems) 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); this.addStackCountToAmmoAndMoney(item, resultItem, rarity);
@ -302,13 +302,13 @@ export class ScavCaseRewardGenerator
*/ */
protected addStackCountToAmmoAndMoney( protected addStackCountToAmmoAndMoney(
item: ITemplateItem, item: ITemplateItem,
resultItem: {_id: string; _tpl: string; upd: Upd;}, resultItem: { _id: string; _tpl: string; upd: Upd; },
rarity: string, rarity: string,
): void ): void
{ {
if (item._parent === BaseClasses.AMMO || item._parent === BaseClasses.MONEY) if (item._parent === BaseClasses.AMMO || item._parent === BaseClasses.MONEY)
{ {
resultItem.upd = {StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity)}; resultItem.upd = { StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity) };
} }
} }

View File

@ -75,7 +75,7 @@ export class AssortHelper
protected getQuestIdAndStatusThatShowAssort( protected getQuestIdAndStatusThatShowAssort(
mergedQuestAssorts: Record<string, Record<string, string>>, mergedQuestAssorts: Record<string, Record<string, string>>,
assortId: string, assortId: string,
): {questId: string; status: QuestStatus[];} ): { questId: string; status: QuestStatus[]; }
{ {
if (assortId in mergedQuestAssorts.started) if (assortId in mergedQuestAssorts.started)
{ {
@ -87,11 +87,11 @@ export class AssortHelper
} }
else if (assortId in mergedQuestAssorts.success) 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) else if (assortId in mergedQuestAssorts.fail)
{ {
return {questId: mergedQuestAssorts.fail[assortId], status: [QuestStatus.Fail]}; return { questId: mergedQuestAssorts.fail[assortId], status: [QuestStatus.Fail] };
} }
return undefined; return undefined;

View File

@ -46,7 +46,7 @@ export class BotGeneratorHelper
* @param botRole Used by weapons to randomize the durability values. Null for non-equipped items * @param botRole Used by weapons to randomize the durability values. Null for non-equipped items
* @returns Item Upd object with extra properties * @returns Item Upd object with extra properties
*/ */
public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): {upd?: Upd;} public generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }
{ {
// Get raid settings, if no raid, default to day // Get raid settings, if no raid, default to day
const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue< const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue<
@ -70,23 +70,23 @@ export class BotGeneratorHelper
if (itemTemplate._props.HasHinge) if (itemTemplate._props.HasHinge)
{ {
itemProperties.Togglable = {On: true}; itemProperties.Togglable = { On: true };
} }
if (itemTemplate._props.Foldable) if (itemTemplate._props.Foldable)
{ {
itemProperties.Foldable = {Folded: false}; itemProperties.Foldable = { Folded: false };
} }
if (itemTemplate._props.weapFireType?.length) if (itemTemplate._props.weapFireType?.length)
{ {
if (itemTemplate._props.weapFireType.includes("fullauto")) if (itemTemplate._props.weapFireType.includes("fullauto"))
{ {
itemProperties.FireMode = {FireMode: "fullauto"}; itemProperties.FireMode = { FireMode: "fullauto" };
} }
else 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 const lightLaserActiveChance = raidIsNight
? this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50) ? this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50)
: this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveDayChancePercent", 25); : 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) else if (itemTemplate._parent === BaseClasses.TACTICAL_COMBO)
{ {
@ -126,7 +129,10 @@ export class BotGeneratorHelper
"laserIsActiveChancePercent", "laserIsActiveChancePercent",
50, 50,
); );
itemProperties.Light = {IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0}; itemProperties.Light = {
IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)),
SelectedMode: 0,
};
} }
if (itemTemplate._parent === BaseClasses.NIGHTVISION) if (itemTemplate._parent === BaseClasses.NIGHTVISION)
@ -135,7 +141,7 @@ export class BotGeneratorHelper
const nvgActiveChance = raidIsNight const nvgActiveChance = raidIsNight
? this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceNightPercent", 90) ? this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceNightPercent", 90)
: this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceDayPercent", 15); : this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceDayPercent", 15);
itemProperties.Togglable = {On: (this.randomUtil.getChance100(nvgActiveChance))}; itemProperties.Togglable = { On: (this.randomUtil.getChance100(nvgActiveChance)) };
} }
// Togglable face shield // Togglable face shield
@ -147,10 +153,10 @@ export class BotGeneratorHelper
"faceShieldIsActiveChancePercent", "faceShieldIsActiveChancePercent",
75, 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, 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[], items: Item[],
tplToCheck: string, tplToCheck: string,
equipmentSlot: string, equipmentSlot: string,
): {incompatible: boolean; reason: string;} ): { incompatible: boolean; reason: string; }
{ {
// Skip slots that have no incompatibilities // Skip slots that have no incompatibilities
if (["Scabbard", "Backpack", "SecureContainer", "Holster", "ArmBand"].includes(equipmentSlot)) 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 // 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: "" };
} }
/** /**

View File

@ -96,7 +96,7 @@ export class BotWeaponGeneratorHelper
*/ */
public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[] 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); this.itemHelper.fillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1);
@ -120,7 +120,7 @@ export class BotWeaponGeneratorHelper
const ammoItems = this.itemHelper.splitStack({ const ammoItems = this.itemHelper.splitStack({
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: ammoTpl, _tpl: ammoTpl,
upd: {StackObjectsCount: cartridgeCount}, upd: { StackObjectsCount: cartridgeCount },
}); });
for (const ammoItem of ammoItems) for (const ammoItem of ammoItems)

View File

@ -39,7 +39,7 @@ export class DialogueHelper
*/ */
public createMessageContext(templateId: string, messageType: MessageType, maxStoreTime = null): MessageContent 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) if (maxStoreTime)
{ {
@ -66,7 +66,7 @@ export class DialogueHelper
if (isNewDialogue) 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; dialogueData[dialogueID] = dialogue;
} }
@ -79,7 +79,7 @@ export class DialogueHelper
if (rewards.length > 0) if (rewards.length > 0)
{ {
const stashId = this.hashUtil.generate(); const stashId = this.hashUtil.generate();
items = {stash: stashId, data: []}; items = { stash: stashId, data: [] };
rewards = this.itemHelper.replaceIDs(null, rewards); rewards = this.itemHelper.replaceIDs(null, rewards);
for (const reward of rewards) for (const reward of rewards)

View File

@ -38,7 +38,7 @@ export class HealthHelper
if (!profile.vitality) if (!profile.vitality)
{ // Occurs on newly created profiles { // Occurs on newly created profiles
profile.vitality = {health: null, effects: null}; profile.vitality = { health: null, effects: null };
} }
profile.vitality.health = { profile.vitality.health = {
Hydration: 0, Hydration: 0,
@ -255,7 +255,7 @@ export class HealthHelper
profileBodyPart.Effects = {}; profileBodyPart.Effects = {};
} }
profileBodyPart.Effects[effectType] = {Time: duration}; profileBodyPart.Effects[effectType] = { Time: duration };
// Delete empty property to prevent client bugs // Delete empty property to prevent client bugs
if (this.isEmpty(profileBodyPart.Effects)) if (this.isEmpty(profileBodyPart.Effects))
@ -264,7 +264,7 @@ export class HealthHelper
} }
} }
protected isEmpty(map: Record<string, {Time: number;}>): boolean protected isEmpty(map: Record<string, { Time: number; }>): boolean
{ {
for (const key in map) for (const key in map)
{ {

View File

@ -187,7 +187,7 @@ export class HideoutHelper
*/ */
protected getHideoutProperties( protected getHideoutProperties(
pmcData: IPmcData, 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 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 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( protected updateWaterCollectorProductionTimer(
pmcData: IPmcData, pmcData: IPmcData,
productionId: string, productionId: string,
hideoutProperties: {btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;}, hideoutProperties: { btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; },
): void ): void
{ {
const timeElapsed = this.getTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.isGeneratorOn); const timeElapsed = this.getTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.isGeneratorOn);
@ -241,7 +241,7 @@ export class HideoutHelper
*/ */
protected updateProductionTimers( protected updateProductionTimers(
pmcData: IPmcData, pmcData: IPmcData,
hideoutProperties: {btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;}, hideoutProperties: { btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; },
): void ): void
{ {
const recipes = this.databaseServer.getTables().hideout.production; const recipes = this.databaseServer.getTables().hideout.production;
@ -310,7 +310,7 @@ export class HideoutHelper
pmcData: IPmcData, pmcData: IPmcData,
prodId: string, prodId: string,
recipe: IHideoutProduction, recipe: IHideoutProduction,
hideoutProperties: {btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter?: boolean;}, hideoutProperties: { btcFarmCGs?: number; isGeneratorOn: boolean; waterCollectorHasFilter?: boolean; },
): void ): void
{ {
// Production is complete, no need to do any calculations // Production is complete, no need to do any calculations
@ -367,7 +367,7 @@ export class HideoutHelper
protected updateAreasWithResources( protected updateAreasWithResources(
sessionID: string, sessionID: string,
pmcData: IPmcData, pmcData: IPmcData,
hideoutProperties: {btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean;}, hideoutProperties: { btcFarmCGs: number; isGeneratorOn: boolean; waterCollectorHasFilter: boolean; },
): void ): void
{ {
for (const area of pmcData.Hideout.Areas) for (const area of pmcData.Hideout.Areas)
@ -651,7 +651,10 @@ export class HideoutHelper
*/ */
protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd 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 protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void
@ -699,7 +702,7 @@ export class HideoutHelper
{ {
airFilterArea.slots[i].item[0].upd = { airFilterArea.slots[i].item[0].upd = {
StackObjectsCount: 1, StackObjectsCount: 1,
Resource: {Value: resourceValue, UnitsConsumed: pointsConsumed}, Resource: { Value: resourceValue, UnitsConsumed: pointsConsumed },
}; };
this.logger.debug(`Air filter: ${resourceValue} filter left on slot ${i + 1}`); this.logger.debug(`Air filter: ${resourceValue} filter left on slot ${i + 1}`);
break; // Break here to avoid updating all filters break; // Break here to avoid updating all filters
@ -806,7 +809,7 @@ export class HideoutHelper
btcProd.Products.push({ btcProd.Products.push({
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: "59faff1d86f7746c51718c9c", _tpl: "59faff1d86f7746c51718c9c",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}); });
btcProd.Progress -= coinCraftTimeSeconds; btcProd.Progress -= coinCraftTimeSeconds;

View File

@ -58,7 +58,7 @@ export class HttpServerHelper
public sendTextJson(resp: any, output: any): void public sendTextJson(resp: any, output: any): void
{ {
// eslint-disable-next-line @typescript-eslint/naming-convention // 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); resp.end(output);
} }
} }

View File

@ -294,7 +294,7 @@ export class InRaidHelper
} }
// Add effect to server profile // Add effect to server profile
profileBodyPartEffects[effect] = {Time: effectDetails.Time ?? -1}; profileBodyPartEffects[effect] = { Time: effectDetails.Time ?? -1 };
} }
} }
} }

View File

@ -103,7 +103,7 @@ export class InventoryHelper
} }
else if (this.paymentHelper.isMoneyTpl(requestItem.item_id)) 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) else if (request.tid === Traders.FENCE)
{ {
@ -125,7 +125,7 @@ export class InventoryHelper
} }
else if (request.tid === "RandomLootContainer") 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 else
{ {
@ -185,7 +185,7 @@ export class InventoryHelper
{ {
let idForItemToAdd = this.hashUtil.generate(); let idForItemToAdd = this.hashUtil.generate();
const toDo: string[][] = [[itemToAdd.itemRef._id, idForItemToAdd]]; // WHAT IS THIS?! 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 item being added is preset, load preset's upd data too.
if (itemToAdd.isPreset) if (itemToAdd.isPreset)
@ -213,7 +213,7 @@ export class InventoryHelper
// add ragfair upd properties // add ragfair upd properties
if (addUpd) if (addUpd)
{ {
upd = {...addUpd, ...upd}; upd = { ...addUpd, ...upd };
} }
// Hideout items need to be marked as found in raid // Hideout items need to be marked as found in raid
@ -244,7 +244,7 @@ export class InventoryHelper
_tpl: itemToAdd.itemRef._tpl, _tpl: itemToAdd.itemRef._tpl,
parentId: itemToAdd.containerId, parentId: itemToAdd.containerId,
slotId: "hideout", 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), upd: this.jsonUtil.clone(upd),
}); });
@ -253,7 +253,7 @@ export class InventoryHelper
_tpl: itemToAdd.itemRef._tpl, _tpl: itemToAdd.itemRef._tpl,
parentId: itemToAdd.containerId, parentId: itemToAdd.containerId,
slotId: "hideout", 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 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 its from ItemPreset, load preset's upd data too.
if (itemToAdd.isPreset) if (itemToAdd.isPreset)
{ {
upd = {StackObjectsCount: itemToAdd.count}; upd = { StackObjectsCount: itemToAdd.count };
for (const updID in itemLib[tmpKey].upd) for (const updID in itemLib[tmpKey].upd)
{ {
@ -297,7 +297,7 @@ export class InventoryHelper
_tpl: itemLib[tmpKey]._tpl, _tpl: itemLib[tmpKey]._tpl,
parentId: toDo[0][1], parentId: toDo[0][1],
slotId: slotID, 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), upd: this.jsonUtil.clone(upd),
}); });
@ -306,7 +306,7 @@ export class InventoryHelper
_tpl: itemLib[tmpKey]._tpl, _tpl: itemLib[tmpKey]._tpl,
parentId: toDo[0][1], parentId: toDo[0][1],
slotId: itemLib[tmpKey].slotId, 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), upd: this.jsonUtil.clone(upd),
}); });
} }
@ -506,7 +506,7 @@ export class InventoryHelper
parentId: parentId, parentId: parentId,
slotId: "cartridges", slotId: "cartridges",
location: location, location: location,
upd: {StackObjectsCount: ammoStackSize}, upd: { StackObjectsCount: ammoStackSize },
}; };
if (foundInRaid) if (foundInRaid)
@ -622,7 +622,7 @@ export class InventoryHelper
// We have output object, inform client of item deletion // We have output object, inform client of item deletion
if (output) if (output)
{ {
output.profileChanges[sessionID].items.del.push({_id: itemId}); output.profileChanges[sessionID].items.del.push({ _id: itemId });
} }
for (const childId of itemToRemoveWithChildren) for (const childId of itemToRemoveWithChildren)
@ -885,7 +885,7 @@ export class InventoryHelper
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash
{ {
const inventoryItemHash: InventoryHelper.InventoryItemHash = {byItemId: {}, byParentId: {}}; const inventoryItemHash: InventoryHelper.InventoryItemHash = { byItemId: {}, byParentId: {} };
for (const item of inventoryItem) for (const item of inventoryItem)
{ {
@ -1144,7 +1144,7 @@ export class InventoryHelper
pmcData: IPmcData, pmcData: IPmcData,
inventoryItems: Item[], inventoryItems: Item[],
moveRequest: IInventoryMoveRequestData, moveRequest: IInventoryMoveRequestData,
): {success: boolean; errorMessage?: string;} ): { success: boolean; errorMessage?: string; }
{ {
this.handleCartridges(inventoryItems, moveRequest); this.handleCartridges(inventoryItems, moveRequest);
@ -1155,7 +1155,7 @@ export class InventoryHelper
const errorMesage = `Unable to move item: ${moveRequest.item}, cannot find in inventory`; const errorMesage = `Unable to move item: ${moveRequest.item}, cannot find in inventory`;
this.logger.error(errorMesage); this.logger.error(errorMesage);
return {success: false, errorMessage: errorMesage}; return { success: false, errorMessage: errorMesage };
} }
this.logger.debug( this.logger.debug(
@ -1172,7 +1172,7 @@ export class InventoryHelper
}), }),
); );
return {success: true}; return { success: true };
} }
// Edit items details to match its new location // Edit items details to match its new location
@ -1193,7 +1193,7 @@ export class InventoryHelper
} }
} }
return {success: true}; return { success: true };
} }
/** /**

View File

@ -176,7 +176,7 @@ class ItemHelper
{ {
if (item.upd === undefined) if (item.upd === undefined)
{ {
item.upd = {StackObjectsCount: 1}; item.upd = { StackObjectsCount: 1 };
} }
if (item.upd.StackObjectsCount === undefined) if (item.upd.StackObjectsCount === undefined)
@ -241,7 +241,7 @@ class ItemHelper
parentId: parentId, parentId: parentId,
slotId: slotId, slotId: slotId,
location: 0, location: 0,
upd: {StackObjectsCount: count}, upd: { StackObjectsCount: count },
}; };
stackSlotItems.push(stackSlotItem); stackSlotItems.push(stackSlotItem);
} }
@ -1113,7 +1113,7 @@ class ItemHelper
parentId: parentId, parentId: parentId,
slotId: "cartridges", slotId: "cartridges",
location: location, location: location,
upd: {StackObjectsCount: stackCount}, upd: { StackObjectsCount: stackCount },
}; };
} }

View File

@ -10,7 +10,7 @@ export class NotifierHelper
/** /**
* The default notification sent when waiting times out. * The default notification sent when waiting times out.
*/ */
protected defaultNotification: INotification = {type: NotificationType.PING, eventId: "ping"}; protected defaultNotification: INotification = { type: NotificationType.PING, eventId: "ping" };
constructor(@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper) constructor(@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper)
{} {}

View File

@ -217,7 +217,7 @@ export class ProfileHelper
public getDefaultAkiDataObject(): any public getDefaultAkiDataObject(): any
{ {
return {version: this.getServerVersion()}; return { version: this.getServerVersion() };
} }
public getFullProfile(sessionID: string): IAkiProfile public getFullProfile(sessionID: string): IAkiProfile
@ -255,14 +255,14 @@ export class ProfileHelper
return { return {
Eft: { Eft: {
CarriedQuestItems: [], CarriedQuestItems: [],
DamageHistory: {LethalDamagePart: "Head", LethalDamage: undefined, BodyParts: <any>[]}, DamageHistory: { LethalDamagePart: "Head", LethalDamage: undefined, BodyParts: <any>[] },
DroppedItems: [], DroppedItems: [],
ExperienceBonusMult: 0, ExperienceBonusMult: 0,
FoundInRaidItems: [], FoundInRaidItems: [],
LastPlayerState: undefined, LastPlayerState: undefined,
LastSessionDate: 0, LastSessionDate: 0,
OverallCounters: {Items: []}, OverallCounters: { Items: [] },
SessionCounters: {Items: []}, SessionCounters: { Items: [] },
SessionExperienceMult: 0, SessionExperienceMult: 0,
SurvivorClass: "Unknown", SurvivorClass: "Unknown",
TotalInGameTime: 0, TotalInGameTime: 0,
@ -321,7 +321,7 @@ export class ProfileHelper
profileToUpdate.aki.receivedGifts = []; profileToUpdate.aki.receivedGifts = [];
} }
profileToUpdate.aki.receivedGifts.push({giftId: giftId, timestampAccepted: this.timeUtil.getTimestamp()}); profileToUpdate.aki.receivedGifts.push({ giftId: giftId, timestampAccepted: this.timeUtil.getTimestamp() });
} }
/** /**

View File

@ -551,7 +551,7 @@ export class QuestHelper
{ {
// this case is probably dead Code right now, since the only calling function // this case is probably dead Code right now, since the only calling function
// checks explicitly for Value > 0. // 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); pmcData.Inventory.items.splice(inventoryItemIndex, 1);
} }
} }
@ -574,7 +574,7 @@ export class QuestHelper
parentId: item.parentId, parentId: item.parentId,
slotId: item.slotId, slotId: item.slotId,
location: item.location, location: item.location,
upd: {StackObjectsCount: item.upd.StackObjectsCount}, upd: { StackObjectsCount: item.upd.StackObjectsCount },
}); });
} }

View File

@ -432,7 +432,7 @@ export class RagfairOfferHelper
const requestedItem: Item = { const requestedItem: Item = {
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: requirement._tpl, _tpl: requirement._tpl,
upd: {StackObjectsCount: requirement.count * boughtAmount}, upd: { StackObjectsCount: requirement.count * boughtAmount },
}; };
const stacks = this.itemHelper.splitStack(requestedItem); const stacks = this.itemHelper.splitStack(requestedItem);

View File

@ -112,7 +112,7 @@ export class RagfairSellHelper
this.ragfairConfig.sell.time.min * 60, 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")}`); this.logger.debug(`Offer will sell at: ${new Date(sellTime * 1000).toLocaleTimeString("en-US")}`);
} }

View File

@ -68,7 +68,7 @@ export class RepairHelper
} }
// Construct object to return // 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 // 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 // the code below generates a random degradation on the weapon durability

View File

@ -26,7 +26,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export class TraderAssortHelper export class TraderAssortHelper
{ {
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
protected mergedQuestAssorts: Record<string, Record<string, string>> = {started: {}, success: {}, fail: {}}; protected mergedQuestAssorts: Record<string, Record<string, string>> = { started: {}, success: {}, fail: {} };
protected createdMergedQuestAssorts = false; protected createdMergedQuestAssorts = false;
constructor( constructor(

View File

@ -268,7 +268,7 @@ export class TraderHelper
}), }),
); );
this.traderConfig.updateTime.push( // create temporary entry to prevent logger spam this.traderConfig.updateTime.push( // create temporary entry to prevent logger spam
{traderId: traderId, seconds: this.traderConfig.updateTimeDefault}, { traderId: traderId, seconds: this.traderConfig.updateTimeDefault },
); );
} }
else else
@ -303,7 +303,7 @@ export class TraderHelper
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
public addTraderPurchasesToPlayerProfile( public addTraderPurchasesToPlayerProfile(
sessionID: string, sessionID: string,
newPurchaseDetails: {items: {item_id: string; count: number;}[]; tid: string;}, newPurchaseDetails: { items: { item_id: string; count: number; }[]; tid: string; },
): void ): void
{ {
const profile = this.profileHelper.getFullProfile(sessionID); const profile = this.profileHelper.getFullProfile(sessionID);

View File

@ -9,7 +9,7 @@ export class WeightedRandomHelper
* @param {tplId: weighting[]} itemArray * @param {tplId: weighting[]} itemArray
* @returns tplId * @returns tplId
*/ */
public getWeightedInventoryItem(itemArray: {[tplId: string]: unknown;} | ArrayLike<unknown>): string public getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike<unknown>): string
{ {
const itemKeys = Object.keys(itemArray); const itemKeys = Object.keys(itemArray);
const weights = Object.values(itemArray); const weights = Object.values(itemArray);
@ -18,7 +18,7 @@ export class WeightedRandomHelper
return chosenItem.item; return chosenItem.item;
} }
public getWeightedValue<T>(itemArray: {[key: string]: unknown;} | ArrayLike<unknown>): T public getWeightedValue<T>(itemArray: { [key: string]: unknown; } | ArrayLike<unknown>): T
{ {
const itemKeys = Object.keys(itemArray); const itemKeys = Object.keys(itemArray);
const weights = Object.values(itemArray); const weights = Object.values(itemArray);
@ -41,7 +41,7 @@ export class WeightedRandomHelper
* @param {number[]} weights * @param {number[]} weights
* @returns {{item: any, index: number}} * @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) if (items.length !== weights.length)
{ {
@ -77,7 +77,7 @@ export class WeightedRandomHelper
{ {
if (cumulativeWeights[itemIndex] >= randomNumber) if (cumulativeWeights[itemIndex] >= randomNumber)
{ {
return {item: items[itemIndex], index: itemIndex}; return { item: items[itemIndex], index: itemIndex };
} }
} }
} }

View File

@ -139,11 +139,11 @@ export class PreAkiModLoader implements IModLoader
this.logger.info(this.localisationService.getText("modloader-mod_order_missing")); this.logger.info(this.localisationService.getText("modloader-mod_order_missing"));
// Write file with empty order array to disk // 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 else
{ {
const modOrder = this.vfs.readFile(this.modOrderPath, {encoding: "utf8"}); const modOrder = this.vfs.readFile(this.modOrderPath, { encoding: "utf8" });
try try
{ {
for (const [index, mod] of (this.jsonUtil.deserialize<any>(modOrder).order as string[]).entries()) for (const [index, mod] of (this.jsonUtil.deserialize<any>(modOrder).order as string[]).entries())
@ -225,7 +225,7 @@ export class PreAkiModLoader implements IModLoader
if (this.shouldSkipMod(pkg)) 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; continue;
} }
@ -473,7 +473,7 @@ export class PreAkiModLoader implements IModLoader
pkg.scripts = {}; pkg.scripts = {};
// Add mod to imported list // Add mod to imported list
this.imported[mod] = {...pkg, dependencies: pkg.modDependencies}; this.imported[mod] = { ...pkg, dependencies: pkg.modDependencies };
this.logger.info( this.logger.info(
this.localisationService.getText("modloader-loaded_mod", { this.localisationService.getText("modloader-loaded_mod", {
name: pkg.name, name: pkg.name,
@ -557,7 +557,7 @@ export class PreAkiModLoader implements IModLoader
); );
let command = `${pnpmPath} install `; let command = `${pnpmPath} install `;
command += dependenciesToInstall.map(([depName, depVersion]) => `${depName}@${depVersion}`).join(" "); 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 // Delete the new blank package.json then rename the backup back to the original name
this.vfs.removeFile(`${modPath}/package.json`); this.vfs.removeFile(`${modPath}/package.json`);

View File

@ -13,7 +13,7 @@ export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) =
*/ */
export const Listen = (basePath: string) => export const Listen = (basePath: string) =>
{ {
return <T extends {new(...args: any[]): any;}>(Base: T): T => return <T extends { new(...args: any[]): any; }>(Base: T): T =>
{ {
// Used for the base class to be able to use DI // Used for the base class to be able to use DI
injectable()(Base); injectable()(Base);
@ -35,7 +35,7 @@ export const Listen = (basePath: string) =>
} }
// Add each flagged handler to the Record // 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]) if (!this.handlers[httpMethod])
{ {
@ -111,7 +111,7 @@ const createHttpDecorator = (httpMethod: HttpMethods) =>
} }
// Flag the method as a HTTP handler // Flag the method as a HTTP handler
target.handlers.push({handlerName: propertyKey, path, httpMethod}); target.handlers.push({ handlerName: propertyKey, path, httpMethod });
}; };
}; };
}; };

View File

@ -24,7 +24,7 @@ import { ISettingsBase } from "@spt-aki/models/spt/server/ISettingsBase";
export interface IDatabaseTables export interface IDatabaseTables
{ {
bots?: {types: Record<string, IBotType>; base: IBotBase; core: IBotCore;}; bots?: { types: Record<string, IBotType>; base: IBotBase; core: IBotCore; };
hideout?: { hideout?: {
areas: IHideoutArea[]; areas: IHideoutArea[];
production: IHideoutProduction[]; production: IHideoutProduction[];

View File

@ -12,7 +12,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export class EventOutputHolder export class EventOutputHolder
{ {
/** What has client been informed of this game session */ /** What has client been informed of this game session */
protected clientActiveSessionStorage: Record<string, {clientInformed: boolean;}> = {}; protected clientActiveSessionStorage: Record<string, { clientInformed: boolean; }> = {};
constructor( constructor(
@inject("JsonUtil") protected jsonUtil: JsonUtil, @inject("JsonUtil") protected jsonUtil: JsonUtil,
@ -22,7 +22,7 @@ export class EventOutputHolder
{} {}
// TODO REMEMBER TO CHANGE OUTPUT // TODO REMEMBER TO CHANGE OUTPUT
protected output: IItemEventRouterResponse = {warnings: [], profileChanges: {}}; protected output: IItemEventRouterResponse = { warnings: [], profileChanges: {} };
public getOutput(sessionID: string): IItemEventRouterResponse public getOutput(sessionID: string): IItemEventRouterResponse
{ {
@ -51,10 +51,10 @@ export class EventOutputHolder
ragFairOffers: [], ragFairOffers: [],
weaponBuilds: [], weaponBuilds: [],
equipmentBuilds: [], equipmentBuilds: [],
items: {new: [], change: [], del: []}, items: { new: [], change: [], del: [] },
production: {}, production: {},
improvements: {}, improvements: {},
skills: {Common: [], Mastering: [], Points: 0}, skills: { Common: [], Mastering: [], Points: 0 },
health: this.jsonUtil.clone(pmcData.Health), health: this.jsonUtil.clone(pmcData.Health),
traderRelations: {}, traderRelations: {},
// changedHideoutStashes: {}, // changedHideoutStashes: {},
@ -170,7 +170,7 @@ export class EventOutputHolder
// Flag started craft as having been seen by client // Flag started craft as having been seen by client
if (production.Progress > 0 && !this.clientActiveSessionStorage[productionKey]?.clientInformed) if (production.Progress > 0 && !this.clientActiveSessionStorage[productionKey]?.clientInformed)
{ {
this.clientActiveSessionStorage[productionKey] = {clientInformed: true}; this.clientActiveSessionStorage[productionKey] = { clientInformed: true };
} }
} }

View File

@ -15,7 +15,7 @@ export class HealthSaveLoadRouter extends SaveLoadRouter
{ {
if (!profile.vitality) if (!profile.vitality)
{ // Occurs on newly created profiles { // Occurs on newly created profiles
profile.vitality = {health: null, effects: null}; profile.vitality = { health: null, effects: null };
} }
profile.vitality.health = { profile.vitality.health = {
Hydration: 0, Hydration: 0,

View File

@ -15,7 +15,7 @@ export class InraidSaveLoadRouter extends SaveLoadRouter
{ {
if (profile.inraid === undefined) if (profile.inraid === undefined)
{ {
profile.inraid = {location: "none", character: "none"}; profile.inraid = { location: "none", character: "none" };
} }
return profile; return profile;

View File

@ -16,7 +16,7 @@ export class ProfileSaveLoadRouter extends SaveLoadRouter
{ {
if (profile.characters === null) if (profile.characters === null)
{ {
profile.characters = {pmc: {} as IPmcData, scav: {} as IPmcData}; profile.characters = { pmc: {} as IPmcData, scav: {} as IPmcData };
} }
return profile; return profile;
} }

View File

@ -142,7 +142,7 @@ export class SaveServer
throw new Error(`profile already exists for sessionId: ${profileInfo.id}`); 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) 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; this.profiles[sessionID] = previous;
} }
} }

View File

@ -28,14 +28,14 @@ export class WebSocketServer
} }
protected httpConfig: IHttpConfig; protected httpConfig: IHttpConfig;
protected defaultNotification: INotification = {type: NotificationType.PING, eventId: "ping"}; protected defaultNotification: INotification = { type: NotificationType.PING, eventId: "ping" };
protected webSockets: Record<string, WebSocket.WebSocket> = {}; protected webSockets: Record<string, WebSocket.WebSocket> = {};
protected websocketPingHandler = null; protected websocketPingHandler = null;
public setupWebSocket(httpServer: http.Server): void public setupWebSocket(httpServer: http.Server): void
{ {
const webSocketServer = new WebSocket.Server({server: httpServer}); const webSocketServer = new WebSocket.Server({ server: httpServer });
webSocketServer.addListener("listening", () => webSocketServer.addListener("listening", () =>
{ {

View File

@ -168,14 +168,14 @@ export class AkiHttpListener implements IHttpListener
public sendJson(resp: ServerResponse, output: string, sessionID: string): void public sendJson(resp: ServerResponse, output: string, sessionID: string): void
{ {
// eslint-disable-next-line @typescript-eslint/naming-convention // 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); resp.end(output);
} }
public sendZlibJson(resp: ServerResponse, output: string, sessionID: string): void public sendZlibJson(resp: ServerResponse, output: string, sessionID: string): void
{ {
// eslint-disable-next-line @typescript-eslint/naming-convention // 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)); zlib.deflate(output, (_, buf) => resp.end(buf));
} }
} }

View File

@ -46,7 +46,7 @@ export class BotWeaponModLimitService
public getWeaponModLimits(botRole: string): BotModLimits public getWeaponModLimits(botRole: string): BotModLimits
{ {
return { return {
scope: {count: 0}, scope: { count: 0 },
scopeMax: this.botConfig.equipment[botRole]?.weaponModLimits?.scopeLimit, scopeMax: this.botConfig.equipment[botRole]?.weaponModLimits?.scopeLimit,
scopeBaseTypes: [ scopeBaseTypes: [
BaseClasses.OPTIC_SCOPE, BaseClasses.OPTIC_SCOPE,
@ -55,7 +55,7 @@ export class BotWeaponModLimitService
BaseClasses.COMPACT_COLLIMATOR, BaseClasses.COMPACT_COLLIMATOR,
BaseClasses.SPECIAL_SCOPE, BaseClasses.SPECIAL_SCOPE,
], ],
flashlightLaser: {count: 0}, flashlightLaser: { count: 0 },
flashlightLaserMax: this.botConfig.equipment[botRole]?.weaponModLimits?.lightLaserLimit, flashlightLaserMax: this.botConfig.equipment[botRole]?.weaponModLimits?.lightLaserLimit,
flashlgihtLaserBaseTypes: [ flashlgihtLaserBaseTypes: [
BaseClasses.TACTICAL_COMBO, BaseClasses.TACTICAL_COMBO,
@ -166,7 +166,7 @@ export class BotWeaponModLimitService
*/ */
protected weaponModLimitReached( protected weaponModLimitReached(
modTpl: string, modTpl: string,
currentCount: {count: number;}, currentCount: { count: number; },
maxLimit: number, maxLimit: number,
botRole: string, botRole: string,
): boolean ): boolean

View File

@ -421,7 +421,7 @@ export class FenceService
fenceAssortIds: string[], fenceAssortIds: string[],
assorts: ITraderAssort, assorts: ITraderAssort,
fenceAssort: ITraderAssort, fenceAssort: ITraderAssort,
itemTypeCounts: Record<string, {current: number; max: number;}>, itemTypeCounts: Record<string, { current: number; max: number; }>,
loyaltyLevel: number, loyaltyLevel: number,
): void ): void
{ {
@ -585,7 +585,7 @@ export class FenceService
// Multiply weapon+mods rouble price by multipler in config // Multiply weapon+mods rouble price by multipler in config
assorts.barter_scheme[weaponAndMods[0]._id] = [[]]; 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; assorts.loyal_level_items[weaponAndMods[0]._id] = loyaltyLevel;
@ -675,7 +675,7 @@ export class FenceService
// Randomise hp resource of med items // Randomise hp resource of med items
if ("MaxHpResource" in itemDetails._props && itemDetails._props.MaxHpResource > 0) 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 // Randomise armor durability
@ -694,7 +694,7 @@ export class FenceService
const maxDurability = this.randomUtil.getInt(duraMin, duraMax); const maxDurability = this.randomUtil.getInt(duraMin, duraMax);
const durability = this.randomUtil.getInt(1, maxDurability); const durability = this.randomUtil.getInt(1, maxDurability);
itemToAdjust.upd.Repairable = {Durability: durability, MaxDurability: maxDurability}; itemToAdjust.upd.Repairable = { Durability: durability, MaxDurability: maxDurability };
return; return;
} }
@ -709,14 +709,14 @@ export class FenceService
const maxDurability = this.randomUtil.getInt(duraMin, duraMax); const maxDurability = this.randomUtil.getInt(duraMin, duraMax);
const durability = this.randomUtil.getInt(1, maxDurability); const durability = this.randomUtil.getInt(1, maxDurability);
itemToAdjust.upd.Repairable = {Durability: durability, MaxDurability: maxDurability}; itemToAdjust.upd.Repairable = { Durability: durability, MaxDurability: maxDurability };
return; return;
} }
if (this.itemHelper.isOfBaseclass(itemDetails._id, BaseClasses.REPAIR_KITS)) 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; return;
} }
@ -740,7 +740,7 @@ export class FenceService
const resourceMax = itemDetails._props.MaxResource; const resourceMax = itemDetails._props.MaxResource;
const resourceCurrent = this.randomUtil.getInt(1, 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 * @param limits limits as defined in config
* @returns record, key: item tplId, value: current/max item count allowed * @returns record, key: item tplId, value: current/max item count allowed
*/ */
protected initItemLimitCounter(limits: Record<string, number>): Record<string, {current: number; max: number;}> protected initItemLimitCounter(limits: Record<string, number>): Record<string, { current: number; max: number; }>
{ {
const itemTypeCounts: Record<string, {current: number; max: number;}> = {}; const itemTypeCounts: Record<string, { current: number; max: number; }> = {};
for (const x in limits) for (const x in limits)
{ {
itemTypeCounts[x] = {current: 0, max: limits[x]}; itemTypeCounts[x] = { current: 0, max: limits[x] };
} }
return itemTypeCounts; return itemTypeCounts;

View File

@ -133,7 +133,7 @@ export class GiftService
const details: ISendMessageDetails = { const details: ISendMessageDetails = {
recipientId: playerId, recipientId: playerId,
sender: this.getMessageType(giftData), sender: this.getMessageType(giftData),
senderDetails: {_id: this.getSenderId(giftData), info: null}, senderDetails: { _id: this.getSenderId(giftData), info: null },
messageText: giftData.messageText, messageText: giftData.messageText,
items: giftData.items, items: giftData.items,
itemsMaxStorageLifetimeSeconds: this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours), itemsMaxStorageLifetimeSeconds: this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours),

View File

@ -158,7 +158,7 @@ export class InsuranceService
randomResponseId, randomResponseId,
[], [],
null, null,
{location: locationName}, { location: locationName },
); );
} }
@ -334,7 +334,7 @@ export class InsuranceService
// Item didnt have faceshield object pre-raid, add it // Item didnt have faceshield object pre-raid, add it
if (!itemToReturn.upd.FaceShield) if (!itemToReturn.upd.FaceShield)
{ {
itemToReturn.upd.FaceShield = {Hits: insuredItemFromClient.hits}; itemToReturn.upd.FaceShield = { Hits: insuredItemFromClient.hits };
} }
else else
{ {
@ -391,7 +391,7 @@ export class InsuranceService
* @param traderId Id of trader item was insured with * @param traderId Id of trader item was insured with
*/ */
protected addGearToSend( protected addGearToSend(
gear: {sessionID: string; pmcData: IPmcData; itemToReturnToPlayer: Item; traderId: string;}, gear: { sessionID: string; pmcData: IPmcData; itemToReturnToPlayer: Item; traderId: string; },
): void ): void
{ {
const sessionId = gear.sessionID; const sessionId = gear.sessionID;

View File

@ -420,7 +420,7 @@ export class MailSendService
parentItem.parentId = this.hashUtil.generate(); 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 // Ensure Ids are unique and cont collide with items in player inventory later
messageDetails.items = this.itemHelper.replaceIDs(null, messageDetails.items); messageDetails.items = this.itemHelper.replaceIDs(null, messageDetails.items);

View File

@ -109,7 +109,7 @@ export class ModCompilerService
replacedText = text.replace(/(@spt-aki)/g, path.join(__dirname, "..").replace(/\\/g, "/")); 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) if (output.sourceMapText)
{ {

View File

@ -49,7 +49,7 @@ export class PaymentService
const trader = this.traderHelper.getTrader(request.tid, sessionID); const trader = this.traderHelper.getTrader(request.tid, sessionID);
// Track the amounts of each type of currency involved in the trade. // 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". // Delete barter items and track currencies if the action is "TradingConfirm".
if (request.Action === "TradingConfirm") if (request.Action === "TradingConfirm")

View File

@ -26,7 +26,7 @@ export class PlayerService
{ {
let accExp = 0; 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; accExp += exp;

View File

@ -196,7 +196,7 @@ export class ProfileFixerService
} }
else else
{ {
pmcProfile.Inventory.items.push({_id: hideoutStandAreaDb._id, _tpl: stageCurrentAt.container}); pmcProfile.Inventory.items.push({ _id: hideoutStandAreaDb._id, _tpl: stageCurrentAt.container });
this.logger.debug( this.logger.debug(
`Added missing gun stand inventory stash: ${hideoutStandAreaDb._id} tpl to ${stageCurrentAt.container}`, `Added missing gun stand inventory stash: ${hideoutStandAreaDb._id} tpl to ${stageCurrentAt.container}`,
); );
@ -215,7 +215,10 @@ export class ProfileFixerService
} }
else else
{ {
pmcProfile.Inventory.items.push({_id: hideoutStandSecondaryAreaDb._id, _tpl: stageCurrentAt.container}); pmcProfile.Inventory.items.push({
_id: hideoutStandSecondaryAreaDb._id,
_tpl: stageCurrentAt.container,
});
this.logger.debug( this.logger.debug(
`Added missing gun stand inventory secondary stash: ${hideoutStandSecondaryAreaDb._id} tpl to ${stageCurrentAt.container}`, `Added missing gun stand inventory secondary stash: ${hideoutStandSecondaryAreaDb._id} tpl to ${stageCurrentAt.container}`,
); );
@ -352,7 +355,7 @@ export class ProfileFixerService
if (!fullProfile.aki) if (!fullProfile.aki)
{ {
this.logger.debug("Adding aki object to profile"); 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) if (!pmcProfile.UnlockedInfo)
{ {
this.logger.debug("Adding UnlockedInfo object to profile"); 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)) 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); const statsCopy = this.jsonUtil.clone(fullProfile.characters.pmc.Stats);
// Clear stats object // Clear stats object
fullProfile.characters.pmc.Stats = {Eft: null}; fullProfile.characters.pmc.Stats = { Eft: null };
fullProfile.characters.pmc.Stats.Eft = <any><unknown>statsCopy; fullProfile.characters.pmc.Stats.Eft = <any><unknown>statsCopy;
} }

View File

@ -29,7 +29,7 @@ export class RagfairPriceService implements OnLoad
protected generatedDynamicPrices: boolean; protected generatedDynamicPrices: boolean;
protected generatedStaticPrices: boolean; protected generatedStaticPrices: boolean;
protected prices: IRagfairServerPrices = {static: {}, dynamic: {}}; protected prices: IRagfairServerPrices = { static: {}, dynamic: {} };
constructor( constructor(
@inject("HandbookHelper") protected handbookHelper: HandbookHelper, @inject("HandbookHelper") protected handbookHelper: HandbookHelper,
@ -153,12 +153,12 @@ export class RagfairPriceService implements OnLoad
public getAllFleaPrices(): Record<string, number> public getAllFleaPrices(): Record<string, number>
{ {
// assign static values first, then overwrite them with dynamic, any values not stored in dynamic data will be covered by static data // 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<string, number> public getAllStaticPrices(): Record<string, number>
{ {
return {...this.prices.static}; return { ...this.prices.static };
} }
/** /**
@ -409,12 +409,12 @@ export class RagfairPriceService implements OnLoad
* @param presets weapon presets to choose from * @param presets weapon presets to choose from
* @returns Default preset object * @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); const defaultPreset = presets.find((x) => x._encyclopedia);
if (defaultPreset) if (defaultPreset)
{ {
return {isDefault: true, preset: defaultPreset}; return { isDefault: true, preset: defaultPreset };
} }
if (presets.length === 1) 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] };
} }
} }

View File

@ -122,7 +122,7 @@ export class RepairService
{ {
const options: IProcessBuyTradeRequestData = { const options: IProcessBuyTradeRequestData = {
// eslint-disable-next-line @typescript-eslint/naming-convention // 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, tid: traderId,
Action: "", Action: "",
type: "", type: "",
@ -262,7 +262,7 @@ export class RepairService
): RepairDetails ): RepairDetails
{ {
// Find item to repair in inventory // 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) if (itemToRepair === undefined)
{ {
throw new Error(`Item ${itemToRepairId} not found, unable to repair`); throw new Error(`Item ${itemToRepairId} not found, unable to repair`);
@ -405,11 +405,11 @@ export class RepairService
if (!repairKitInInventory.upd) if (!repairKitInInventory.upd)
{ {
this.logger.debug(`Repair kit: ${repairKitInInventory._id} in inventory lacks upd object, adding`); 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) if (!repairKitInInventory.upd.RepairKit?.Resource)
{ {
repairKitInInventory.upd.RepairKit = {Resource: maxRepairAmount}; repairKitInInventory.upd.RepairKit = { Resource: maxRepairAmount };
} }
} }

View File

@ -155,7 +155,7 @@ export class CustomItemService
*/ */
protected addToHandbookDb(newItemId: string, parentId: string, priceRoubles: number): void 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 });
} }
/** /**

View File

@ -10,7 +10,7 @@ export class DynamicRouterModService
{} {}
public registerDynamicRouter(name: string, routes: RouteAction[], topLevelRoute: string): void public registerDynamicRouter(name: string, routes: RouteAction[], topLevelRoute: string): void
{ {
this.container.register(name, {useValue: new DynamicRouterMod(routes, topLevelRoute)}); this.container.register(name, { useValue: new DynamicRouterMod(routes, topLevelRoute) });
this.container.registerType("DynamicRoutes", name); this.container.registerType("DynamicRoutes", name);
} }
} }

View File

@ -10,7 +10,7 @@ export class OnLoadModService
public registerOnLoad(name: string, onLoad: () => void, getRoute: () => string): void public registerOnLoad(name: string, onLoad: () => void, getRoute: () => string): void
{ {
this.container.register(name, {useValue: new OnLoadMod(onLoad, getRoute)}); this.container.register(name, { useValue: new OnLoadMod(onLoad, getRoute) });
this.container.registerType("OnLoad", name); this.container.registerType("OnLoad", name);
} }
} }

View File

@ -10,7 +10,7 @@ export class OnUpdateModService
public registerOnUpdate(name: string, onUpdate: (timeSinceLastRun: number) => boolean, getRoute: () => string): void public registerOnUpdate(name: string, onUpdate: (timeSinceLastRun: number) => boolean, getRoute: () => string): void
{ {
this.container.register(name, {useValue: new OnUpdateMod(onUpdate, getRoute)}); this.container.register(name, { useValue: new OnUpdateMod(onUpdate, getRoute) });
this.container.registerType("OnUpdate", name); this.container.registerType("OnUpdate", name);
} }
} }

View File

@ -10,7 +10,7 @@ export class StaticRouterModService
{} {}
public registerStaticRouter(name: string, routes: RouteAction[], topLevelRoute: string): void public registerStaticRouter(name: string, routes: RouteAction[], topLevelRoute: string): void
{ {
this.container.register(name, {useValue: new StaticRouterMod(routes, topLevelRoute)}); this.container.register(name, { useValue: new StaticRouterMod(routes, topLevelRoute) });
this.container.registerType("StaticRoutes", name); this.container.registerType("StaticRoutes", name);
} }
} }

View File

@ -41,7 +41,7 @@ export class HttpResponseUtil
public getUnclearedBody(data: any, err = 0, errmsg = null): string 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<string> public emptyResponse(): IGetBodyResponseData<string>
@ -65,7 +65,7 @@ export class HttpResponseUtil
errorCode = BackendErrorCodes.NONE, errorCode = BackendErrorCodes.NONE,
): IItemEventRouterResponse ): IItemEventRouterResponse
{ {
output.warnings = [{index: 0, errmsg: message, code: errorCode.toString()}]; output.warnings = [{ index: 0, errmsg: message, code: errorCode.toString() }];
return output; return output;
} }

View File

@ -181,7 +181,7 @@ export class JsonUtil
{ {
try try
{ {
const {data, changed} = fixJson(jsonString); const { data, changed } = fixJson(jsonString);
if (changed) if (changed)
{ // data invalid, return it { // data invalid, return it
this.logger.error(`${filePath} - Detected faulty json, please fix your json file using VSCodium`); this.logger.error(`${filePath} - Detected faulty json, please fix your json file using VSCodium`);

View File

@ -136,12 +136,12 @@ export class ProbabilityObjectArray<K, V = undefined> extends Array<ProbabilityO
*/ */
public draw(count = 1, replacement = true, locklist: Array<K> = []): K[] public draw(count = 1, replacement = true, locklist: Array<K> = []): K[]
{ {
const {probArray, keyArray} = this.reduce((acc, x) => const { probArray, keyArray } = this.reduce((acc, x) =>
{ {
acc.probArray.push(x.relativeProbability); acc.probArray.push(x.relativeProbability);
acc.keyArray.push(x.key); acc.keyArray.push(x.key);
return acc; return acc;
}, {probArray: [], keyArray: []}); }, { probArray: [], keyArray: [] });
let probCumsum = this.cumulativeProbability(probArray); let probCumsum = this.cumulativeProbability(probArray);
const drawnKeys = []; const drawnKeys = [];
@ -257,7 +257,7 @@ export class RandomUtil
return this.getArrayValue(Object.keys(node)); 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)]; return node[this.getKey(node)];
} }
@ -374,7 +374,7 @@ export class RandomUtil
if (n < 1) 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) if (min === max)

View File

@ -14,14 +14,14 @@ export class VFS
{ {
accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise<void>; accessFilePromisify: (path: fs.PathLike, mode?: number) => Promise<void>;
copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise<void>; copyFilePromisify: (src: fs.PathLike, dst: fs.PathLike, flags?: number) => Promise<void>;
mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & {recursive: true;}) => Promise<string>; mkdirPromisify: (path: fs.PathLike, options: fs.MakeDirectoryOptions & { recursive: true; }) => Promise<string>;
readFilePromisify: (path: fs.PathLike) => Promise<Buffer>; readFilePromisify: (path: fs.PathLike) => Promise<Buffer>;
writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise<void>; writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise<void>;
readdirPromisify: ( readdirPromisify: (
path: fs.PathLike, path: fs.PathLike,
options?: BufferEncoding | {encoding: BufferEncoding; withFileTypes?: false;}, options?: BufferEncoding | { encoding: BufferEncoding; withFileTypes?: false; },
) => Promise<string[]>; ) => Promise<string[]>;
statPromisify: (path: fs.PathLike, options?: fs.StatOptions & {bigint?: false;}) => Promise<fs.Stats>; statPromisify: (path: fs.PathLike, options?: fs.StatOptions & { bigint?: false; }) => Promise<fs.Stats>;
unlinkPromisify: (path: fs.PathLike) => Promise<void>; unlinkPromisify: (path: fs.PathLike) => Promise<void>;
rmdirPromisify: (path: fs.PathLike) => Promise<void>; rmdirPromisify: (path: fs.PathLike) => Promise<void>;
renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise<void>; renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise<void>;
@ -50,7 +50,7 @@ export class VFS
try try
{ {
// Create the command to add to the queue // 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 // Wait for the command completion
await this.asyncQueue.waitFor(command); await this.asyncQueue.waitFor(command);
@ -71,13 +71,13 @@ export class VFS
public async copyAsync(filepath: fs.PathLike, target: fs.PathLike): Promise<void> public async copyAsync(filepath: fs.PathLike, target: fs.PathLike): Promise<void>
{ {
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); await this.asyncQueue.waitFor(command);
} }
public createDir(filepath: string): void 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<void> public async createDirAsync(filepath: string): Promise<void>
@ -85,7 +85,7 @@ export class VFS
const command = { const command = {
uuid: crypto.randomUUID(), uuid: crypto.randomUUID(),
cmd: async () => 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); await this.asyncQueue.waitFor(command);
} }
@ -167,7 +167,7 @@ export class VFS
public writeFile(filepath: any, data = "", append = false, atomic = true): void 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)) if (!this.exists(filepath))
{ {
@ -194,7 +194,7 @@ export class VFS
public async writeFileAsync(filepath: any, data = "", append = false, atomic = true): Promise<void> public async writeFileAsync(filepath: any, data = "", append = false, atomic = true): Promise<void>
{ {
const options = append ? {flag: "a"} : {flag: "w"}; const options = append ? { flag: "a" } : { flag: "w" };
if (!await this.exists(filepath)) if (!await this.exists(filepath))
{ {
@ -376,7 +376,7 @@ export class VFS
return files; 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) for (const dirent of dirents)
{ {
const res = resolve(directory, dirent.name); const res = resolve(directory, dirent.name);

View File

@ -17,8 +17,8 @@ export abstract class AbstractWinstonLogger implements ILogger
protected showDebugInConsole = false; protected showDebugInConsole = false;
protected filePath: string; protected filePath: string;
protected logLevels = { protected logLevels = {
levels: {error: 0, warn: 1, succ: 2, info: 3, custom: 4, debug: 5}, 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"}, colors: { error: "red", warn: "yellow", succ: "green", info: "white", custom: "black", debug: "gray" },
bgColors: { bgColors: {
default: "", default: "",
blackBG: "blackBG", blackBG: "blackBG",
@ -41,7 +41,7 @@ export abstract class AbstractWinstonLogger implements ILogger
this.showDebugInConsole = globalThis.G_DEBUG_CONFIGURATION; this.showDebugInConsole = globalThis.G_DEBUG_CONFIGURATION;
if (!fs.existsSync(this.getFilePath())) if (!fs.existsSync(this.getFilePath()))
{ {
fs.mkdirSync(this.getFilePath(), {recursive: true}); fs.mkdirSync(this.getFilePath(), { recursive: true });
} }
const transportsList: winston.transport[] = []; const transportsList: winston.transport[] = [];
@ -52,8 +52,8 @@ export abstract class AbstractWinstonLogger implements ILogger
new transports.Console({ new transports.Console({
level: this.showDebugInConsole ? "debug" : "custom", level: this.showDebugInConsole ? "debug" : "custom",
format: format.combine( format: format.combine(
format.colorize({all: true, colors: this.logLevels.colors}), format.colorize({ all: true, colors: this.logLevels.colors }),
format.printf(({message}) => format.printf(({ message }) =>
{ {
return `${message}`; return `${message}`;
}), }),
@ -75,7 +75,7 @@ export abstract class AbstractWinstonLogger implements ILogger
format.timestamp(), format.timestamp(),
format.align(), format.align(),
format.json(), format.json(),
format.printf(({timestamp, level, message}) => format.printf(({ timestamp, level, message }) =>
{ {
return `[${timestamp}] ${level}: ${message}`; return `[${timestamp}] ${level}: ${message}`;
}), }),
@ -85,7 +85,7 @@ export abstract class AbstractWinstonLogger implements ILogger
} }
winston.addColors(this.logLevels.colors); 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()) if (this.isLogExceptions())
{ {
@ -130,13 +130,13 @@ export abstract class AbstractWinstonLogger implements ILogger
{ {
const textColor = `${color} ${backgroundColor}`.trimEnd(); const textColor = `${color} ${backgroundColor}`.trimEnd();
const tmpLogger = createLogger({ const tmpLogger = createLogger({
levels: {custom: 0}, levels: { custom: 0 },
level: "custom", level: "custom",
transports: [ transports: [
new transports.Console({ new transports.Console({
format: format.combine( format: format.combine(
format.colorize({all: true, colors: {custom: textColor}}), format.colorize({ all: true, colors: { custom: textColor } }),
format.printf(({message}) => message), format.printf(({ message }) => message),
), ),
}), }),
], ],
@ -146,7 +146,7 @@ export abstract class AbstractWinstonLogger implements ILogger
if (typeof data === "string") 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 else
{ {
@ -161,25 +161,25 @@ export abstract class AbstractWinstonLogger implements ILogger
public async error(data: string | Record<string, unknown>): Promise<void> public async error(data: string | Record<string, unknown>): Promise<void>
{ {
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); await this.asyncQueue.waitFor(command);
} }
public async warning(data: string | Record<string, unknown>): Promise<void> public async warning(data: string | Record<string, unknown>): Promise<void>
{ {
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); await this.asyncQueue.waitFor(command);
} }
public async success(data: string | Record<string, unknown>): Promise<void> public async success(data: string | Record<string, unknown>): Promise<void>
{ {
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); await this.asyncQueue.waitFor(command);
} }
public async info(data: string | Record<string, unknown>): Promise<void> public async info(data: string | Record<string, unknown>): Promise<void>
{ {
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); await this.asyncQueue.waitFor(command);
} }
@ -209,11 +209,11 @@ export abstract class AbstractWinstonLogger implements ILogger
if (onlyShowInConsole) 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 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); await this.asyncQueue.waitFor(command);

View File

@ -21,7 +21,7 @@ export default <Environment>{
Container.registerListTypes(container); Container.registerListTypes(container);
// Override registration to the container. // Override registration to the container.
container.register<WinstonLogger>("WinstonLogger", WinstonLogger, {lifecycle: Lifecycle.Singleton}); container.register<WinstonLogger>("WinstonLogger", WinstonLogger, { lifecycle: Lifecycle.Singleton });
// Import the database. // Import the database.
await importDatabase(container); await importDatabase(container);

View File

@ -6,7 +6,7 @@ import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile";
import { profileInsuranceFixture } from "@tests/__fixture__/profileInsurance.fixture"; import { profileInsuranceFixture } from "@tests/__fixture__/profileInsurance.fixture";
import { format } from "date-fns"; import { format } from "date-fns";
type DateInput = number | number[] | {[index: number]: number;}; type DateInput = number | number[] | { [index: number]: number; };
export class ProfileInsuranceFactory export class ProfileInsuranceFactory
{ {

View File

@ -9,387 +9,387 @@ export const profileInsuranceFixture: Insurance[] = [{
maxStorageTime: 345600, maxStorageTime: 345600,
text: "", text: "",
profileChangeEvents: [], profileChangeEvents: [],
systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}, systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" },
}, },
items: [{ items: [{
_id: "3679078e05f5b14466d6a730", _id: "3679078e05f5b14466d6a730",
_tpl: "5d6d3716a4b9361bc8618872", _tpl: "5d6d3716a4b9361bc8618872",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1, Repairable: {Durability: 55, MaxDurability: 55}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 55, MaxDurability: 55 } },
}, { }, {
_id: "911a0f04d5d9c7e239807ae0", _id: "911a0f04d5d9c7e239807ae0",
_tpl: "5644bd2b4bdc2d3b4c8b4572", _tpl: "5644bd2b4bdc2d3b4c8b4572",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1, Repairable: {Durability: 97.7862549, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 97.7862549, MaxDurability: 100 } },
}, { }, {
_id: "695b13896108f765e8985698", _id: "695b13896108f765e8985698",
_tpl: "5648a69d4bdc2ded0b8b457b", _tpl: "5648a69d4bdc2ded0b8b457b",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "bb49d6ceb3e87d8563a06455", _id: "bb49d6ceb3e87d8563a06455",
_tpl: "5df8a4d786f77412672a1e3b", _tpl: "5df8a4d786f77412672a1e3b",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "631f8492de748dec852f7ddf", _id: "631f8492de748dec852f7ddf",
_tpl: "64abd93857958b4249003418", _tpl: "64abd93857958b4249003418",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1, Repairable: {Durability: 49.2865, MaxDurability: 60}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 49.2865, MaxDurability: 60 } },
}, { }, {
_id: "a2b0c716162c5e31ec28c55a", _id: "a2b0c716162c5e31ec28c55a",
_tpl: "5a16b8a9fcdbcb00165aa6ca", _tpl: "5a16b8a9fcdbcb00165aa6ca",
parentId: "3679078e05f5b14466d6a730", parentId: "3679078e05f5b14466d6a730",
slotId: "mod_nvg", slotId: "mod_nvg",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "dc565f750342cb2d19eeda06", _id: "dc565f750342cb2d19eeda06",
_tpl: "5d6d3be5a4b9361bc73bc763", _tpl: "5d6d3be5a4b9361bc73bc763",
parentId: "3679078e05f5b14466d6a730", parentId: "3679078e05f5b14466d6a730",
slotId: "mod_equipment_001", 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", _id: "e9ff62601669d9e2ea9c2fbb",
_tpl: "5d6d3943a4b9360dbc46d0cc", _tpl: "5d6d3943a4b9360dbc46d0cc",
parentId: "3679078e05f5b14466d6a730", parentId: "3679078e05f5b14466d6a730",
slotId: "mod_equipment_002", slotId: "mod_equipment_002",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "ac134d7cf6c9d8e25edd0015", _id: "ac134d7cf6c9d8e25edd0015",
_tpl: "5c11046cd174af02a012e42b", _tpl: "5c11046cd174af02a012e42b",
parentId: "a2b0c716162c5e31ec28c55a", parentId: "a2b0c716162c5e31ec28c55a",
slotId: "mod_nvg", slotId: "mod_nvg",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "22274b895ecc80d51c3cba1c", _id: "22274b895ecc80d51c3cba1c",
_tpl: "5c110624d174af029e69734c", _tpl: "5c110624d174af029e69734c",
parentId: "ac134d7cf6c9d8e25edd0015", parentId: "ac134d7cf6c9d8e25edd0015",
slotId: "mod_nvg", 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", _id: "c9278dd8251e99578bf7a274",
_tpl: "59c6633186f7740cf0493bb9", _tpl: "59c6633186f7740cf0493bb9",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_gas_block", slotId: "mod_gas_block",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "677c209ebb45445ebb42c405", _id: "677c209ebb45445ebb42c405",
_tpl: "5649ab884bdc2ded0b8b457f", _tpl: "5649ab884bdc2ded0b8b457f",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_muzzle", slotId: "mod_muzzle",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "8ada5c9cc26585281577c6eb", _id: "8ada5c9cc26585281577c6eb",
_tpl: "5649ae4a4bdc2d1b2b8b4588", _tpl: "5649ae4a4bdc2d1b2b8b4588",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_pistol_grip", slotId: "mod_pistol_grip",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "4bd10f89836fd9f86aedcac1", _id: "4bd10f89836fd9f86aedcac1",
_tpl: "5649af094bdc2df8348b4586", _tpl: "5649af094bdc2df8348b4586",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_reciever", slotId: "mod_reciever",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "8b1327270791b142ac341b03", _id: "8b1327270791b142ac341b03",
_tpl: "5649d9a14bdc2d79388b4580", _tpl: "5649d9a14bdc2d79388b4580",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_sight_rear", slotId: "mod_sight_rear",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "566335b3df586f34b47f5e35", _id: "566335b3df586f34b47f5e35",
_tpl: "5649b2314bdc2d79388b4576", _tpl: "5649b2314bdc2d79388b4576",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_stock", slotId: "mod_stock",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "da8cde1b3024c336f6e06152", _id: "da8cde1b3024c336f6e06152",
_tpl: "55d482194bdc2d1d4e8b456b", _tpl: "55d482194bdc2d1d4e8b456b",
parentId: "911a0f04d5d9c7e239807ae0", parentId: "911a0f04d5d9c7e239807ae0",
slotId: "mod_magazine", slotId: "mod_magazine",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "1e0b177df108c0c117028812", _id: "1e0b177df108c0c117028812",
_tpl: "57cffddc24597763133760c6", _tpl: "57cffddc24597763133760c6",
parentId: "c9278dd8251e99578bf7a274", parentId: "c9278dd8251e99578bf7a274",
slotId: "mod_handguard", slotId: "mod_handguard",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "bc041c0011d76f714b898400", _id: "bc041c0011d76f714b898400",
_tpl: "57cffcd624597763133760c5", _tpl: "57cffcd624597763133760c5",
parentId: "1e0b177df108c0c117028812", parentId: "1e0b177df108c0c117028812",
slotId: "mod_mount_003", slotId: "mod_mount_003",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "9f8d7880a6e0a47a211ec5d3", _id: "9f8d7880a6e0a47a211ec5d3",
_tpl: "58491f3324597764bc48fa02", _tpl: "58491f3324597764bc48fa02",
parentId: "8b1327270791b142ac341b03", parentId: "8b1327270791b142ac341b03",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "402b4086535a50ef7d9cef88", _id: "402b4086535a50ef7d9cef88",
_tpl: "5649be884bdc2d79388b4577", _tpl: "5649be884bdc2d79388b4577",
parentId: "566335b3df586f34b47f5e35", parentId: "566335b3df586f34b47f5e35",
slotId: "mod_stock", slotId: "mod_stock",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "db2ef9442178910eba985b51", _id: "db2ef9442178910eba985b51",
_tpl: "58d2946386f774496974c37e", _tpl: "58d2946386f774496974c37e",
parentId: "402b4086535a50ef7d9cef88", parentId: "402b4086535a50ef7d9cef88",
slotId: "mod_stock_000", slotId: "mod_stock_000",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "3c32b7d47ad80e83749fa906", _id: "3c32b7d47ad80e83749fa906",
_tpl: "58d2912286f7744e27117493", _tpl: "58d2912286f7744e27117493",
parentId: "db2ef9442178910eba985b51", parentId: "db2ef9442178910eba985b51",
slotId: "mod_stock", slotId: "mod_stock",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "574a9b5535585255cde19570", _id: "574a9b5535585255cde19570",
_tpl: "55d482194bdc2d1d4e8b456b", _tpl: "55d482194bdc2d1d4e8b456b",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "1", slotId: "1",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "696835b2badfb96623ea887c", _id: "696835b2badfb96623ea887c",
_tpl: "55d482194bdc2d1d4e8b456b", _tpl: "55d482194bdc2d1d4e8b456b",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "2", slotId: "2",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "c2d5e23c7886e8ff02010731", _id: "c2d5e23c7886e8ff02010731",
_tpl: "55d482194bdc2d1d4e8b456b", _tpl: "55d482194bdc2d1d4e8b456b",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "3", slotId: "3",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "306de2f475a559610a4f6f1d", _id: "306de2f475a559610a4f6f1d",
_tpl: "55d482194bdc2d1d4e8b456b", _tpl: "55d482194bdc2d1d4e8b456b",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "4", slotId: "4",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "eb0445b49a97e84e27d47f3c", _id: "eb0445b49a97e84e27d47f3c",
_tpl: "5aa2ba71e5b5b000137b758f", _tpl: "5aa2ba71e5b5b000137b758f",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "5", slotId: "5",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
}, { }, {
_id: "fad89a5bdfd23e3248123346", _id: "fad89a5bdfd23e3248123346",
_tpl: "5fc5396e900b1d5091531e72", _tpl: "5fc5396e900b1d5091531e72",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "6", slotId: "6",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "b16c2a938954cd69c687c51a", _id: "b16c2a938954cd69c687c51a",
_tpl: "5b4736b986f77405cb415c10", _tpl: "5b4736b986f77405cb415c10",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "7", slotId: "7",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "a2b3019ac8d340eeb068d429", _id: "a2b3019ac8d340eeb068d429",
_tpl: "5ea18c84ecf1982c7712d9a2", _tpl: "5ea18c84ecf1982c7712d9a2",
parentId: "695b13896108f765e8985698", parentId: "695b13896108f765e8985698",
slotId: "10", slotId: "10",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 29, MaxDurability: 33}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 29, MaxDurability: 33 } },
}, { }, {
_id: "0b3c5d183e8b506d655f85c4", _id: "0b3c5d183e8b506d655f85c4",
_tpl: "644a3df63b0b6f03e101e065", _tpl: "644a3df63b0b6f03e101e065",
parentId: "fad89a5bdfd23e3248123346", parentId: "fad89a5bdfd23e3248123346",
slotId: "mod_tactical", slotId: "mod_tactical",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "757211a0b648fe27b0475ded", _id: "757211a0b648fe27b0475ded",
_tpl: "59f8a37386f7747af3328f06", _tpl: "59f8a37386f7747af3328f06",
parentId: "b16c2a938954cd69c687c51a", parentId: "b16c2a938954cd69c687c51a",
slotId: "mod_foregrip", slotId: "mod_foregrip",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "870a887c63ca30fb15736b3d", _id: "870a887c63ca30fb15736b3d",
_tpl: "62a1b7fbc30cfa1d366af586", _tpl: "62a1b7fbc30cfa1d366af586",
parentId: "bb49d6ceb3e87d8563a06455", parentId: "bb49d6ceb3e87d8563a06455",
slotId: "main", slotId: "main",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
}, { }, {
_id: "f3de631a1bb2b74bd0160d9a", _id: "f3de631a1bb2b74bd0160d9a",
_tpl: "5d6d3be5a4b9361bc73bc763", _tpl: "5d6d3be5a4b9361bc73bc763",
parentId: "bb49d6ceb3e87d8563a06455", parentId: "bb49d6ceb3e87d8563a06455",
slotId: "main", slotId: "main",
location: {x: 5, y: 0, r: "Vertical", isSearched: true}, location: { x: 5, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 22.41, MaxDurability: 22.41}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 22.41, MaxDurability: 22.41 } },
}, { }, {
_id: "351180f3248d45c71cb2ebdc", _id: "351180f3248d45c71cb2ebdc",
_tpl: "57c44b372459772d2b39b8ce", _tpl: "57c44b372459772d2b39b8ce",
parentId: "870a887c63ca30fb15736b3d", parentId: "870a887c63ca30fb15736b3d",
slotId: "main", slotId: "main",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "7237f722106866f2df8dc8d1", _id: "7237f722106866f2df8dc8d1",
_tpl: "56e33680d2720be2748b4576", _tpl: "56e33680d2720be2748b4576",
parentId: "870a887c63ca30fb15736b3d", parentId: "870a887c63ca30fb15736b3d",
slotId: "main", slotId: "main",
location: {x: 0, y: 3, r: "Horizontal", isSearched: true}, location: { x: 0, y: 3, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "d0cf00aff56ea520cdd94330", _id: "d0cf00aff56ea520cdd94330",
_tpl: "57c44dd02459772d2e0ae249", _tpl: "57c44dd02459772d2e0ae249",
parentId: "351180f3248d45c71cb2ebdc", parentId: "351180f3248d45c71cb2ebdc",
slotId: "mod_muzzle", slotId: "mod_muzzle",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "5119653b2c66d57ee219e26f", _id: "5119653b2c66d57ee219e26f",
_tpl: "57c44f4f2459772d2c627113", _tpl: "57c44f4f2459772d2c627113",
parentId: "351180f3248d45c71cb2ebdc", parentId: "351180f3248d45c71cb2ebdc",
slotId: "mod_reciever", slotId: "mod_reciever",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "ed1ac0183a8af587110aa74e", _id: "ed1ac0183a8af587110aa74e",
_tpl: "5a9e81fba2750c00164f6b11", _tpl: "5a9e81fba2750c00164f6b11",
parentId: "351180f3248d45c71cb2ebdc", parentId: "351180f3248d45c71cb2ebdc",
slotId: "mod_magazine", slotId: "mod_magazine",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "310a7d1bb07ae0e522f3f8e3", _id: "310a7d1bb07ae0e522f3f8e3",
_tpl: "5a69a2ed8dc32e000d46d1f1", _tpl: "5a69a2ed8dc32e000d46d1f1",
parentId: "351180f3248d45c71cb2ebdc", parentId: "351180f3248d45c71cb2ebdc",
slotId: "mod_pistol_grip", slotId: "mod_pistol_grip",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "8a7e3489197b3b98126447fd", _id: "8a7e3489197b3b98126447fd",
_tpl: "6130ca3fd92c473c77020dbd", _tpl: "6130ca3fd92c473c77020dbd",
parentId: "351180f3248d45c71cb2ebdc", parentId: "351180f3248d45c71cb2ebdc",
slotId: "mod_charge", slotId: "mod_charge",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "e818616e11ae07aa05388759", _id: "e818616e11ae07aa05388759",
_tpl: "5dff8db859400025ea5150d4", _tpl: "5dff8db859400025ea5150d4",
parentId: "351180f3248d45c71cb2ebdc", parentId: "351180f3248d45c71cb2ebdc",
slotId: "mod_mount_000", slotId: "mod_mount_000",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "768812984debf2756bece089", _id: "768812984debf2756bece089",
_tpl: "57c44e7b2459772d28133248", _tpl: "57c44e7b2459772d28133248",
parentId: "d0cf00aff56ea520cdd94330", parentId: "d0cf00aff56ea520cdd94330",
slotId: "mod_sight_rear", slotId: "mod_sight_rear",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "67c610585ed668baf4604931", _id: "67c610585ed668baf4604931",
_tpl: "59eb7ebe86f7740b373438ce", _tpl: "59eb7ebe86f7740b373438ce",
parentId: "d0cf00aff56ea520cdd94330", parentId: "d0cf00aff56ea520cdd94330",
slotId: "mod_mount_000", slotId: "mod_mount_000",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "80e9dffa49bfe263ab0128c7", _id: "80e9dffa49bfe263ab0128c7",
_tpl: "6267c6396b642f77f56f5c1c", _tpl: "6267c6396b642f77f56f5c1c",
parentId: "67c610585ed668baf4604931", parentId: "67c610585ed668baf4604931",
slotId: "mod_tactical_000", slotId: "mod_tactical_000",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "dee323443ce23ba8c54b9f1c", _id: "dee323443ce23ba8c54b9f1c",
_tpl: "5cc9c20cd7f00c001336c65d", _tpl: "5cc9c20cd7f00c001336c65d",
parentId: "67c610585ed668baf4604931", parentId: "67c610585ed668baf4604931",
slotId: "mod_tactical_001", slotId: "mod_tactical_001",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "3008088022dd55f1c99e5a32", _id: "3008088022dd55f1c99e5a32",
_tpl: "5c1cd46f2e22164bef5cfedb", _tpl: "5c1cd46f2e22164bef5cfedb",
parentId: "67c610585ed668baf4604931", parentId: "67c610585ed668baf4604931",
slotId: "mod_foregrip", slotId: "mod_foregrip",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "71e9f8d005c72940d857fe64", _id: "71e9f8d005c72940d857fe64",
_tpl: "59d790f486f77403cb06aec6", _tpl: "59d790f486f77403cb06aec6",
parentId: "80e9dffa49bfe263ab0128c7", parentId: "80e9dffa49bfe263ab0128c7",
slotId: "mod_flashlight", slotId: "mod_flashlight",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "8c610c6cc67115a5fc1662ff", _id: "8c610c6cc67115a5fc1662ff",
_tpl: "56eabf3bd2720b75698b4569", _tpl: "56eabf3bd2720b75698b4569",
parentId: "310a7d1bb07ae0e522f3f8e3", parentId: "310a7d1bb07ae0e522f3f8e3",
slotId: "mod_stock_000", slotId: "mod_stock_000",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "9bf01177f0c1e346b2d65373", _id: "9bf01177f0c1e346b2d65373",
_tpl: "58d2912286f7744e27117493", _tpl: "58d2912286f7744e27117493",
parentId: "8c610c6cc67115a5fc1662ff", parentId: "8c610c6cc67115a5fc1662ff",
slotId: "mod_stock", slotId: "mod_stock",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "7dd43ffa6e03c2da6cddc56e", _id: "7dd43ffa6e03c2da6cddc56e",
_tpl: "6171407e50224f204c1da3c5", _tpl: "6171407e50224f204c1da3c5",
parentId: "e818616e11ae07aa05388759", parentId: "e818616e11ae07aa05388759",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "fa9da4ccf3630cb173c293f9", _id: "fa9da4ccf3630cb173c293f9",
_tpl: "5b3b99475acfc432ff4dcbee", _tpl: "5b3b99475acfc432ff4dcbee",
parentId: "7dd43ffa6e03c2da6cddc56e", parentId: "7dd43ffa6e03c2da6cddc56e",
slotId: "mod_scope_000", slotId: "mod_scope_000",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "6e2727806fb12e12123e9a57", _id: "6e2727806fb12e12123e9a57",
_tpl: "616554fe50224f204c1da2aa", _tpl: "616554fe50224f204c1da2aa",
parentId: "7dd43ffa6e03c2da6cddc56e", parentId: "7dd43ffa6e03c2da6cddc56e",
slotId: "mod_scope_001", slotId: "mod_scope_001",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "2c868d4676adc934f897e9a7", _id: "2c868d4676adc934f897e9a7",
_tpl: "61605d88ffa6e502ac5e7eeb", _tpl: "61605d88ffa6e502ac5e7eeb",
parentId: "7dd43ffa6e03c2da6cddc56e", parentId: "7dd43ffa6e03c2da6cddc56e",
slotId: "mod_scope_002", slotId: "mod_scope_002",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "1b159fdc14c350f8a4a7e19e", _id: "1b159fdc14c350f8a4a7e19e",
_tpl: "58d39b0386f77443380bf13c", _tpl: "58d39b0386f77443380bf13c",
parentId: "6e2727806fb12e12123e9a57", parentId: "6e2727806fb12e12123e9a57",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "7691790ffc5290da292cab99", _id: "7691790ffc5290da292cab99",
_tpl: "61657230d92c473c770213d7", _tpl: "61657230d92c473c770213d7",
parentId: "1b159fdc14c350f8a4a7e19e", parentId: "1b159fdc14c350f8a4a7e19e",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "012a11e7dcb1280a1ab9d2f6", _id: "012a11e7dcb1280a1ab9d2f6",
_tpl: "618168b350224f204c1da4d8", _tpl: "618168b350224f204c1da4d8",
parentId: "7237f722106866f2df8dc8d1", parentId: "7237f722106866f2df8dc8d1",
slotId: "main", slotId: "main",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "38ca7415a458c4d22ba2f3c3", _id: "38ca7415a458c4d22ba2f3c3",
_tpl: "6130c43c67085e45ef1405a1", _tpl: "6130c43c67085e45ef1405a1",
parentId: "012a11e7dcb1280a1ab9d2f6", parentId: "012a11e7dcb1280a1ab9d2f6",
slotId: "mod_muzzle", slotId: "mod_muzzle",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "c5a0621ebf856ce1b0945efc", _id: "c5a0621ebf856ce1b0945efc",
_tpl: "61816fcad92c473c770215cc", _tpl: "61816fcad92c473c770215cc",
parentId: "012a11e7dcb1280a1ab9d2f6", parentId: "012a11e7dcb1280a1ab9d2f6",
slotId: "mod_sight_front", slotId: "mod_sight_front",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "a74677b17c1c49edc002df9b", _id: "a74677b17c1c49edc002df9b",
_tpl: "5dfa3d2b0dee1b22f862eade", _tpl: "5dfa3d2b0dee1b22f862eade",
parentId: "38ca7415a458c4d22ba2f3c3", parentId: "38ca7415a458c4d22ba2f3c3",
slotId: "mod_muzzle", slotId: "mod_muzzle",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}], }],
}, { }, {
scheduledTime: 1698945140, scheduledTime: 1698945140,
@ -400,272 +400,272 @@ export const profileInsuranceFixture: Insurance[] = [{
maxStorageTime: 518400, maxStorageTime: 518400,
text: "", text: "",
profileChangeEvents: [], profileChangeEvents: [],
systemData: {date: "01.11.2023", time: "11:18", location: "factory4_day"}, systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" },
}, },
items: [{ items: [{
_id: "5ae1c2b99a0a339adc620148", _id: "5ae1c2b99a0a339adc620148",
_tpl: "5cebec38d7f00c00110a652a", _tpl: "5cebec38d7f00c00110a652a",
parentId: "ad018df9da0cbf2726394ef1", parentId: "ad018df9da0cbf2726394ef1",
slotId: "mod_mount_000", slotId: "mod_mount_000",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "30f4bcb87bcc4604e27c02c1", _id: "30f4bcb87bcc4604e27c02c1",
_tpl: "5cc70146e4a949000d73bf6b", _tpl: "5cc70146e4a949000d73bf6b",
parentId: "ad018df9da0cbf2726394ef1", parentId: "ad018df9da0cbf2726394ef1",
slotId: "mod_mount_001", slotId: "mod_mount_001",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "ad018df9da0cbf2726394ef1", _id: "ad018df9da0cbf2726394ef1",
_tpl: "5cc70102e4a949035e43ba74", _tpl: "5cc70102e4a949035e43ba74",
parentId: "3bc4ff5bd99f165dc75cbd25", parentId: "3bc4ff5bd99f165dc75cbd25",
slotId: "main", slotId: "main",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
location: {x: 3, y: 0, r: "Horizontal", isSearched: true}, location: { x: 3, y: 0, r: "Horizontal", isSearched: true },
}, { }, {
_id: "12c243bd6b3e486e61325f81", _id: "12c243bd6b3e486e61325f81",
_tpl: "5cc82d76e24e8d00134b4b83", _tpl: "5cc82d76e24e8d00134b4b83",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1, Repairable: {Durability: 99.93771, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 99.93771, MaxDurability: 100 } },
}, { }, {
_id: "760652d86ee78eed513e0ad7", _id: "760652d86ee78eed513e0ad7",
_tpl: "5ab8f39486f7745cd93a1cca", _tpl: "5ab8f39486f7745cd93a1cca",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "61ab4afefac354dfc64c7874", _id: "61ab4afefac354dfc64c7874",
_tpl: "5b432d215acfc4771e1c6624", _tpl: "5b432d215acfc4771e1c6624",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1, Repairable: {Durability: 30, MaxDurability: 30}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 30, MaxDurability: 30 } },
}, { }, {
_id: "285e9d9ae196ae4e336cd04f", _id: "285e9d9ae196ae4e336cd04f",
_tpl: "5d5d87f786f77427997cfaef", _tpl: "5d5d87f786f77427997cfaef",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1, Repairable: {Durability: 75, MaxDurability: 80}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 75, MaxDurability: 80 } },
}, { }, {
_id: "3bc4ff5bd99f165dc75cbd25", _id: "3bc4ff5bd99f165dc75cbd25",
_tpl: "5f5e467b0bc58666c37e7821", _tpl: "5f5e467b0bc58666c37e7821",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "6bf5d8ee81a3c9aec21bbbad", _id: "6bf5d8ee81a3c9aec21bbbad",
_tpl: "5d5fca1ea4b93635fd598c07", _tpl: "5d5fca1ea4b93635fd598c07",
parentId: "5fe49444ae6628187a2e77b8", parentId: "5fe49444ae6628187a2e77b8",
slotId: "hideout", slotId: "hideout",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "2371438cf809b5e483bf5d85", _id: "2371438cf809b5e483bf5d85",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "12c243bd6b3e486e61325f81", parentId: "12c243bd6b3e486e61325f81",
slotId: "mod_magazine", slotId: "mod_magazine",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "7f890346ea5b2cbc68c3170f", _id: "7f890346ea5b2cbc68c3170f",
_tpl: "5cc700b9e4a949000f0f0f25", _tpl: "5cc700b9e4a949000f0f0f25",
parentId: "12c243bd6b3e486e61325f81", parentId: "12c243bd6b3e486e61325f81",
slotId: "mod_stock", slotId: "mod_stock",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "12fb79a9c4929009ff8d89e1", _id: "12fb79a9c4929009ff8d89e1",
_tpl: "5cc700ede4a949033c734315", _tpl: "5cc700ede4a949033c734315",
parentId: "12c243bd6b3e486e61325f81", parentId: "12c243bd6b3e486e61325f81",
slotId: "mod_reciever", slotId: "mod_reciever",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "d4c5274082ed716e19447f46", _id: "d4c5274082ed716e19447f46",
_tpl: "5cc701d7e4a94900100ac4e7", _tpl: "5cc701d7e4a94900100ac4e7",
parentId: "12c243bd6b3e486e61325f81", parentId: "12c243bd6b3e486e61325f81",
slotId: "mod_barrel", slotId: "mod_barrel",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "d819dd4d2b13de10e9d6d805", _id: "d819dd4d2b13de10e9d6d805",
_tpl: "5cc6ea85e4a949000e1ea3c3", _tpl: "5cc6ea85e4a949000e1ea3c3",
parentId: "12c243bd6b3e486e61325f81", parentId: "12c243bd6b3e486e61325f81",
slotId: "mod_charge", slotId: "mod_charge",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "fc9a664cacc477c4e725a81a", _id: "fc9a664cacc477c4e725a81a",
_tpl: "5cc700d4e4a949000f0f0f28", _tpl: "5cc700d4e4a949000f0f0f28",
parentId: "7f890346ea5b2cbc68c3170f", parentId: "7f890346ea5b2cbc68c3170f",
slotId: "mod_stock_000", slotId: "mod_stock_000",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "372891c593cf14e176b93ce2", _id: "372891c593cf14e176b93ce2",
_tpl: "5cc7012ae4a949001252b43e", _tpl: "5cc7012ae4a949001252b43e",
parentId: "12fb79a9c4929009ff8d89e1", parentId: "12fb79a9c4929009ff8d89e1",
slotId: "mod_mount_000", slotId: "mod_mount_000",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "bd196435a57bdc433df1e49d", _id: "bd196435a57bdc433df1e49d",
_tpl: "5cc7012ae4a949001252b43e", _tpl: "5cc7012ae4a949001252b43e",
parentId: "12fb79a9c4929009ff8d89e1", parentId: "12fb79a9c4929009ff8d89e1",
slotId: "mod_mount_001", slotId: "mod_mount_001",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "ea3349d29797354d835c2192", _id: "ea3349d29797354d835c2192",
_tpl: "58491f3324597764bc48fa02", _tpl: "58491f3324597764bc48fa02",
parentId: "12fb79a9c4929009ff8d89e1", parentId: "12fb79a9c4929009ff8d89e1",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "4ccf7c74ca7d2167deb0ae5c", _id: "4ccf7c74ca7d2167deb0ae5c",
_tpl: "626becf9582c3e319310b837", _tpl: "626becf9582c3e319310b837",
parentId: "372891c593cf14e176b93ce2", parentId: "372891c593cf14e176b93ce2",
slotId: "mod_tactical", slotId: "mod_tactical",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "adfd3640fc93daf21c721ca6", _id: "adfd3640fc93daf21c721ca6",
_tpl: "5cc9c20cd7f00c001336c65d", _tpl: "5cc9c20cd7f00c001336c65d",
parentId: "bd196435a57bdc433df1e49d", parentId: "bd196435a57bdc433df1e49d",
slotId: "mod_tactical", slotId: "mod_tactical",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "deeb36b1812790b0145d2532", _id: "deeb36b1812790b0145d2532",
_tpl: "5a16badafcdbcb001865f72d", _tpl: "5a16badafcdbcb001865f72d",
parentId: "61ab4afefac354dfc64c7874", parentId: "61ab4afefac354dfc64c7874",
slotId: "mod_equipment_000", slotId: "mod_equipment_000",
upd: {StackObjectsCount: 1, Repairable: {Durability: 12, MaxDurability: 25}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 12, MaxDurability: 25 } },
}, { }, {
_id: "4c0e0548df904c384569190c", _id: "4c0e0548df904c384569190c",
_tpl: "5ea058e01dbce517f324b3e2", _tpl: "5ea058e01dbce517f324b3e2",
parentId: "61ab4afefac354dfc64c7874", parentId: "61ab4afefac354dfc64c7874",
slotId: "mod_nvg", slotId: "mod_nvg",
upd: {StackObjectsCount: 1, Repairable: {Durability: 3, MaxDurability: 39}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 3, MaxDurability: 39 } },
}, { }, {
_id: "da82c293cabc705b30fef93a", _id: "da82c293cabc705b30fef93a",
_tpl: "5a398ab9c4a282000c5a9842", _tpl: "5a398ab9c4a282000c5a9842",
parentId: "61ab4afefac354dfc64c7874", parentId: "61ab4afefac354dfc64c7874",
slotId: "mod_mount", slotId: "mod_mount",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "b8fc94611def6e9ba534a8b3", _id: "b8fc94611def6e9ba534a8b3",
_tpl: "5a16b8a9fcdbcb00165aa6ca", _tpl: "5a16b8a9fcdbcb00165aa6ca",
parentId: "4c0e0548df904c384569190c", parentId: "4c0e0548df904c384569190c",
slotId: "mod_nvg", slotId: "mod_nvg",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "20d6193c1f399e6326ebbc10", _id: "20d6193c1f399e6326ebbc10",
_tpl: "5a16b93dfcdbcbcae6687261", _tpl: "5a16b93dfcdbcbcae6687261",
parentId: "b8fc94611def6e9ba534a8b3", parentId: "b8fc94611def6e9ba534a8b3",
slotId: "mod_nvg", slotId: "mod_nvg",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "065c4f13b2bd8be266e1e809", _id: "065c4f13b2bd8be266e1e809",
_tpl: "57235b6f24597759bf5a30f1", _tpl: "57235b6f24597759bf5a30f1",
parentId: "20d6193c1f399e6326ebbc10", parentId: "20d6193c1f399e6326ebbc10",
slotId: "mod_nvg", 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", _id: "1883b955ab202fa099809278",
_tpl: "57d17c5e2459775a5c57d17d", _tpl: "57d17c5e2459775a5c57d17d",
parentId: "da82c293cabc705b30fef93a", parentId: "da82c293cabc705b30fef93a",
slotId: "mod_flashlight", slotId: "mod_flashlight",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "e3c9e50ce31900c950b4ff6f", _id: "e3c9e50ce31900c950b4ff6f",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "1", slotId: "1",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "193259b5eb848af4d036bee5", _id: "193259b5eb848af4d036bee5",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "2", slotId: "2",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "f97ce69443f63bbe8f8097a7", _id: "f97ce69443f63bbe8f8097a7",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "3", slotId: "3",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "5d1c154a8abcfa934e477ac4", _id: "5d1c154a8abcfa934e477ac4",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "4", slotId: "4",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "289f7af841690c5388095477", _id: "289f7af841690c5388095477",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "5", slotId: "5",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "3e6d578165b61aef9865f677", _id: "3e6d578165b61aef9865f677",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "6", slotId: "6",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "338682523f8504f97f84f3ab", _id: "338682523f8504f97f84f3ab",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "7", slotId: "7",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "6d18ac01aa04b16e4f0d5d2f", _id: "6d18ac01aa04b16e4f0d5d2f",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "8", slotId: "8",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "ac4ed54d61daa0c5219f8522", _id: "ac4ed54d61daa0c5219f8522",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "9", slotId: "9",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "2460460ef3d3df5c1ce07edb", _id: "2460460ef3d3df5c1ce07edb",
_tpl: "5cc70093e4a949033c734312", _tpl: "5cc70093e4a949033c734312",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "10", slotId: "10",
location: {x: 0, y: 0, r: "Vertical", isSearched: true}, location: { x: 0, y: 0, r: "Vertical", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "3aeb18aac0b532f34255f162", _id: "3aeb18aac0b532f34255f162",
_tpl: "5cc70146e4a949000d73bf6b", _tpl: "5cc70146e4a949000d73bf6b",
parentId: "285e9d9ae196ae4e336cd04f", parentId: "285e9d9ae196ae4e336cd04f",
slotId: "11", slotId: "11",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
}, { }, {
_id: "bdb46107abbf1d92edaaf14e", _id: "bdb46107abbf1d92edaaf14e",
_tpl: "6272379924e29f06af4d5ecb", _tpl: "6272379924e29f06af4d5ecb",
parentId: "3aeb18aac0b532f34255f162", parentId: "3aeb18aac0b532f34255f162",
slotId: "mod_tactical", slotId: "mod_tactical",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "0caadd8507a36d9ea871e88e", _id: "0caadd8507a36d9ea871e88e",
_tpl: "5ab8f04f86f774585f4237d8", _tpl: "5ab8f04f86f774585f4237d8",
parentId: "3bc4ff5bd99f165dc75cbd25", parentId: "3bc4ff5bd99f165dc75cbd25",
slotId: "main", slotId: "main",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "240046eebc9040c1d7e58611", _id: "240046eebc9040c1d7e58611",
_tpl: "5ac66d015acfc400180ae6e4", _tpl: "5ac66d015acfc400180ae6e4",
parentId: "0caadd8507a36d9ea871e88e", parentId: "0caadd8507a36d9ea871e88e",
slotId: "main", slotId: "main",
location: {x: 0, y: 0, r: "Horizontal", isSearched: true}, location: { x: 0, y: 0, r: "Horizontal", isSearched: true },
upd: { upd: {
StackObjectsCount: 1, StackObjectsCount: 1,
sptPresetId: "5acf7dfc86f774401e19c390", sptPresetId: "5acf7dfc86f774401e19c390",
Repairable: {Durability: 32, MaxDurability: 59}, Repairable: { Durability: 32, MaxDurability: 59 },
Foldable: {Folded: true}, Foldable: { Folded: true },
}, },
}, { }, {
_id: "70b23c628fa17699d9a71e94", _id: "70b23c628fa17699d9a71e94",
@ -675,14 +675,14 @@ export const profileInsuranceFixture: Insurance[] = [{
upd: { upd: {
StackObjectsCount: 1, StackObjectsCount: 1,
sptPresetId: "5acf7dfc86f774401e19c390", sptPresetId: "5acf7dfc86f774401e19c390",
Repairable: {Durability: 32, MaxDurability: 59}, Repairable: { Durability: 32, MaxDurability: 59 },
}, },
}, { }, {
_id: "7cc2e24dc6bc0716bdddc472", _id: "7cc2e24dc6bc0716bdddc472",
_tpl: "5943ee5a86f77413872d25ec", _tpl: "5943ee5a86f77413872d25ec",
parentId: "240046eebc9040c1d7e58611", parentId: "240046eebc9040c1d7e58611",
slotId: "mod_muzzle", slotId: "mod_muzzle",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "7a51ebbad703082660d59d27", _id: "7a51ebbad703082660d59d27",
_tpl: "5649ade84bdc2d1b2b8b4587", _tpl: "5649ade84bdc2d1b2b8b4587",
@ -691,14 +691,14 @@ export const profileInsuranceFixture: Insurance[] = [{
upd: { upd: {
StackObjectsCount: 1, StackObjectsCount: 1,
sptPresetId: "5acf7dfc86f774401e19c390", sptPresetId: "5acf7dfc86f774401e19c390",
Repairable: {Durability: 32, MaxDurability: 59}, Repairable: { Durability: 32, MaxDurability: 59 },
}, },
}, { }, {
_id: "b481bc57436ed9a0c3abe7f3", _id: "b481bc57436ed9a0c3abe7f3",
_tpl: "5d2c76ed48f03532f2136169", _tpl: "5d2c76ed48f03532f2136169",
parentId: "240046eebc9040c1d7e58611", parentId: "240046eebc9040c1d7e58611",
slotId: "mod_reciever", slotId: "mod_reciever",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "5774ef80597c7f91bff40dbb", _id: "5774ef80597c7f91bff40dbb",
_tpl: "5ac50c185acfc400163398d4", _tpl: "5ac50c185acfc400163398d4",
@ -707,20 +707,20 @@ export const profileInsuranceFixture: Insurance[] = [{
upd: { upd: {
StackObjectsCount: 1, StackObjectsCount: 1,
sptPresetId: "5acf7dfc86f774401e19c390", sptPresetId: "5acf7dfc86f774401e19c390",
Repairable: {Durability: 32, MaxDurability: 59}, Repairable: { Durability: 32, MaxDurability: 59 },
}, },
}, { }, {
_id: "8b7c8e6ba172ac390c99a2ae", _id: "8b7c8e6ba172ac390c99a2ae",
_tpl: "5ac66c5d5acfc4001718d314", _tpl: "5ac66c5d5acfc4001718d314",
parentId: "240046eebc9040c1d7e58611", parentId: "240046eebc9040c1d7e58611",
slotId: "mod_magazine", slotId: "mod_magazine",
upd: {StackObjectsCount: 1}, upd: { StackObjectsCount: 1 },
}, { }, {
_id: "1ed3a416b1fc7adbed1160df", _id: "1ed3a416b1fc7adbed1160df",
_tpl: "6130ca3fd92c473c77020dbd", _tpl: "6130ca3fd92c473c77020dbd",
parentId: "240046eebc9040c1d7e58611", parentId: "240046eebc9040c1d7e58611",
slotId: "mod_charge", slotId: "mod_charge",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "bbe087661947c0d9c1cde146", _id: "bbe087661947c0d9c1cde146",
_tpl: "5648b1504bdc2d9d488b4584", _tpl: "5648b1504bdc2d9d488b4584",
@ -729,19 +729,19 @@ export const profileInsuranceFixture: Insurance[] = [{
upd: { upd: {
StackObjectsCount: 1, StackObjectsCount: 1,
sptPresetId: "5acf7dfc86f774401e19c390", sptPresetId: "5acf7dfc86f774401e19c390",
Repairable: {Durability: 32, MaxDurability: 59}, Repairable: { Durability: 32, MaxDurability: 59 },
}, },
}, { }, {
_id: "724388f8110434efccd79b3a", _id: "724388f8110434efccd79b3a",
_tpl: "544a3a774bdc2d3a388b4567", _tpl: "544a3a774bdc2d3a388b4567",
parentId: "b481bc57436ed9a0c3abe7f3", parentId: "b481bc57436ed9a0c3abe7f3",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}, { }, {
_id: "8581038b0f795618a3d26c94", _id: "8581038b0f795618a3d26c94",
_tpl: "58d268fc86f774111273f8c2", _tpl: "58d268fc86f774111273f8c2",
parentId: "724388f8110434efccd79b3a", parentId: "724388f8110434efccd79b3a",
slotId: "mod_scope", slotId: "mod_scope",
upd: {StackObjectsCount: 1, Repairable: {Durability: 100, MaxDurability: 100}}, upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } },
}], }],
}]; }];

View File

@ -34,7 +34,7 @@ describe("InsuranceController", () =>
{ {
const session1 = "session1"; const session1 = "session1";
const session2 = "session2"; const session2 = "session2";
const profiles = {[session1]: {}, [session2]: {}}; const profiles = { [session1]: {}, [session2]: {} };
const getProfilesSpy = vi.spyOn(insuranceController.saveServer, "getProfiles").mockReturnValue(profiles); const getProfilesSpy = vi.spyOn(insuranceController.saveServer, "getProfiles").mockReturnValue(profiles);
const processReturnByProfileSpy = vi.spyOn(insuranceController, "processReturnByProfile").mockReturnValue( const processReturnByProfileSpy = vi.spyOn(insuranceController, "processReturnByProfile").mockReturnValue(
vi.fn(), vi.fn(),
@ -246,11 +246,11 @@ describe("InsuranceController", () =>
const insurance = [{ const insurance = [{
_id: "1", _id: "1",
upd: 1234567890, 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", _id: "2",
upd: 1234567890, 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", _id: "5",
parentId: "2", parentId: "2",
slotId: "3", slotId: "3",
@ -279,7 +279,7 @@ describe("InsuranceController", () =>
it("should return 0 if there are no items in any of the insurance packages", () => 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; const expectedCount = 0;
// Execute the method. // Execute the method.
@ -295,12 +295,12 @@ describe("InsuranceController", () =>
it("should remove the specified insurance package from the profile", () => it("should remove the specified insurance package from the profile", () =>
{ {
const sessionID = "session-id"; 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 = { const profile = {
insurance: [{ 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 }, { // 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", () => it("should log a message indicating that the package was removed", () =>
{ {
const sessionID = "session-id"; 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 = { const profile = {
insurance: [{ 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", () => it("should not remove any packages if the specified package is not found", () =>
{ {
const sessionID = "session-id"; 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 = { const profile = {
insurance: [{ 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", () => 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", _id: "item2",
name: "Item 2", name: "Item 2",
maxPrice: 200, maxPrice: 200,
@ -1165,7 +1165,7 @@ describe("InsuranceController", () =>
// Manually set one of the items to be orphaned. // Manually set one of the items to be orphaned.
insured.items[0].parentId = "9999"; // Should not exist in the items array. insured.items[0].parentId = "9999"; // Should not exist in the items array.
insured.items[0].slotId = "main"; // Should not be "hideout". 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. // Iterate over the items and find an individual orphaned item.
const orphanedItem = insured.items.find((item) => const orphanedItem = insured.items.find((item) =>
@ -1396,10 +1396,10 @@ describe("InsuranceController", () =>
// Setup shared test data. // Setup shared test data.
pmcData = { pmcData = {
Inventory: {items: [{_id: "item1", otherProps: "value1"}, {_id: "item2", otherProps: "value2"}]}, Inventory: { items: [{ _id: "item1", otherProps: "value1" }, { _id: "item2", otherProps: "value2" }] },
InsuredItems: [], InsuredItems: [],
}; };
body = {items: ["item1", "item2"], tid: "someTraderId"}; body = { items: ["item1", "item2"], tid: "someTraderId" };
sessionId = "session-id"; sessionId = "session-id";
// Setup shared mocks. // Setup shared mocks.
@ -1424,7 +1424,7 @@ describe("InsuranceController", () =>
expect(mockPayMoney).toHaveBeenCalledWith( expect(mockPayMoney).toHaveBeenCalledWith(
pmcData, pmcData,
{ {
scheme_items: [{id: "item1", count: 100}, {id: "item2", count: 100}], scheme_items: [{ id: "item1", count: 100 }, { id: "item2", count: 100 }],
tid: "someTraderId", tid: "someTraderId",
Action: "", Action: "",
type: "", type: "",
@ -1433,7 +1433,7 @@ describe("InsuranceController", () =>
scheme_id: 0, scheme_id: 0,
}, },
sessionId, 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. // Define the expected payment options structure based on the setup data.
const expectedPaymentOptions = { 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, tid: body.tid,
Action: "", Action: "",
type: "", type: "",
@ -1498,7 +1498,7 @@ describe("InsuranceController", () =>
{ {
// Override the payMoney mock to simulate a payment failure with a warning. // Override the payMoney mock to simulate a payment failure with a warning.
const expectedPayMoneyReturn = { 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", otherProperty: "property-value",
}; };
mockPayMoney.mockReturnValue(expectedPayMoneyReturn); mockPayMoney.mockReturnValue(expectedPayMoneyReturn);
@ -1517,7 +1517,7 @@ describe("InsuranceController", () =>
{ {
// Override the payMoney mock to simulate a payment failure with a warning. // Override the payMoney mock to simulate a payment failure with a warning.
const expectedPayMoneyReturn = { 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", otherProperty: "property-value",
}; };
mockPayMoney.mockReturnValue(expectedPayMoneyReturn); mockPayMoney.mockReturnValue(expectedPayMoneyReturn);
@ -1542,18 +1542,18 @@ describe("InsuranceController", () =>
vi.spyOn(insuranceController.profileHelper, "getPmcProfile").mockReturnValue({ vi.spyOn(insuranceController.profileHelper, "getPmcProfile").mockReturnValue({
Inventory: { Inventory: {
items: [{_id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1"}, { items: [{ _id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1" }, {
_id: "itemId2", _id: "itemId2",
_tpl: "itemTpl2", _tpl: "itemTpl2",
otherProperty: "property-value2", 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", () => it("should return an empty object if no traders and items are specified", () =>
{ {
const request = {traders: [], items: []}; const request = { traders: [], items: [] };
const expected = {}; const expected = {};
const result = insuranceController.cost(request, sessionId); const result = insuranceController.cost(request, sessionId);
@ -1563,8 +1563,8 @@ describe("InsuranceController", () =>
it("should return an empty object if no items are specified", () => it("should return an empty object if no items are specified", () =>
{ {
const request = {traders: ["prapor"], items: []}; const request = { traders: ["prapor"], items: [] };
const expected = {prapor: {}}; const expected = { prapor: {} };
const result = insuranceController.cost(request, sessionId); 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", () => 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 expected = {};
const result = insuranceController.cost(request, sessionId); const result = insuranceController.cost(request, sessionId);
@ -1583,10 +1583,10 @@ describe("InsuranceController", () =>
it("should return the expected cost for each item and trader", () => 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 = { const expected = {
prapor: {itemTpl1: 100, itemTpl2: 200, itemTpl3: 300}, prapor: { itemTpl1: 100, itemTpl2: 200, itemTpl3: 300 },
therapist: {itemTpl1: 150, itemTpl2: 250, itemTpl3: 350}, therapist: { itemTpl1: 150, itemTpl2: 250, itemTpl3: 350 },
}; };
// Mock the InsuranceService.getPremium method to return the expected values. // 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. "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. // Mock the InsuranceService.getPremium method to return the expected values.
vi.spyOn(insuranceController.insuranceService, "getPremium").mockReturnValueOnce(100).mockReturnValueOnce( vi.spyOn(insuranceController.insuranceService, "getPremium").mockReturnValueOnce(100).mockReturnValueOnce(

View File

@ -59,11 +59,11 @@ describe("BotGenerator", () =>
{ {
botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 0; 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(<IPmcData>mockPlayerProfile); vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
const botJsonTemplate = {firstName: ["test"], lastName: []}; const botJsonTemplate = { firstName: ["test"], lastName: [] };
const sessionId = "sessionId"; const sessionId = "sessionId";
const isPlayerScav = false; const isPlayerScav = false;
@ -77,10 +77,10 @@ describe("BotGenerator", () =>
{ {
botGenerator.botConfig.showTypeInNickname = true; 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(<IPmcData>mockPlayerProfile); vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
const botJsonTemplate = {firstName: ["test"], lastName: []}; const botJsonTemplate = { firstName: ["test"], lastName: [] };
const sessionId = "sessionId"; const sessionId = "sessionId";
const isPlayerScav = false; const isPlayerScav = false;
@ -95,11 +95,11 @@ describe("BotGenerator", () =>
botGenerator.botConfig.showTypeInNickname = false; botGenerator.botConfig.showTypeInNickname = false;
botGenerator.pmcConfig.addPrefixToSameNamePMCAsPlayerChance = 100; botGenerator.pmcConfig.addPrefixToSameNamePMCAsPlayerChance = 100;
const mockPlayerProfile = {Info: {Nickname: "Player", Level: 1}}; const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile); vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
vi.spyOn(botGenerator.localisationService, "getRandomTextThatMatchesPartialKey").mockReturnValue("test"); vi.spyOn(botGenerator.localisationService, "getRandomTextThatMatchesPartialKey").mockReturnValue("test");
const botJsonTemplate = {firstName: ["Player"], lastName: []}; const botJsonTemplate = { firstName: ["Player"], lastName: [] };
const sessionId = "sessionId"; const sessionId = "sessionId";
const isPlayerScav = false; const isPlayerScav = false;
@ -113,10 +113,10 @@ describe("BotGenerator", () =>
{ {
botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100; botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100;
const mockPlayerProfile = {Info: {Nickname: "Player", Level: 1}}; const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile); vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
const botJsonTemplate = {firstName: ["test"], lastName: []}; const botJsonTemplate = { firstName: ["test"], lastName: [] };
const sessionId = "sessionId"; const sessionId = "sessionId";
const isPlayerScav = true; const isPlayerScav = true;
@ -132,10 +132,10 @@ describe("BotGenerator", () =>
botGenerator.databaseServer.getTables().bots.types.usec.firstName = ["usec"]; botGenerator.databaseServer.getTables().bots.types.usec.firstName = ["usec"];
botGenerator.databaseServer.getTables().bots.types.bear.firstName = []; botGenerator.databaseServer.getTables().bots.types.bear.firstName = [];
const mockPlayerProfile = {Info: {Nickname: "Player", Level: 1}}; const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile); vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
const botJsonTemplate = {firstName: ["test"], lastName: []}; const botJsonTemplate = { firstName: ["test"], lastName: [] };
const sessionId = "sessionId"; const sessionId = "sessionId";
const isPlayerScav = false; const isPlayerScav = false;

View File

@ -27,7 +27,7 @@ describe("BotLevelGenerator", () =>
{ {
it("should return value between 5 and 10 when player is level 5 and max is 10", () => 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 = { const botGenerationDetails: BotGenerationDetails = {
isPmc: false, isPmc: false,
@ -50,7 +50,7 @@ describe("BotLevelGenerator", () =>
{ {
it("should return 10 when player level is 5 and delta is 5", () => 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; 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", () => 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 expTable = databaseServer.getTables().globals.config.exp.level.exp_table;
const playerLevel = 100; const playerLevel = 100;

View File

@ -24,7 +24,7 @@ describe("InRaidHelper", () =>
it("should return negative value when player kills 2 scavs as scav", () => it("should return negative value when player kills 2 scavs as scav", () =>
{ {
const fenceStanding = 0; 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>("DatabaseServer"); const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
const scavStandingChangeOnKill = databaseServer.getTables().bots.types.assault.experience.standingForKill; 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", () => it("should return positive value when player kills 2 PMCs of different sides as scav", () =>
{ {
const fenceStanding = 0; 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>("DatabaseServer"); const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
const bearStandingChangeOnKill = databaseServer.getTables().bots.types.bear.experience.standingForKill; 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", () => it("should return negative value when player kills 1 PMC, 1 boss and 2 scavs as scav", () =>
{ {
const fenceStanding = 0; 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", Side: "savage",
Role: "bossBoar", Role: "bossBoar",
}, {Side: "savage", Role: "assault"}]; // Kills }, { Side: "savage", Role: "assault" }]; // Kills
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer"); const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
const usecStandingChangeOnKill = databaseServer.getTables().bots.types.bear.experience.standingForKill; 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", () => it("should return 0 when player kills bot with undefined standing as scav", () =>
{ {
const fenceStanding = 0; const fenceStanding = 0;
const postRaidPlayerVictims = [{Side: "savage", Role: "testRole"}]; // Kills const postRaidPlayerVictims = [{ Side: "savage", Role: "testRole" }]; // Kills
// Fake getFenceStandingChangeForKillAsScav() returning null // Fake getFenceStandingChangeForKillAsScav() returning null
vi.spyOn(inraidHelper, "getFenceStandingChangeForKillAsScav").mockReturnValueOnce(null).mockReturnValueOnce( vi.spyOn(inraidHelper, "getFenceStandingChangeForKillAsScav").mockReturnValueOnce(null).mockReturnValueOnce(

View File

@ -249,7 +249,7 @@ describe("ItemHelper", () =>
{ {
it("should set upd.StackObjectsCount to 1 if upd is undefined", () => 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); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
@ -258,7 +258,7 @@ describe("ItemHelper", () =>
it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () => 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); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
@ -267,7 +267,7 @@ describe("ItemHelper", () =>
it("should not change upd.StackObjectsCount if it is already defined", () => 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); const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined(); expect(fixedItem.upd).toBeDefined();
@ -452,7 +452,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "5b40e1525acfc4771e1c6611", // "HighCom Striker ULACH IIIA helmet (Black)" _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); const result = itemHelper.getItemQualityModifier(item);
@ -466,7 +466,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "5a38e6bac4a2826c6e06d79b", // "TOZ-106 20ga bolt-action shotgun" _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); const result = itemHelper.getItemQualityModifier(item);
@ -498,7 +498,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key" _tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key"
upd: {Key: {NumberOfUsages: 5}}, upd: { Key: { NumberOfUsages: 5 } },
}; };
const result = itemHelper.getItemQualityModifier(item); const result = itemHelper.getItemQualityModifier(item);
@ -531,7 +531,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {RepairKit: {Resource: 600}}, upd: { RepairKit: { Resource: 600 } },
}; };
const result = itemHelper.getItemQualityModifier(item); const result = itemHelper.getItemQualityModifier(item);
@ -545,7 +545,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {RepairKit: {Resource: 0}}, upd: { RepairKit: { Resource: 0 } },
}; };
const result = itemHelper.getItemQualityModifier(item); const result = itemHelper.getItemQualityModifier(item);
@ -559,7 +559,7 @@ describe("ItemHelper", () =>
it("should return the correct quality value for armor items", () => it("should return the correct quality value for armor items", () =>
{ {
const armor = itemHelper.getItem("5648a7494bdc2d9d488b4583")[1]; // "PACA Soft Armor" 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. const item: Item = { // Not used for armor, but required for the method.
_id: "", _id: "",
_tpl: "", _tpl: "",
@ -592,8 +592,8 @@ describe("ItemHelper", () =>
it("should return the correct quality value for weapon items", () => it("should return the correct quality value for weapon items", () =>
{ {
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun" const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
const repairable: Repairable = {Durability: 50, MaxDurability: 100}; const repairable: Repairable = { Durability: 50, MaxDurability: 100 };
const item: Item = {_id: "", _tpl: ""}; const item: Item = { _id: "", _tpl: "" };
// Cast the method to any to allow access to private/protected method. // Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -609,7 +609,7 @@ describe("ItemHelper", () =>
Durability: 50, Durability: 50,
MaxDurability: 200, // This should be used now. 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. // Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -625,7 +625,7 @@ describe("ItemHelper", () =>
Durability: 50, Durability: 50,
MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type. 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. // Mock the logger's error method to prevent it from being actually called.
const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() => const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() =>
@ -646,7 +646,7 @@ describe("ItemHelper", () =>
Durability: 50, Durability: 50,
MaxDurability: 0, // This is a problem. 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. // Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item); const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -662,7 +662,7 @@ describe("ItemHelper", () =>
Durability: 50, Durability: 50,
MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type. 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"); 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", () => 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", _id: "3",
_tpl: "", _tpl: "",
parentId: "2", parentId: "2",
@ -688,7 +688,7 @@ describe("ItemHelper", () =>
it("should return array of child IDs when single-level children are found", () => 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", _id: "3",
_tpl: "", _tpl: "",
parentId: "1", parentId: "1",
@ -699,18 +699,18 @@ describe("ItemHelper", () =>
it("should return array of child IDs when multi-level children are found", () => 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", _id: "3",
_tpl: "", _tpl: "",
parentId: "2", parentId: "2",
}, {_id: "4", _tpl: "", parentId: "3"}]; }, { _id: "4", _tpl: "", parentId: "3" }];
const result = itemHelper.findAndReturnChildrenByItems(items, "1"); const result = itemHelper.findAndReturnChildrenByItems(items, "1");
expect(result).toEqual(["4", "3", "2", "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", () => 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"); const result = itemHelper.findAndReturnChildrenByItems(items, "3");
expect(result).toEqual(["3"]); expect(result).toEqual(["3"]);
}); });
@ -747,7 +747,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {StackObjectsCount: 5}, upd: { StackObjectsCount: 5 },
}; };
const result = itemHelper.getItemStackSize(item); const result = itemHelper.getItemStackSize(item);
expect(result).toBe(5); expect(result).toBe(5);
@ -762,7 +762,7 @@ describe("ItemHelper", () =>
const item: Item = { const item: Item = {
_id: itemId, _id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit" _tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {BuyRestrictionCurrent: 0, BuyRestrictionMax: 1}, upd: { BuyRestrictionCurrent: 0, BuyRestrictionMax: 1 },
}; };
const result = itemHelper.hasBuyRestrictions(item); const result = itemHelper.hasBuyRestrictions(item);
expect(result).toBe(true); expect(result).toBe(true);
@ -1024,7 +1024,7 @@ describe("ItemHelper", () =>
const mockTemplateItem = { const mockTemplateItem = {
_id: "571a29dc2459771fb2755a6a", _id: "571a29dc2459771fb2755a6a",
_name: "mag_tt_toz_std_762x25tt_8", _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]); 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", () => 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); const result = itemHelper.getRandomCompatibleCaliberTemplateId(fakeTemplateItem as ITemplateItem);
expect(result).toBe(null); expect(result).toBe(null);

View File

@ -50,8 +50,8 @@ describe("PaymentService", () =>
// Object representing the player's PMC inventory. // Object representing the player's PMC inventory.
const pmcData = { const pmcData = {
TradersInfo: {[traderId]: {salesSum: 0, unlocked: true, disabled: false}}, TradersInfo: { [traderId]: { salesSum: 0, unlocked: true, disabled: false } },
Inventory: {items: [moneyItem]}, Inventory: { items: [moneyItem] },
} as unknown as IPmcData; } as unknown as IPmcData;
// Buy a factory map from Therapist... although it doesn't really matter what the item is as there's no // 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, item_id: purchaseItemId,
count: purchaseQuantity, count: purchaseQuantity,
scheme_id: 0, scheme_id: 0,
scheme_items: [{id: costItemId, count: costAmount}], scheme_items: [{ id: costItemId, count: costAmount }],
} as IProcessBuyTradeRequestData; } as IProcessBuyTradeRequestData;
// Inconsequential profile ID // Inconsequential profile ID
@ -71,7 +71,7 @@ describe("PaymentService", () =>
const itemEventRouterResponse = { const itemEventRouterResponse = {
warnings: [], warnings: [],
profileChanges: {sessionID: {_id: sessionID, items: {new: [], change: [], del: []}}}, profileChanges: { sessionID: { _id: sessionID, items: { new: [], change: [], del: [] } } },
} as unknown as IItemEventRouterResponse; } as unknown as IItemEventRouterResponse;
// Mock the logger debug method to return void. // 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. // Mock the trader helper to return a trader with the currency of Roubles.
const traderHelperGetTraderSpy = vi.spyOn((paymentService as any).traderHelper, "getTrader") 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. // Mock the addPaymentToOutput method to subtract the item cost from the money stack.
const addPaymentToOutputSpy = vi.spyOn(paymentService as any, "addPaymentToOutput").mockImplementation(() => const addPaymentToOutputSpy = vi.spyOn(paymentService as any, "addPaymentToOutput").mockImplementation(() =>
{ {
moneyItem.upd.StackObjectsCount -= costAmount; 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. // Mock the traderHelper lvlUp method to return void.

View File

@ -7,7 +7,7 @@ export default defineConfig({
reporters: ["default"], reporters: ["default"],
root: "./", root: "./",
include: ["**/*.{test,spec}.?(c|m)[jt]s?(x)"], include: ["**/*.{test,spec}.?(c|m)[jt]s?(x)"],
cache: {dir: "./tests/__cache__"}, cache: { dir: "./tests/__cache__" },
environment: "./tests/CustomEnvironment.ts", environment: "./tests/CustomEnvironment.ts",
globals: true, globals: true,
coverage: { coverage: {
@ -20,7 +20,7 @@ export default defineConfig({
exclude: ["src/models/**", "tests/**"], exclude: ["src/models/**", "tests/**"],
}, },
pool: "threads", pool: "threads",
poolOptions: {threads: {singleThread: true, isolate: false}}, poolOptions: { threads: { singleThread: true, isolate: false } },
alias: {"@spt-aki": path.resolve(__dirname, "src"), "@tests": path.resolve(__dirname, "tests")}, alias: { "@spt-aki": path.resolve(__dirname, "src"), "@tests": path.resolve(__dirname, "tests") },
}, },
}); });