Formatting Change - When a statement can be moved into a single line and still be under the maximum line length, it is.

This commit is contained in:
Refringe 2023-11-13 12:31:52 -05:00
parent 7533d33358
commit 32b47bdc18
No known key found for this signature in database
GPG Key ID: 64E03E5F892C6F9E
173 changed files with 2320 additions and 4501 deletions

View File

@ -15,7 +15,7 @@
"trailingCommas": "onlyMultiLine",
"operatorPosition": "nextLine",
"preferHanging": false,
"preferSingleLine": false,
"preferSingleLine": true,
"arrowFunction.useParentheses": "force",
"binaryExpression.linePerExpression": false,
"memberExpression.linePerExpression": false,

View File

@ -74,15 +74,12 @@ const updateBuildProperties = async () =>
const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0];
vi.setStringValues(
{lang: 1033, codepage: 1200},
{
vi.setStringValues({lang: 1033, codepage: 1200}, {
ProductName: manifest.author,
FileDescription: manifest.description,
CompanyName: manifest.name,
LegalCopyright: manifest.license,
},
);
});
vi.removeStringValue({lang: 1033, codepage: 1200}, "OriginalFilename");
vi.removeStringValue({lang: 1033, codepage: 1200}, "InternalName");
vi.setFileVersion(...manifest.version.split(".").map(Number));

View File

@ -12,10 +12,7 @@ export class ErrorHandler
constructor()
{
this.logger = new WinstonMainLogger(new AsyncQueue());
this.readLine = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
this.readLine = readline.createInterface({input: process.stdin, output: process.stdout});
}
public handleCriticalError(err: Error): void

View File

@ -28,10 +28,7 @@ export class CustomizationCallbacks
*/
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);
}

View File

@ -75,12 +75,7 @@ export class DialogueCallbacks implements OnUpdate
VersionId: "bgkidft87ddd", // TODO: Is this... correct?
Ip: "",
Port: 0,
Chats: [
{
_id: "0",
Members: 0,
},
],
Chats: [{_id: "0", Members: 0}],
};
return this.httpResponse.getBody([chatServer]);

View File

@ -58,9 +58,7 @@ export class GameCallbacks implements OnLoad
const today = new Date().toUTCString();
const startTimeStampMS = Date.parse(today);
this.gameController.gameStart(url, info, sessionID, startTimeStampMS);
return this.httpResponse.getBody({
utc_time: startTimeStampMS / 1000,
});
return this.httpResponse.getBody({utc_time: startTimeStampMS / 1000});
}
/**
@ -75,9 +73,7 @@ export class GameCallbacks implements OnLoad
): IGetBodyResponseData<IGameLogoutResponseData>
{
this.saveServer.save();
return this.httpResponse.getBody({
status: "ok",
});
return this.httpResponse.getBody({status: "ok"});
}
/**
@ -144,9 +140,7 @@ export class GameCallbacks implements OnLoad
*/
public getVersion(url: string, info: IEmptyRequestData, sessionID: string): string
{
return this.httpResponse.noBody({
Version: this.watermark.getInGameVersionLabel(),
});
return this.httpResponse.noBody({Version: this.watermark.getInGameVersionLabel()});
}
public reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData

View File

@ -6,9 +6,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
@injectable()
export class HandbookCallbacks implements OnLoad
{
constructor(
@inject("HandbookController") protected handbookController: HandbookController,
)
constructor(@inject("HandbookController") protected handbookController: HandbookController)
{}
public async onLoad(): Promise<void>

View File

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

View File

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

View File

@ -24,9 +24,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
@injectable()
export class InventoryCallbacks
{
constructor(
@inject("InventoryController") protected inventoryController: InventoryController,
)
constructor(@inject("InventoryController") protected inventoryController: InventoryController)
{}
/** Handle Move event */

View File

@ -8,9 +8,7 @@ import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData";
@injectable()
export class NoteCallbacks
{
constructor(
@inject("NoteController") protected noteController: NoteController,
)
constructor(@inject("NoteController") protected noteController: NoteController)
{}
/** Handle AddNote event */

View File

@ -36,9 +36,9 @@ export class NotifierCallbacks
* Take our array of JSON message objects and cast them to JSON strings, so that they can then
* be sent to client as NEWLINE separated strings... yup.
*/
this.notifierController.notifyAsync(tmpSessionID)
.then((messages: any) => messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n"))
.then((text) => this.httpServerHelper.sendTextJson(resp, text));
this.notifierController.notifyAsync(tmpSessionID).then((messages: any) =>
messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n")
).then((text) => this.httpServerHelper.sendTextJson(resp, text));
}
/** Handle push/notifier/get */
@ -68,9 +68,7 @@ export class NotifierCallbacks
sessionID: string,
): IGetBodyResponseData<ISelectProfileResponse>
{
return this.httpResponse.getBody({
status: "ok",
});
return this.httpResponse.getBody({status: "ok"});
}
public notify(url: string, info: any, sessionID: string): string

View File

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

View File

@ -91,10 +91,7 @@ export class ProfileCallbacks
return this.httpResponse.getBody(null, 1, "The nickname is too short");
}
return this.httpResponse.getBody({
status: 0,
nicknamechangedate: this.timeUtil.getTimestamp(),
});
return this.httpResponse.getBody({status: 0, nicknamechangedate: this.timeUtil.getTimestamp()});
}
/**
@ -141,8 +138,7 @@ export class ProfileCallbacks
{
const response: GetProfileStatusResponseData = {
maxPveCountExceeded: false,
profiles: [
{
profiles: [{
profileid: `scav${sessionID}`,
profileToken: null,
status: "Free",
@ -154,16 +150,7 @@ export class ProfileCallbacks
raidMode: "Online",
mode: "deathmatch",
shortId: "xxx1x1",
},
{
profileid: `pmc${sessionID}`,
profileToken: null,
status: "Free",
sid: "",
ip: "",
port: 0,
},
],
}, {profileid: `pmc${sessionID}`, profileToken: null, status: "Free", sid: "", ip: "", port: 0}],
};
return this.httpResponse.getBody(response);

View File

@ -9,9 +9,7 @@ import { ITraderRepairActionDataRequest } from "@spt-aki/models/eft/repair/ITrad
@injectable()
export class RepairCallbacks
{
constructor(
@inject("RepairController") protected repairController: RepairController,
)
constructor(@inject("RepairController") protected repairController: RepairController)
{}
/**

View File

@ -10,9 +10,7 @@ import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISel
@injectable()
export class TradeCallbacks
{
constructor(
@inject("TradeController") protected tradeController: TradeController,
)
constructor(@inject("TradeController") protected tradeController: TradeController)
{}
/**

View File

@ -8,9 +8,7 @@ import { IWishlistActionData } from "@spt-aki/models/eft/wishlist/IWishlistActio
@injectable()
export class WishlistCallbacks
{
constructor(
@inject("WishlistController") protected wishlistController: WishlistController,
)
constructor(@inject("WishlistController") protected wishlistController: WishlistController)
{}
/** Handle AddToWishList event */

View File

@ -57,11 +57,7 @@ export class BotController
*/
public getBotPresetGenerationLimit(type: string): number
{
const value = this.botConfig.presetBatch[
(type === "assaultGroup")
? "assault"
: type
];
const value = this.botConfig.presetBatch[(type === "assaultGroup") ? "assault" : type];
if (!value)
{
@ -275,9 +271,7 @@ export class BotController
this.logger.warning(this.localisationService.getText("bot-missing_saved_match_info"));
}
const mapName = raidConfig
? raidConfig.location
: defaultMapCapId;
const mapName = raidConfig ? raidConfig.location : defaultMapCapId;
let botCap = this.botConfig.maxBotCap[mapName.toLowerCase()];
if (!botCap)
@ -296,9 +290,6 @@ export class BotController
public getAiBotBrainTypes(): any
{
return {
pmc: this.pmcConfig.pmcType,
assault: this.botConfig.assaultBrainType,
};
return {pmc: this.pmcConfig.pmcType, assault: this.botConfig.assaultBrainType};
}
}

View File

@ -8,9 +8,7 @@ import { inject, injectable } from "tsyringe";
@injectable()
export class ClientLogController
{
constructor(
@inject("WinstonLogger") protected logger: ILogger,
)
constructor(@inject("WinstonLogger") protected logger: ILogger)
{}
/**

View File

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

View File

@ -435,10 +435,7 @@ export class GameController
*/
public getServer(sessionId: string): IServerDetails[]
{
return [{
ip: this.httpConfig.ip,
port: this.httpConfig.port,
}];
return [{ip: this.httpConfig.ip, port: this.httpConfig.port}];
}
/**
@ -446,9 +443,7 @@ export class GameController
*/
public getCurrentGroup(sessionId: string): ICurrentGroupResponse
{
return {
squad: [],
};
return {squad: []};
}
/**
@ -456,10 +451,7 @@ export class GameController
*/
public getValidGameVersion(sessionId: string): ICheckVersionResponse
{
return {
isvalid: true,
latestVersion: this.coreConfig.compatibleTarkovVersion,
};
return {isvalid: true, latestVersion: this.coreConfig.compatibleTarkovVersion};
}
/**
@ -467,10 +459,7 @@ export class GameController
*/
public getKeepAlive(sessionId: string): IGameKeepAliveResponse
{
return {
msg: "OK",
utc_time: new Date().getTime() / 1000,
};
return {msg: "OK", utc_time: new Date().getTime() / 1000};
}
/**
@ -777,9 +766,7 @@ export class GameController
const modDetails = activeMods[modKey];
if (
fullProfile.aki.mods.some((x) =>
x.author === modDetails.author
&& x.name === modDetails.name
&& x.version === modDetails.version
x.author === modDetails.author && x.name === modDetails.name && x.version === modDetails.version
)
)
{

View File

@ -93,10 +93,7 @@ export class HideoutController
const items = request.items.map((reqItem) =>
{
const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id);
return {
inventoryItem: item,
requestedItem: reqItem,
};
return {inventoryItem: item, requestedItem: reqItem};
});
// If it's not money, its construction / barter items
@ -375,11 +372,7 @@ export class HideoutController
const itemsToAdd = Object.entries(addItemToHideoutRequest.items).map((kvp) =>
{
const item = pmcData.Inventory.items.find((invItem) => invItem._id === kvp[1].id);
return {
inventoryItem: item,
requestedItem: kvp[1],
slot: kvp[0],
};
return {inventoryItem: item, requestedItem: kvp[1], slot: kvp[0]};
});
const hideoutArea = pmcData.Hideout.Areas.find((area) => area.type === addItemToHideoutRequest.areaType);
@ -631,10 +624,7 @@ export class HideoutController
return this.httpResponse.appendErrorToOutput(output);
}
if (
inventoryItem.upd?.StackObjectsCount
&& inventoryItem.upd.StackObjectsCount > requestedItem.count
)
if (inventoryItem.upd?.StackObjectsCount && inventoryItem.upd.StackObjectsCount > requestedItem.count)
{
inventoryItem.upd.StackObjectsCount -= requestedItem.count;
}
@ -693,9 +683,7 @@ export class HideoutController
*/
protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void
{
pmcData.Hideout.Production[`ScavCase${recipeId}`] = {
Products: rewards,
};
pmcData.Hideout.Production[`ScavCase${recipeId}`] = {Products: rewards};
}
/**
@ -799,13 +787,7 @@ export class HideoutController
id = this.presetHelper.getDefaultPreset(id)._id;
}
const newReq = {
items: [{
item_id: id,
count: recipe.count,
}],
tid: "ragfair",
};
const newReq = {items: [{item_id: id, count: recipe.count}], tid: "ragfair"};
const entries = Object.entries(pmcData.Hideout.Production);
let prodId: string;
@ -889,9 +871,7 @@ export class HideoutController
// Handle the isEncoded flag from recipe
if (recipe.isEncoded)
{
const upd: Upd = {
RecodableComponent: {IsEncoded: true},
};
const upd: Upd = {RecodableComponent: {IsEncoded: true}};
return this.inventoryHelper.addItem(pmcData, newReq, output, sessionID, callback, true, upd);
}
@ -957,18 +937,13 @@ export class HideoutController
{
id = this.presetHelper.getDefaultPreset(id)._id;
}
const numOfItems = !x.upd?.StackObjectsCount
? 1
: x.upd.StackObjectsCount;
const numOfItems = !x.upd?.StackObjectsCount ? 1 : x.upd.StackObjectsCount;
return {item_id: id, count: numOfItems};
},
);
const newReq = {
items: itemsToAdd,
tid: "ragfair",
};
const newReq = {items: itemsToAdd, tid: "ragfair"};
const callback = () =>
{
@ -1060,10 +1035,7 @@ export class HideoutController
// Check if counter exists, add placeholder if it doesn't
if (!pmcData.Stats.Eft.OverallCounters.Items.find((x) => x.Key.includes("ShootingRangePoints")))
{
pmcData.Stats.Eft.OverallCounters.Items.push({
Key: ["ShootingRangePoints"],
Value: 0,
});
pmcData.Stats.Eft.OverallCounters.Items.push({Key: ["ShootingRangePoints"], Value: 0});
}
// Find counter by key and update value
@ -1094,10 +1066,7 @@ export class HideoutController
const items = request.items.map((reqItem) =>
{
const item = pmcData.Inventory.items.find((invItem) => invItem._id === reqItem.id);
return {
inventoryItem: item,
requestedItem: reqItem,
};
return {inventoryItem: item, requestedItem: reqItem};
});
// If it's not money, its construction / barter items

View File

@ -625,10 +625,7 @@ export class InsuranceController
// add items to InsuredItems list once money has been paid
for (const key of body.items)
{
pmcData.InsuredItems.push({
tid: body.tid,
itemId: inventoryItemsHash[key]._id,
});
pmcData.InsuredItems.push({tid: body.tid, itemId: inventoryItemsHash[key]._id});
}
this.profileHelper.addSkillPointsToPlayer(pmcData, SkillTypes.CHARISMA, itemsToInsureCount * 0.01);

View File

@ -287,9 +287,7 @@ export class InventoryController
if (!sourceItem.upd)
{
sourceItem.upd = {
StackObjectsCount: 1,
};
sourceItem.upd = {StackObjectsCount: 1};
}
else if (!sourceItem.upd.StackObjectsCount)
{
@ -458,11 +456,7 @@ export class InventoryController
public foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse
{
// Fix for folding weapons while on they're in the Scav inventory
if (
body.fromOwner
&& body.fromOwner.type === "Profile"
&& body.fromOwner.id !== pmcData._id
)
if (body.fromOwner && body.fromOwner.type === "Profile" && body.fromOwner.id !== pmcData._id)
{
pmcData = this.profileHelper.getScavProfile(sessionID);
}
@ -476,10 +470,7 @@ export class InventoryController
}
}
return {
warnings: [],
profileChanges: {},
};
return {warnings: [], profileChanges: {}};
}
/**
@ -519,10 +510,7 @@ export class InventoryController
);
}
return {
warnings: [],
profileChanges: {},
};
return {warnings: [], profileChanges: {}};
}
/**
@ -551,10 +539,7 @@ export class InventoryController
}
}
return {
warnings: [],
profileChanges: {},
};
return {warnings: [], profileChanges: {}};
}
/**
@ -872,10 +857,7 @@ export class InventoryController
const containerDetails = this.itemHelper.getItem(openedItem._tpl);
const isSealedWeaponBox = containerDetails[1]._name.includes("event_container_airdrop");
const newItemRequest: IAddItemRequestData = {
tid: "RandomLootContainer",
items: [],
};
const newItemRequest: IAddItemRequestData = {tid: "RandomLootContainer", items: []};
let foundInRaid = false;
if (isSealedWeaponBox)

View File

@ -135,10 +135,7 @@ export class LocationController
locations[mapBase._Id] = mapBase;
}
return {
locations: locations,
paths: locationsFromDb.base.paths,
};
return {locations: locations, paths: locationsFromDb.base.paths};
}
/**

View File

@ -101,10 +101,7 @@ export class MatchController
/** Handle match/group/start_game */
public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult
{
const output: IJoinMatchResult = {
maxPveCountExceeded: false,
profiles: [],
};
const output: IJoinMatchResult = {maxPveCountExceeded: false, profiles: []};
// get list of players joining into the match
output.profiles.push({
@ -128,10 +125,7 @@ export class MatchController
/** Handle client/match/group/status */
public getGroupStatus(info: IGetGroupStatusRequestData): any
{
return {
players: [],
maxPveCountExceeded: false,
};
return {players: [], maxPveCountExceeded: false};
}
/**
@ -226,18 +220,13 @@ export class MatchController
const parentId = this.hashUtil.generate();
for (const item of loot)
{
mailableLoot.push(
{
mailableLoot.push({
_id: item.id,
_tpl: item.tpl,
slotId: "main",
parentId: parentId,
upd: {
StackObjectsCount: item.stackCount,
SpawnedInSession: true,
},
},
);
upd: {StackObjectsCount: item.stackCount, SpawnedInSession: true},
});
}
// Send message from fence giving player reward generated above

View File

@ -9,17 +9,12 @@ import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@injectable()
export class NoteController
{
constructor(
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
)
constructor(@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder)
{}
public addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse
{
const newNote: Note = {
Time: body.note.Time,
Text: body.note.Text,
};
const newNote: Note = {Time: body.note.Time, Text: body.note.Text};
pmcData.Notes.Notes.push(newNote);
return this.eventOutputHolder.getOutput(sessionID);

View File

@ -33,10 +33,7 @@ export class PresetBuildController
const profile = this.saveServer.getProfile(sessionID);
if (!profile.userbuilds)
{
profile.userbuilds = {
equipmentBuilds: [],
weaponBuilds: [],
};
profile.userbuilds = {equipmentBuilds: [], weaponBuilds: []};
}
// Ensure the secure container in the default presets match what the player has equipped
@ -87,13 +84,7 @@ export class PresetBuildController
// Create new object ready to save into profile userbuilds.weaponBuilds
const newId = this.hashUtil.generate(); // Id is empty, generate it
const newBuild: IWeaponBuild = {
id: newId,
name: body.name,
root: body.root,
items: body.items,
type: "weapon",
};
const newBuild: IWeaponBuild = {id: newId, name: body.name, root: body.root, items: body.items, type: "weapon"};
const savedWeaponBuilds = this.saveServer.getProfile(sessionId).userbuilds.weaponBuilds;
const existingBuild = savedWeaponBuilds.find((x) => x.id === body.id);

View File

@ -164,10 +164,7 @@ export class ProfileController
// Create profile
const profileDetails: IAkiProfile = {
info: account,
characters: {
pmc: pmcData,
scav: {} as IPmcData,
},
characters: {pmc: pmcData, scav: {} as IPmcData},
suits: profile.suits,
userbuilds: profile.userbuilds,
dialogues: profile.dialogues,
@ -351,13 +348,6 @@ export class ProfileController
*/
public getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]
{
return [{
_id: this.hashUtil.generate(),
Info: {
Level: 1,
Side: "Bear",
Nickname: info.nickname,
},
}];
return [{_id: this.hashUtil.generate(), Info: {Level: 1, Side: "Bear", Nickname: info.nickname}}];
}
}

View File

@ -448,11 +448,9 @@ export class QuestController
const change = {};
change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id];
const responseData: IPmcDataRepeatableQuest = {
id: repeatableSettings.id
?? this.questConfig.repeatableQuests.find((x) =>
id: repeatableSettings.id ?? this.questConfig.repeatableQuests.find((x) =>
x.name === repeatableQuestProfile.sptRepatableGroupName
)
.id,
).id,
name: repeatableSettings.name,
endTime: repeatableSettings.endTime,
changeRequirement: change,
@ -957,10 +955,6 @@ export class QuestController
return;
}
pmcData.BackendCounters[conditionId] = {
id: conditionId,
qid: questId,
value: counterValue,
};
pmcData.BackendCounters[conditionId] = {id: conditionId, qid: questId, value: counterValue};
}
}

View File

@ -326,11 +326,7 @@ export class RagfairController
const min = offers[0].requirementsCost; // Get first item from array as its pre-sorted
const max = offers.at(-1).requirementsCost; // Get last item from array as its pre-sorted
return {
avg: (min + max) / 2,
min: min,
max: max,
};
return {avg: (min + max) / 2, min: min, max: max};
}
// No offers listed, get price from live ragfair price list prices.json
else
@ -344,11 +340,7 @@ export class RagfairController
tplPrice = this.handbookHelper.getTemplatePrice(getPriceRequest.templateId);
}
return {
avg: tplPrice,
min: tplPrice,
max: tplPrice,
};
return {avg: tplPrice, min: tplPrice, max: tplPrice};
}
}
@ -399,9 +391,7 @@ export class RagfairController
const qualityMultiplier = this.itemHelper.getItemQualityModifier(rootItem);
const averageOfferPrice = this.ragfairPriceService.getFleaPriceForItem(rootItem._tpl)
* rootItem.upd.StackObjectsCount * qualityMultiplier;
const itemStackCount = (offerRequest.sellInOnePiece)
? 1
: rootItem.upd.StackObjectsCount;
const itemStackCount = (offerRequest.sellInOnePiece) ? 1 : rootItem.upd.StackObjectsCount;
// Get averaged price of a single item being listed
const averageSingleItemPrice = (offerRequest.sellInOnePiece)
@ -623,11 +613,7 @@ export class RagfairController
const formattedRequirements: IBarterScheme[] = requirements.map((item) =>
{
return {
_tpl: item._tpl,
count: item.count,
onlyFunctional: item.onlyFunctional,
};
return {_tpl: item._tpl, count: item.count, onlyFunctional: item.onlyFunctional};
});
return this.ragfairOfferGenerator.createFleaOffer(
@ -756,12 +742,7 @@ export class RagfairController
return {
tid: "ragfair",
Action: "TradingConfirm",
scheme_items: [
{
id: this.paymentHelper.getCurrency(currency),
count: Math.round(value),
},
],
scheme_items: [{id: this.paymentHelper.getCurrency(currency), count: Math.round(value)}],
type: "",
item_id: "",
count: 0,

View File

@ -99,8 +99,7 @@ export class RepeatableQuestController
const currentRepeatableQuestType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData);
if (
repeatableConfig.side === "Pmc"
&& pmcData.Info.Level >= repeatableConfig.minPlayerLevel
repeatableConfig.side === "Pmc" && pmcData.Info.Level >= repeatableConfig.minPlayerLevel
|| repeatableConfig.side === "Scav" && scavQuestUnlocked
)
{
@ -216,8 +215,7 @@ export class RepeatableQuestController
// Elite charisma skill gives extra daily quest(s)
return repeatableConfig.numQuests
+ this.databaseServer.getTables().globals.config.SkillsSettings.Charisma.BonusSettings
.EliteBonusSettings
.RepeatableQuestExtraCount;
.EliteBonusSettings.RepeatableQuestExtraCount;
}
return repeatableConfig.numQuests;
@ -335,17 +333,7 @@ export class RepeatableQuestController
{
return {
types: repeatableConfig.types.slice(),
pool: {
Exploration: {
locations: {},
},
Elimination: {
targets: {},
},
Pickup: {
locations: {},
},
},
pool: {Exploration: {locations: {}}, Elimination: {targets: {}}, Pickup: {locations: {}}},
};
}

View File

@ -24,12 +24,7 @@ export class WeatherController
/** Handle client/weather */
public generate(): IWeatherData
{
let result: IWeatherData = {
acceleration: 0,
time: "",
date: "",
weather: null,
};
let result: IWeatherData = {acceleration: 0, time: "", date: "", weather: null};
result = this.weatherGenerator.calculateGameTime(result);
result.weather = this.weatherGenerator.generateWeather();

View File

@ -8,9 +8,7 @@ import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@injectable()
export class WishlistController
{
constructor(
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
)
constructor(@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder)
{}
/** Handle AddToWishList */

View File

@ -608,9 +608,7 @@ export class Container
con.register<BotGenerationCacheService>("BotGenerationCacheService", BotGenerationCacheService, {
lifecycle: Lifecycle.Singleton,
});
con.register<LocalisationService>("LocalisationService", LocalisationService, {
lifecycle: Lifecycle.Singleton,
});
con.register<LocalisationService>("LocalisationService", LocalisationService, {lifecycle: Lifecycle.Singleton});
con.register<CustomLocationWaveService>("CustomLocationWaveService", CustomLocationWaveService, {
lifecycle: Lifecycle.Singleton,
});

View File

@ -94,18 +94,12 @@ export class SaveLoadRouter extends Router
export class HandledRoute
{
constructor(
public route: string,
public dynamic: boolean,
)
constructor(public route: string, public dynamic: boolean)
{}
}
export class RouteAction
{
constructor(
public url: string,
public action: (url: string, info: any, sessionID: string, output: string) => any,
)
constructor(public url: string, public action: (url: string, info: any, sessionID: string, output: string) => any)
{}
}

View File

@ -97,9 +97,7 @@ export class BotEquipmentModGenerator
}
// Ensure submods for nvgs all spawn together
forceSpawn = (modSlot === "mod_nvg")
? true
: false;
forceSpawn = (modSlot === "mod_nvg") ? true : false;
let modTpl: string;
let found = false;
@ -290,13 +288,7 @@ export class BotEquipmentModGenerator
if (this.modSlotCanHoldScope(modSlot, modToAddTemplate._parent))
{
// mod_mount was picked to be added to weapon, force scope chance to ensure its filled
const scopeSlots = [
"mod_scope",
"mod_scope_000",
"mod_scope_001",
"mod_scope_002",
"mod_scope_003",
];
const scopeSlots = ["mod_scope", "mod_scope_000", "mod_scope_001", "mod_scope_002", "mod_scope_003"];
this.adjustSlotSpawnChances(modSpawnChances, scopeSlots, 100);
// Hydrate pool of mods that fit into mount as its a randomisable slot
@ -310,11 +302,7 @@ export class BotEquipmentModGenerator
// If picked item is muzzle adapter that can hold a child, adjust spawn chance
if (this.modSlotCanHoldMuzzleDevices(modSlot, modToAddTemplate._parent))
{
const muzzleSlots = [
"mod_muzzle",
"mod_muzzle_000",
"mod_muzzle_001",
];
const muzzleSlots = ["mod_muzzle", "mod_muzzle_000", "mod_muzzle_001"];
// Make chance of muzzle devices 95%, nearly certain but not guaranteed
this.adjustSlotSpawnChances(modSpawnChances, muzzleSlots, 95);
}
@ -340,8 +328,7 @@ export class BotEquipmentModGenerator
// If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure sub-stock gets added
// Or if mod_stock is configured to be forced on
if (
modSlot === "mod_stock"
&& (modToAddTemplate._props.Slots.find((x) =>
modSlot === "mod_stock" && (modToAddTemplate._props.Slots.find((x) =>
x._name.includes("mod_stock") || botEquipConfig.forceStock
))
)
@ -435,8 +422,7 @@ export class BotEquipmentModGenerator
"mod_scope_001",
"mod_scope_002",
"mod_scope_003",
].includes(modSlot.toLowerCase())
&& modsParentId === BaseClasses.MOUNT;
].includes(modSlot.toLowerCase()) && modsParentId === BaseClasses.MOUNT;
}
/**
@ -1025,12 +1011,7 @@ export class BotEquipmentModGenerator
{
const modSlotId = slot._name;
const modId = this.hashUtil.generate();
items.push({
_id: modId,
_tpl: modTpl,
parentId: parentId,
slotId: modSlotId,
});
items.push({_id: modId, _tpl: modTpl, parentId: parentId, slotId: modSlotId});
}
}

View File

@ -99,10 +99,7 @@ export class BotGenerator
* @param botGenerationDetails details on how to generate bots
* @returns array of bots
*/
public prepareAndGenerateBots(
sessionId: string,
botGenerationDetails: BotGenerationDetails,
): IBotBase[]
public prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]
{
const output: IBotBase[] = [];
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
@ -114,11 +111,9 @@ export class BotGenerator
bot.Info.Settings.BotDifficulty = botGenerationDetails.botDifficulty;
// Get raw json data for bot (Cloned)
const botJsonTemplate = this.jsonUtil.clone(this.botHelper.getBotTemplate(
(botGenerationDetails.isPmc)
? bot.Info.Side
: botGenerationDetails.role,
));
const botJsonTemplate = this.jsonUtil.clone(
this.botHelper.getBotTemplate((botGenerationDetails.isPmc) ? bot.Info.Side : botGenerationDetails.role),
);
bot = this.generateBot(sessionId, bot, botJsonTemplate, botGenerationDetails);
@ -328,9 +323,7 @@ export class BotGenerator
*/
protected generateHealth(healthObj: Health, playerScav = false): PmcHealth
{
const bodyParts = playerScav
? healthObj.BodyParts[0]
: this.randomUtil.getArrayValue(healthObj.BodyParts);
const bodyParts = playerScav ? healthObj.BodyParts[0] : this.randomUtil.getArrayValue(healthObj.BodyParts);
const newHealth: PmcHealth = {
Hydration: {
@ -437,10 +430,7 @@ export class BotGenerator
}
// All skills have id and progress props
const skillToAdd: IBaseSkill = {
Id: skillKey,
Progress: this.randomUtil.getInt(skill.min, skill.max),
};
const skillToAdd: IBaseSkill = {Id: skillKey, Progress: this.randomUtil.getInt(skill.min, skill.max)};
// Common skills have additional props
if (isCommonSkills)

View File

@ -112,26 +112,11 @@ export class BotInventoryGenerator
return {
items: [
{
_id: equipmentId,
_tpl: equipmentTpl,
},
{
_id: stashId,
_tpl: stashTpl,
},
{
_id: questRaidItemsId,
_tpl: questRaidItemsTpl,
},
{
_id: questStashItemsId,
_tpl: questStashItemsTpl,
},
{
_id: sortingTableId,
_tpl: sortingTableTpl,
},
{_id: equipmentId, _tpl: equipmentTpl},
{_id: stashId, _tpl: stashTpl},
{_id: questRaidItemsId, _tpl: questRaidItemsTpl},
{_id: questStashItemsId, _tpl: questStashItemsTpl},
{_id: sortingTableId, _tpl: sortingTableTpl},
],
equipment: equipmentId,
stash: stashId,
@ -421,24 +406,17 @@ export class BotInventoryGenerator
protected getDesiredWeaponsForBot(equipmentChances: Chances): {slot: EquipmentSlots; shouldSpawn: boolean;}[]
{
const shouldSpawnPrimary = this.randomUtil.getChance100(equipmentChances.equipment.FirstPrimaryWeapon);
return [
{
slot: EquipmentSlots.FIRST_PRIMARY_WEAPON,
shouldSpawn: shouldSpawnPrimary,
},
{
return [{slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary}, {
slot: EquipmentSlots.SECOND_PRIMARY_WEAPON,
shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon)
: false,
},
{
}, {
slot: EquipmentSlots.HOLSTER,
shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol
: true, // No primary = force pistol
},
];
}];
}
/**

View File

@ -237,52 +237,16 @@ export class BotLootGenerator
protected addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void
{
const grizzly = this.itemHelper.getItem("590c657e86f77412b013051d")[1];
this.addLootFromPool(
[grizzly],
[EquipmentSlots.SECURED_CONTAINER],
2,
botInventory,
botRole,
false,
0,
true,
);
this.addLootFromPool([grizzly], [EquipmentSlots.SECURED_CONTAINER], 2, botInventory, botRole, false, 0, true);
const surv12 = this.itemHelper.getItem("5d02797c86f774203f38e30a")[1];
this.addLootFromPool(
[surv12],
[EquipmentSlots.SECURED_CONTAINER],
1,
botInventory,
botRole,
false,
0,
true,
);
this.addLootFromPool([surv12], [EquipmentSlots.SECURED_CONTAINER], 1, botInventory, botRole, false, 0, true);
const morphine = this.itemHelper.getItem("544fb3f34bdc2d03748b456a")[1];
this.addLootFromPool(
[morphine],
[EquipmentSlots.SECURED_CONTAINER],
3,
botInventory,
botRole,
false,
0,
true,
);
this.addLootFromPool([morphine], [EquipmentSlots.SECURED_CONTAINER], 3, botInventory, botRole, false, 0, true);
const afak = this.itemHelper.getItem("60098ad7c2240c0fe85c570a")[1];
this.addLootFromPool(
[afak],
[EquipmentSlots.SECURED_CONTAINER],
2,
botInventory,
botRole,
false,
0,
true,
);
this.addLootFromPool([afak], [EquipmentSlots.SECURED_CONTAINER], 2, botInventory, botRole, false, 0, true);
}
/**

View File

@ -258,9 +258,7 @@ export class BotWeaponGenerator
else
{
// Already exists, update values
existingItemWithSlot.upd = {
StackObjectsCount: 1,
};
existingItemWithSlot.upd = {StackObjectsCount: 1};
existingItemWithSlot._tpl = ammoTpl;
}
}
@ -532,11 +530,7 @@ export class BotWeaponGenerator
[EquipmentSlots.SECURED_CONTAINER],
id,
ammoTpl,
[{
_id: id,
_tpl: ammoTpl,
upd: {StackObjectsCount: stackSize},
}],
[{_id: id, _tpl: ammoTpl, upd: {StackObjectsCount: stackSize}}],
inventory,
);
}
@ -705,17 +699,13 @@ export class BotWeaponGenerator
*/
protected fillUbgl(weaponMods: Item[], ubglMod: Item, ubglAmmoTpl: string): void
{
weaponMods.push(
{
weaponMods.push({
_id: this.hashUtil.generate(),
_tpl: ubglAmmoTpl,
parentId: ubglMod._id,
slotId: "patron_in_weapon",
upd: {
StackObjectsCount: 1,
},
},
);
upd: {StackObjectsCount: 1},
});
}
/**

View File

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

View File

@ -247,8 +247,7 @@ export class LocationGenerator
*/
protected getRandomisableContainersOnMap(staticContainers: IStaticContainerData[]): IStaticContainerData[]
{
return staticContainers
.filter((x) =>
return staticContainers.filter((x) =>
x.probability !== 1 && !x.template.IsAlwaysSpawn
&& !this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes(
x.template.Items[0]._tpl,
@ -530,9 +529,7 @@ export class LocationGenerator
continue;
}
itemDistribution.push(
new ProbabilityObject(icd.tpl, icd.relativeProbability),
);
itemDistribution.push(new ProbabilityObject(icd.tpl, icd.relativeProbability));
}
return itemDistribution;
@ -571,10 +568,7 @@ export class LocationGenerator
// Draw from random distribution
const desiredSpawnpointCount = Math.round(
this.getLooseLootMultiplerForLocation(locationName)
* this.randomUtil.randn(
dynamicLootDist.spawnpointCount.mean,
dynamicLootDist.spawnpointCount.std,
),
* this.randomUtil.randn(dynamicLootDist.spawnpointCount.mean, dynamicLootDist.spawnpointCount.std),
);
// Positions not in forced but have 100% chance to spawn
@ -598,9 +592,7 @@ export class LocationGenerator
continue;
}
spawnpointArray.push(
new ProbabilityObject(spawnpoint.template.Id, spawnpoint.probability, spawnpoint),
);
spawnpointArray.push(new ProbabilityObject(spawnpoint.template.Id, spawnpoint.probability, spawnpoint));
}
// Select a number of spawn points to add loot to
@ -665,9 +657,7 @@ export class LocationGenerator
continue;
}
itemArray.push(
new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability),
);
itemArray.push(new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability));
}
// Draw a random item from spawn points possible items
@ -720,9 +710,7 @@ export class LocationGenerator
for (const si of items)
{
// use locationId as template.Id is the same across all items
spawnpointArray.push(
new ProbabilityObject(si.locationId, si.probability, si),
);
spawnpointArray.push(new ProbabilityObject(si.locationId, si.probability, si));
}
// Choose 1 out of all found spawn positions for spawn id and add to loot array
@ -792,22 +780,13 @@ export class LocationGenerator
? 1
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
itemWithMods.push(
{
_id: this.objectId.generate(),
_tpl: chosenTpl,
upd: {StackObjectsCount: stackCount},
},
);
itemWithMods.push({_id: this.objectId.generate(), _tpl: chosenTpl, upd: {StackObjectsCount: stackCount}});
}
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX))
{
// Fill with cartrdiges
const ammoBoxTemplate = this.itemHelper.getItem(chosenTpl)[1];
const ammoBoxItem: Item[] = [{
_id: this.objectId.generate(),
_tpl: chosenTpl,
}];
const ammoBoxItem: Item[] = [{_id: this.objectId.generate(), _tpl: chosenTpl}];
this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, ammoBoxTemplate);
itemWithMods.push(...ammoBoxItem);
}
@ -815,10 +794,7 @@ export class LocationGenerator
{
// Create array with just magazine + randomised amount of cartridges
const magazineTemplate = this.itemHelper.getItem(chosenTpl)[1];
const magazineItem: Item[] = [{
_id: this.objectId.generate(),
_tpl: chosenTpl,
}];
const magazineItem: Item[] = [{_id: this.objectId.generate(), _tpl: chosenTpl}];
this.itemHelper.fillMagazineWithRandomCartridge(
magazineItem,
magazineTemplate,
@ -845,11 +821,7 @@ export class LocationGenerator
// Get inventory size of item
const size = this.itemHelper.getItemSize(itemWithMods, itemWithMods[0]._id);
return {
items: itemWithMods,
width: size.width,
height: size.height,
};
return {items: itemWithMods, width: size.width, height: size.height};
}
/**
@ -901,12 +873,7 @@ export class LocationGenerator
const itemTemplate = this.itemHelper.getItem(tpl)[1];
let width = itemTemplate._props.Width;
let height = itemTemplate._props.Height;
let items: Item[] = [
{
_id: this.objectId.generate(),
_tpl: tpl,
},
];
let items: Item[] = [{_id: this.objectId.generate(), _tpl: tpl}];
// Use passed in parentId as override for new item
if (parentId)
@ -1037,10 +1004,6 @@ export class LocationGenerator
items.splice(items.indexOf(items[0]), 1, ...magazineWithCartridges);
}
return {
items: items,
width: width,
height: height,
};
return {items: items, width: width, height: height};
}
}

View File

@ -19,10 +19,7 @@ import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemSer
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
type ItemLimit = {
current: number;
max: number;
};
type ItemLimit = {current: number; max: number;};
@injectable()
export class LootGenerator
@ -134,10 +131,7 @@ export class LootGenerator
const itemTypeCounts: Record<string, ItemLimit> = {};
for (const itemTypeId in limits)
{
itemTypeCounts[itemTypeId] = {
current: 0,
max: limits[itemTypeId],
};
itemTypeCounts[itemTypeId] = {current: 0, max: limits[itemTypeId]};
}
return itemTypeCounts;
@ -174,10 +168,7 @@ export class LootGenerator
};
// Check if armor has level in allowed whitelist
if (
randomItem._parent === BaseClasses.ARMOR
|| randomItem._parent === BaseClasses.VEST
)
if (randomItem._parent === BaseClasses.ARMOR || randomItem._parent === BaseClasses.VEST)
{
if (!options.armorLevelWhitelist.includes(Number(randomItem._props.armorClass)))
{
@ -277,11 +268,7 @@ export class LootGenerator
return false;
}
const newLootItem: LootItem = {
tpl: randomPreset._items[0]._tpl,
isPreset: true,
stackCount: 1,
};
const newLootItem: LootItem = {tpl: randomPreset._items[0]._tpl, isPreset: true, stackCount: 1};
result.push(newLootItem);
@ -405,8 +392,7 @@ export class LootGenerator
}
// Get all items of the desired type + not quest items + not globally blacklisted
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items)
.filter((x) =>
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items).filter((x) =>
x._parent === rewardTypeId
&& x._type.toLowerCase() === "item"
&& !this.itemFilterService.isItemBlacklisted(x._id)

View File

@ -66,9 +66,7 @@ export class PlayerScavGenerator
const existingScavData = this.jsonUtil.clone(profile.characters.scav);
// scav profile can be empty on first profile creation
const scavKarmaLevel = (Object.keys(existingScavData).length === 0)
? 0
: this.getScavKarmaLevel(pmcData);
const scavKarmaLevel = (Object.keys(existingScavData).length === 0) ? 0 : this.getScavKarmaLevel(pmcData);
// use karma level to get correct karmaSettings
const playerScavKarmaSettings = this.playerScavConfig.karmaLevel[scavKarmaLevel];
@ -258,11 +256,7 @@ export class PlayerScavGenerator
protected getDefaultScavSkills(): Skills
{
return {
Common: [],
Mastering: [],
Points: 0,
};
return {Common: [], Mastering: [], Points: 0};
}
protected getScavStats(scavProfile: IPmcData): Stats

View File

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

View File

@ -636,10 +636,7 @@ export class RagfairOfferGenerator
{
const totalCapacity = itemDetails._props.MaxResource;
const remainingFuel = Math.round(totalCapacity * multiplier);
item.upd.Resource = {
UnitsConsumed: totalCapacity - remainingFuel,
Value: remainingFuel,
};
item.upd.Resource = {UnitsConsumed: totalCapacity - remainingFuel, Value: remainingFuel};
}
}
@ -653,7 +650,8 @@ export class RagfairOfferGenerator
item.upd.Repairable.Durability = Math.round(item.upd.Repairable.Durability * multiplier) || 1;
// randomize max durability, store to a temporary value so we can still compare the max durability
let tempMaxDurability = Math.round(
let tempMaxDurability =
Math.round(
this.randomUtil.getFloat(item.upd.Repairable.Durability - 5, item.upd.Repairable.MaxDurability + 5),
) || item.upd.Repairable.Durability;
@ -689,38 +687,27 @@ export class RagfairOfferGenerator
if (isRepairable && props.Durability > 0)
{
item.upd.Repairable = {
Durability: props.Durability,
MaxDurability: props.Durability,
};
item.upd.Repairable = {Durability: props.Durability, MaxDurability: props.Durability};
}
if (isMedkit && props.MaxHpResource > 0)
{
item.upd.MedKit = {
HpResource: props.MaxHpResource,
};
item.upd.MedKit = {HpResource: props.MaxHpResource};
}
if (isKey)
{
item.upd.Key = {
NumberOfUsages: 0,
};
item.upd.Key = {NumberOfUsages: 0};
}
if (isConsumable)
{
item.upd.FoodDrink = {
HpPercent: props.MaxResource,
};
item.upd.FoodDrink = {HpPercent: props.MaxResource};
}
if (isRepairKit)
{
item.upd.RepairKit = {
Resource: props.MaxRepairResource,
};
item.upd.RepairKit = {Resource: props.MaxRepairResource};
}
return item;
@ -775,12 +762,7 @@ export class RagfairOfferGenerator
// Choose random item from price-filtered flea items
const randomItem = this.randomUtil.getArrayValue(filtered);
return [
{
count: barterItemCount,
_tpl: randomItem.tpl,
},
];
return [{count: barterItemCount, _tpl: randomItem.tpl}];
}
/**
@ -819,11 +801,6 @@ export class RagfairOfferGenerator
const price = this.ragfairPriceService.getDynamicOfferPriceForOffer(offerItems, currency, isPackOffer)
* multipler;
return [
{
count: price,
_tpl: currency,
},
];
return [{count: price, _tpl: currency}];
}
}

View File

@ -273,13 +273,12 @@ export class RepeatableQuestGenerator
// get all boss spawn information
const bossSpawns = Object.values(this.databaseServer.getTables().locations).filter((x) =>
"base" in x && "Id" in x.base
).map(
(x) => ({Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn}),
);
).map((x) => ({Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn}));
// filter for the current boss to spawn on map
const thisBossSpawns = bossSpawns.map(
(x) => ({Id: x.Id, BossSpawn: x.BossSpawn.filter((e) => e.BossName === targetKey)}),
).filter((x) => x.BossSpawn.length > 0);
const thisBossSpawns = bossSpawns.map((x) => ({
Id: x.Id,
BossSpawn: x.BossSpawn.filter((e) => e.BossName === targetKey),
})).filter((x) => x.BossSpawn.length > 0);
// remove blacklisted locations
const allowedSpawns = thisBossSpawns.filter((x) => !eliminationConfig.distLocationBlacklist.includes(x.Id));
// if the boss spawns on nom-blacklisted locations and the current location is allowed we can generate a distance kill requirement
@ -416,11 +415,7 @@ export class RepeatableQuestGenerator
protected generateEliminationLocation(location: string[]): IEliminationCondition
{
const propsObject: IEliminationCondition = {
_props: {
target: location,
id: this.objectId.generate(),
dynamicLocale: true,
},
_props: {target: location, id: this.objectId.generate(), dynamicLocale: true},
_parent: "Location",
};
@ -466,10 +461,7 @@ export class RepeatableQuestGenerator
// Dont allow distance + melee requirement
if (distance && allowedWeaponCategory !== "5b5f7a0886f77409407a7f96")
{
killConditionProps.distance = {
compareMethod: ">=",
value: distance,
};
killConditionProps.distance = {compareMethod: ">=", value: distance};
}
// Has specific weapon requirement
@ -484,10 +476,7 @@ export class RepeatableQuestGenerator
killConditionProps.weaponCategories = [allowedWeaponCategory];
}
return {
_props: killConditionProps,
_parent: "Kills",
};
return {_props: killConditionProps, _parent: "Kills"};
}
/**
@ -710,28 +699,15 @@ export class RepeatableQuestGenerator
const exitStatusCondition: IExplorationCondition = {
_parent: "ExitStatus",
_props: {
id: this.objectId.generate(),
dynamicLocale: true,
status: [
"Survived",
],
},
_props: {id: this.objectId.generate(), dynamicLocale: true, status: ["Survived"]},
};
const locationCondition: IExplorationCondition = {
_parent: "Location",
_props: {
id: this.objectId.generate(),
dynamicLocale: true,
target: locationTarget,
},
_props: {id: this.objectId.generate(), dynamicLocale: true, target: locationTarget},
};
quest.conditions.AvailableForFinish[0]._props.counter.id = this.objectId.generate();
quest.conditions.AvailableForFinish[0]._props.counter.conditions = [
exitStatusCondition,
locationCondition,
];
quest.conditions.AvailableForFinish[0]._props.counter.conditions = [exitStatusCondition, locationCondition];
quest.conditions.AvailableForFinish[0]._props.value = numExtracts;
quest.conditions.AvailableForFinish[0]._props.id = this.objectId.generate();
quest.location = this.getQuestLocationByMapId(locationKey);
@ -742,13 +718,11 @@ export class RepeatableQuestGenerator
// Scav exits are not listed at all in locations.base currently. If that changes at some point, additional filtering will be required
const mapExits =
(this.databaseServer.getTables().locations[locationKey.toLowerCase()].base as ILocationBase).exits;
const possibleExists = mapExits.filter(
(x) =>
const possibleExists = mapExits.filter((x) =>
(!("PassageRequirement" in x)
|| repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes(
x.PassageRequirement,
))
&& x.Chance > 0,
)) && x.Chance > 0
);
const exit = this.randomUtil.drawRandomFromList(possibleExists, 1)[0];
const exitCondition = this.generateExplorationExitCondition(exit);
@ -823,14 +797,7 @@ export class RepeatableQuestGenerator
*/
protected generateExplorationExitCondition(exit: Exit): IExplorationCondition
{
return {
_parent: "ExitName",
_props: {
exitName: exit.Name,
id: this.objectId.generate(),
dynamicLocale: true,
},
};
return {_parent: "ExitName", _props: {exitName: exit.Name, id: this.objectId.generate(), dynamicLocale: true}};
}
/**
@ -890,7 +857,8 @@ export class RepeatableQuestGenerator
1,
Math.round(this.mathUtil.interp1(pmcLevel, levelsConfig, itemsConfig)) + 1,
);
const rewardReputation = Math.round(
const rewardReputation =
Math.round(
100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig)
* this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
) / 100;
@ -901,17 +869,7 @@ export class RepeatableQuestGenerator
let roublesBudget = rewardRoubles;
let chosenRewardItems = this.chooseRewardItemsWithinBudget(repeatableConfig, roublesBudget);
const rewards: IRewards = {
Started: [],
Success: [
{
value: rewardXP,
type: "Experience",
index: 0,
},
],
Fail: [],
};
const rewards: IRewards = {Started: [], Success: [{value: rewardXP, type: "Experience", index: 0}], Fail: []};
if (traderId === Traders.PEACEKEEPER)
{
@ -988,12 +946,7 @@ export class RepeatableQuestGenerator
// Add rep reward to rewards array
if (rewardReputation > 0)
{
const reward: IReward = {
target: traderId,
value: rewardReputation,
type: "TraderStanding",
index: index,
};
const reward: IReward = {target: traderId, value: rewardReputation, type: "TraderStanding", index: index};
rewards.Success.push(reward);
}
@ -1057,21 +1010,9 @@ export class RepeatableQuestGenerator
protected generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward
{
const id = this.objectId.generate();
const rewardItem: IReward = {
target: id,
value: value,
type: "Item",
index: index,
};
const rewardItem: IReward = {target: id, value: value, type: "Item", index: index};
const rootItem = {
_id: id,
_tpl: tpl,
upd: {
StackObjectsCount: value,
SpawnedInSession: true,
},
};
const rootItem = {_id: id, _tpl: tpl, upd: {StackObjectsCount: value, SpawnedInSession: true}};
if (preset)
{
@ -1094,8 +1035,7 @@ export class RepeatableQuestGenerator
// check for specific baseclasses which don't make sense as reward item
// also check if the price is greater than 0; there are some items whose price can not be found
// those are not in the game yet (e.g. AGS grenade launcher)
return Object.entries(this.databaseServer.getTables().templates.items).filter(
([tpl, itemTemplate]) =>
return Object.entries(this.databaseServer.getTables().templates.items).filter(([tpl, itemTemplate]) =>
{
// Base "Item" item has no parent, ignore it
if (itemTemplate._parent === "")
@ -1104,8 +1044,7 @@ export class RepeatableQuestGenerator
}
return this.isValidRewardItem(tpl, repeatableQuestConfig);
},
);
});
}
/**
@ -1123,10 +1062,7 @@ export class RepeatableQuestGenerator
}
// Item is on repeatable or global blacklist
if (
repeatableQuestConfig.rewardBlacklist.includes(tpl)
|| this.itemFilterService.isItemBlacklisted(tpl)
)
if (repeatableQuestConfig.rewardBlacklist.includes(tpl) || this.itemFilterService.isItemBlacklisted(tpl))
{
return false;
}
@ -1152,8 +1088,7 @@ export class RepeatableQuestGenerator
// Skip globally blacklisted items + boss items
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
valid = !this.itemFilterService.isItemBlacklisted(tpl)
&& !this.itemFilterService.isBossItem(tpl);
valid = !this.itemFilterService.isItemBlacklisted(tpl) && !this.itemFilterService.isBossItem(tpl);
return valid;
}

View File

@ -279,11 +279,7 @@ export class ScavCaseRewardGenerator
const result: Product[] = [];
for (const item of rewardItems)
{
const resultItem = {
_id: this.hashUtil.generate(),
_tpl: item._id,
upd: undefined,
};
const resultItem = {_id: this.hashUtil.generate(), _tpl: item._id, upd: undefined};
this.addStackCountToAmmoAndMoney(item, resultItem, rarity);
@ -312,9 +308,7 @@ export class ScavCaseRewardGenerator
{
if (item._parent === BaseClasses.AMMO || item._parent === BaseClasses.MONEY)
{
resultItem.upd = {
StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity),
};
resultItem.upd = {StackObjectsCount: this.getRandomAmountRewardForScavCase(item, rarity)};
}
}
@ -331,10 +325,7 @@ export class ScavCaseRewardGenerator
return dbItems.filter((item) =>
{
const handbookPrice = this.ragfairPriceService.getStaticPriceForItem(item._id);
if (
handbookPrice >= itemFilters.minPriceRub
&& handbookPrice <= itemFilters.maxPriceRub
)
if (handbookPrice >= itemFilters.minPriceRub && handbookPrice <= itemFilters.maxPriceRub)
{
return true;
}

View File

@ -106,9 +106,7 @@ export class WeatherGenerator
wind_gustiness: this.getRandomFloat("windGustiness"),
rain: rain,
// eslint-disable-next-line @typescript-eslint/naming-convention
rain_intensity: (rain > 1)
? this.getRandomFloat("rainIntensity")
: 0,
rain_intensity: (rain > 1) ? this.getRandomFloat("rainIntensity") : 0,
fog: this.getWeightedFog(),
temp: this.getRandomFloat("temp"),
pressure: this.getRandomFloat("pressure"),

View File

@ -7,9 +7,7 @@ import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHel
@injectable()
export class InternalMagazineInventoryMagGen implements IInventoryMagGen
{
constructor(
@inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper,
)
constructor(@inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper)
{}
public getPriority(): number

View File

@ -9,9 +9,7 @@ import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots";
@injectable()
export class UbglExternalMagGen implements IInventoryMagGen
{
constructor(
@inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper,
)
constructor(@inject("BotWeaponGeneratorHelper") protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper)
{}
public getPriority(): number

View File

@ -38,12 +38,8 @@ export class BotDifficultyHelper
{
const difficultySettings = this.getDifficultySettings(pmcType, difficulty);
const friendlyType = pmcType === "bear"
? bearType
: usecType;
const enemyType = pmcType === "bear"
? usecType
: bearType;
const friendlyType = pmcType === "bear" ? bearType : usecType;
const enemyType = pmcType === "bear" ? usecType : bearType;
this.botHelper.addBotToEnemyList(difficultySettings, this.pmcConfig.enemyTypes, friendlyType); // Add generic bot types to enemy list
this.botHelper.addBotToEnemyList(difficultySettings, [enemyType, friendlyType], ""); // add same/opposite side to enemy list

View File

@ -150,9 +150,7 @@ export class BotGeneratorHelper
itemProperties.Togglable = {On: (this.randomUtil.getChance100(faceShieldActiveChance))};
}
return Object.keys(itemProperties).length
? {upd: itemProperties}
: {};
return Object.keys(itemProperties).length ? {upd: itemProperties} : {};
}
/**
@ -240,10 +238,7 @@ export class BotGeneratorHelper
maxDurability,
);
return {
Durability: currentDurability,
MaxDurability: maxDurability,
};
return {Durability: currentDurability, MaxDurability: maxDurability};
}
/**
@ -271,10 +266,7 @@ export class BotGeneratorHelper
);
}
return {
Durability: currentDurability,
MaxDurability: maxDurability,
};
return {Durability: currentDurability, MaxDurability: maxDurability};
}
/**
@ -381,11 +373,7 @@ export class ExhaustableArray<T>
{
private pool: T[];
constructor(
private itemPool: T[],
private randomUtil: RandomUtil,
private jsonUtil: JsonUtil,
)
constructor(private itemPool: T[], private randomUtil: RandomUtil, private jsonUtil: JsonUtil)
{
this.pool = this.jsonUtil.clone(itemPool);
}

View File

@ -248,8 +248,6 @@ export class BotHelper
*/
protected getRandomizedPmcSide(): string
{
return (this.randomUtil.getChance100(this.pmcConfig.isUsec))
? "Usec"
: "Bear";
return (this.randomUtil.getChance100(this.pmcConfig.isUsec)) ? "Usec" : "Bear";
}
}

View File

@ -96,10 +96,7 @@ export class BotWeaponGeneratorHelper
*/
public createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]
{
const magazine: Item[] = [{
_id: this.hashUtil.generate(),
_tpl: magazineTpl,
}];
const magazine: Item[] = [{_id: this.hashUtil.generate(), _tpl: magazineTpl}];
this.itemHelper.fillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1);
@ -128,13 +125,9 @@ export class BotWeaponGeneratorHelper
for (const ammoItem of ammoItems)
{
const result = this.addItemWithChildrenToEquipmentSlot(
equipmentSlotsToAddTo,
ammoItem._id,
ammoItem._tpl,
[ammoItem],
inventory,
);
const result = this.addItemWithChildrenToEquipmentSlot(equipmentSlotsToAddTo, ammoItem._id, ammoItem._tpl, [
ammoItem,
], inventory);
if (result === ItemAddedResult.NO_SPACE)
{

View File

@ -39,10 +39,7 @@ export class DialogueHelper
*/
public createMessageContext(templateId: string, messageType: MessageType, maxStoreTime = null): MessageContent
{
const result: MessageContent = {
templateId: templateId,
type: messageType,
};
const result: MessageContent = {templateId: templateId, type: messageType};
if (maxStoreTime)
{
@ -69,14 +66,7 @@ export class DialogueHelper
if (isNewDialogue)
{
dialogue = {
_id: dialogueID,
type: messageType,
messages: [],
pinned: false,
new: 0,
attachmentsNew: 0,
};
dialogue = {_id: dialogueID, type: messageType, messages: [], pinned: false, new: 0, attachmentsNew: 0};
dialogueData[dialogueID] = dialogue;
}
@ -89,10 +79,7 @@ export class DialogueHelper
if (rewards.length > 0)
{
const stashId = this.hashUtil.generate();
items = {
stash: stashId,
data: [],
};
items = {stash: stashId, data: []};
rewards = this.itemHelper.replaceIDs(null, rewards);
for (const reward of rewards)

View File

@ -177,9 +177,7 @@ export class DurabilityLimitsHelper
);
// Dont let weapon dura go below the percent defined in config
return (result >= durabilityValueMinLimit)
? result
: durabilityValueMinLimit;
return (result >= durabilityValueMinLimit) ? result : durabilityValueMinLimit;
}
protected generateArmorDurability(botRole: string, maxDurability: number): number
@ -193,9 +191,7 @@ export class DurabilityLimitsHelper
);
// Dont let armor dura go below the percent defined in config
return (result >= durabilityValueMinLimit)
? result
: durabilityValueMinLimit;
return (result >= durabilityValueMinLimit) ? result : durabilityValueMinLimit;
}
protected getMinWeaponDeltaFromConfig(botRole: string): number

View File

@ -49,9 +49,7 @@ export class HandbookHelper
{
this.handbookPriceCache.items.byParent.set(handbookItem.ParentId, []);
}
this.handbookPriceCache.items.byParent
.get(handbookItem.ParentId)
.push(handbookItem.Id);
this.handbookPriceCache.items.byParent.get(handbookItem.ParentId).push(handbookItem.Id);
}
for (const handbookCategory of handbookDb.Categories)
@ -63,9 +61,7 @@ export class HandbookHelper
{
this.handbookPriceCache.categories.byParent.set(handbookCategory.ParentId, []);
}
this.handbookPriceCache.categories.byParent
.get(handbookCategory.ParentId)
.push(handbookCategory.Id);
this.handbookPriceCache.categories.byParent.get(handbookCategory.ParentId).push(handbookCategory.Id);
}
}
}

View File

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

View File

@ -651,13 +651,7 @@ export class HideoutHelper
*/
protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd
{
return {
StackObjectsCount: stackCount,
Resource: {
Value: resourceValue,
UnitsConsumed: resourceUnitsConsumed,
},
};
return {StackObjectsCount: stackCount, Resource: {Value: resourceValue, UnitsConsumed: resourceUnitsConsumed}};
}
protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void
@ -705,10 +699,7 @@ export class HideoutHelper
{
airFilterArea.slots[i].item[0].upd = {
StackObjectsCount: 1,
Resource: {
Value: resourceValue,
UnitsConsumed: pointsConsumed,
},
Resource: {Value: resourceValue, UnitsConsumed: pointsConsumed},
};
this.logger.debug(`Air filter: ${resourceValue} filter left on slot ${i + 1}`);
break; // Break here to avoid updating all filters
@ -815,9 +806,7 @@ export class HideoutHelper
btcProd.Products.push({
_id: this.hashUtil.generate(),
_tpl: "59faff1d86f7746c51718c9c",
upd: {
StackObjectsCount: 1,
},
upd: {StackObjectsCount: 1},
});
btcProd.Progress -= coinCraftTimeSeconds;
@ -896,9 +885,7 @@ export class HideoutHelper
// at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki
// says that it caps at level 51 with 25% but as per dump data that is incorrect apparently
let roundedLevel = Math.floor(hideoutManagementSkill.Progress / 100);
roundedLevel = (roundedLevel === 51)
? roundedLevel - 1
: roundedLevel;
roundedLevel = (roundedLevel === 51) ? roundedLevel - 1 : roundedLevel;
return (roundedLevel
* this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement
@ -1023,9 +1010,7 @@ export class HideoutHelper
*/
protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean
{
return improvement?.completed
? true
: false;
return improvement?.completed ? true : false;
}
/**

View File

@ -21,9 +21,7 @@ export class HttpServerHelper
txt: "text/plain",
};
constructor(
@inject("ConfigServer") protected configServer: ConfigServer,
)
constructor(@inject("ConfigServer") protected configServer: ConfigServer)
{
this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP);
}

View File

@ -593,10 +593,7 @@ export class InRaidHelper
}
// Add these new found items to our list of inventory items
inventoryItems = [
...inventoryItems,
...foundItems,
];
inventoryItems = [...inventoryItems, ...foundItems];
// Now find the children of these items
newItems = foundItems;

View File

@ -175,9 +175,7 @@ export class InventoryHelper
catch (err)
{
// Callback failed
const message = typeof err === "string"
? err
: this.localisationService.getText("http-unknown_error");
const message = typeof err === "string" ? err : this.localisationService.getText("http-unknown_error");
return this.httpResponse.appendErrorToOutput(output, message);
}
@ -299,11 +297,7 @@ export class InventoryHelper
_tpl: itemLib[tmpKey]._tpl,
parentId: toDo[0][1],
slotId: slotID,
location: {
x: itemToAdd.location.x,
y: itemToAdd.location.y,
r: "Horizontal",
},
location: {x: itemToAdd.location.x, y: itemToAdd.location.y, r: "Horizontal"},
upd: this.jsonUtil.clone(upd),
});
@ -312,11 +306,7 @@ export class InventoryHelper
_tpl: itemLib[tmpKey]._tpl,
parentId: toDo[0][1],
slotId: itemLib[tmpKey].slotId,
location: {
x: itemToAdd.location.x,
y: itemToAdd.location.y,
r: "Horizontal",
},
location: {x: itemToAdd.location.x, y: itemToAdd.location.y, r: "Horizontal"},
upd: this.jsonUtil.clone(upd),
});
}
@ -405,9 +395,7 @@ export class InventoryHelper
}
catch (err)
{
const errorText = typeof err === "string"
? ` -> ${err}`
: "";
const errorText = typeof err === "string" ? ` -> ${err}` : "";
this.logger.error(this.localisationService.getText("inventory-fill_container_failed", errorText));
return this.httpResponse.appendErrorToOutput(
@ -897,10 +885,7 @@ export class InventoryHelper
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash
{
const inventoryItemHash: InventoryHelper.InventoryItemHash = {
byItemId: {},
byParentId: {},
};
const inventoryItemHash: InventoryHelper.InventoryItemHash = {byItemId: {}, byParentId: {}};
for (const item of inventoryItem)
{
@ -942,11 +927,13 @@ export class InventoryHelper
const tmpSize = this.getSizeByInventoryItemHash(item._tpl, item._id, inventoryItemHash);
const iW = tmpSize[0]; // x
const iH = tmpSize[1]; // y
const fH = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
const fH =
((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|| (item.location as Location).rotation === "Vertical")
? iW
: iH;
const fW = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
const fW =
((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|| (item.location as Location).rotation === "Vertical")
? iH
: iW;
@ -1002,9 +989,7 @@ export class InventoryHelper
else if (request.fromOwner.type.toLocaleLowerCase() === "mail")
{
// Split requests dont use 'use' but 'splitItem' property
const item = "splitItem" in request
? request.splitItem
: request.item;
const item = "splitItem" in request ? request.splitItem : request.item;
fromInventoryItems = this.dialogueHelper.getMessageItemContents(request.fromOwner.id, sessionId, item);
fromType = "mail";
}

View File

@ -176,9 +176,7 @@ class ItemHelper
{
if (item.upd === undefined)
{
item.upd = {
StackObjectsCount: 1,
};
item.upd = {StackObjectsCount: 1};
}
if (item.upd.StackObjectsCount === undefined)
@ -243,9 +241,7 @@ class ItemHelper
parentId: parentId,
slotId: slotId,
location: 0,
upd: {
StackObjectsCount: count,
},
upd: {StackObjectsCount: count},
};
stackSlotItems.push(stackSlotItem);
}
@ -473,10 +469,7 @@ class ItemHelper
*/
public hasBuyRestrictions(itemToCheck: Item): boolean
{
if (
itemToCheck.upd?.BuyRestrictionCurrent !== undefined
&& itemToCheck.upd?.BuyRestrictionMax !== undefined
)
if (itemToCheck.upd?.BuyRestrictionCurrent !== undefined && itemToCheck.upd?.BuyRestrictionMax !== undefined)
{
return true;
}
@ -574,18 +567,14 @@ class ItemHelper
public findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]
{
// find required items to take after buying (handles multiple items)
const barterIDs = typeof barterItemId === "string"
? [barterItemId]
: barterItemId;
const barterIDs = typeof barterItemId === "string" ? [barterItemId] : barterItemId;
let barterItems: Item[] = [];
for (const barterID of barterIDs)
{
const filterResult = items.filter((item) =>
{
return by === "tpl"
? (item._tpl === barterID)
: (item._id === barterID);
return by === "tpl" ? (item._tpl === barterID) : (item._id === barterID);
});
barterItems = Object.assign(barterItems, filterResult);
@ -954,9 +943,7 @@ class ItemHelper
while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount)
{
const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount;
const cartridgeCountToAdd = (remainingSpace < maxPerStack)
? remainingSpace
: maxPerStack;
const cartridgeCountToAdd = (remainingSpace < maxPerStack) ? remainingSpace : maxPerStack;
// Add cartridge item into items array
ammoBox.push(this.createCartridges(ammoBox[0]._id, cartridgeTpl, cartridgeCountToAdd, location));
@ -1086,10 +1073,8 @@ class ItemHelper
const ammoTpls = magTemplate._props.Cartridges[0]._props.filters[0].Filter;
const calibers = [
...new Set(
ammoTpls.filter(
(x: string) => this.getItem(x)[0],
).map(
(x: string) => this.getItem(x)[1]._props.Caliber,
ammoTpls.filter((x: string) => this.getItem(x)[0]).map((x: string) =>
this.getItem(x)[1]._props.Caliber
),
),
];
@ -1107,9 +1092,7 @@ class ItemHelper
const ammoArray = new ProbabilityObjectArray<string>(this.mathUtil, this.jsonUtil);
for (const icd of staticAmmoDist[caliber])
{
ammoArray.push(
new ProbabilityObject(icd.tpl, icd.relativeProbability),
);
ammoArray.push(new ProbabilityObject(icd.tpl, icd.relativeProbability));
}
return ammoArray.draw(1)[0];
}

View File

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

View File

@ -10,9 +10,7 @@ export class PaymentHelper
{
protected inventoryConfig: IInventoryConfig;
constructor(
@inject("ConfigServer") protected configServer: ConfigServer,
)
constructor(@inject("ConfigServer") protected configServer: ConfigServer)
{
this.inventoryConfig = this.configServer.getConfig(ConfigTypes.INVENTORY);
}

View File

@ -25,9 +25,9 @@ export class PresetHelper
{
if (!this.defaultPresets)
{
this.defaultPresets = Object.values(this.databaseServer.getTables().globals.ItemPresets)
.filter((x) => x._encyclopedia !== undefined)
.reduce((acc, cur) =>
this.defaultPresets = Object.values(this.databaseServer.getTables().globals.ItemPresets).filter((x) =>
x._encyclopedia !== undefined
).reduce((acc, cur) =>
{
acc[cur._id] = cur;
return acc;

View File

@ -217,9 +217,7 @@ export class ProfileHelper
public getDefaultAkiDataObject(): any
{
return {
version: this.getServerVersion(),
};
return {version: this.getServerVersion()};
}
public getFullProfile(sessionID: string): IAkiProfile
@ -257,11 +255,7 @@ export class ProfileHelper
return {
Eft: {
CarriedQuestItems: [],
DamageHistory: {
LethalDamagePart: "Head",
LethalDamage: undefined,
BodyParts: <any>[],
},
DamageHistory: {LethalDamagePart: "Head", LethalDamage: undefined, BodyParts: <any>[]},
DroppedItems: [],
ExperienceBonusMult: 0,
FoundInRaidItems: [],

View File

@ -69,9 +69,7 @@ export class QuestHelper
{
const quest = pmcData.Quests?.find((q) => q.qid === questId);
return quest
? quest.status
: QuestStatus.Locked;
return quest ? quest.status : QuestStatus.Locked;
}
/**
@ -328,11 +326,8 @@ export class QuestHelper
public getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]
{
// Iterate over all rewards with the desired status, flatten out items that have a type of Item
const questRewards = quest.rewards[QuestStatus[status]]
.flatMap((reward: Reward) =>
reward.type === "Item"
? this.processReward(reward)
: []
const questRewards = quest.rewards[QuestStatus[status]].flatMap((reward: Reward) =>
reward.type === "Item" ? this.processReward(reward) : []
);
return questRewards;
@ -467,14 +462,12 @@ export class QuestHelper
const quests = this.getQuestsFromDb().filter((q) =>
{
const acceptedQuestCondition = q.conditions.AvailableForStart.find(
(c) =>
const acceptedQuestCondition = q.conditions.AvailableForStart.find((c) =>
{
return c._parent === "Quest"
&& c._props.target === failedQuestId
&& c._props.status[0] === QuestStatus.Fail;
},
);
});
if (!acceptedQuestCondition)
{
@ -581,9 +574,7 @@ export class QuestHelper
parentId: item.parentId,
slotId: item.slotId,
location: item.location,
upd: {
StackObjectsCount: item.upd.StackObjectsCount,
},
upd: {StackObjectsCount: item.upd.StackObjectsCount},
});
}

View File

@ -73,9 +73,7 @@ export class RagfairHelper
if (info.linkedSearchId)
{
const data = this.ragfairLinkedItemService.getLinkedItems(info.linkedSearchId);
result = !data
? []
: [...data];
result = !data ? [] : [...data];
}
// Case: category

View File

@ -61,9 +61,7 @@ export class RagfairSellHelper
playerListedPriceRub: number,
): number
{
return (playerListedPriceRub < averageOfferPriceRub)
? this.ragfairConfig.sell.chance.underpriced
: 1;
return (playerListedPriceRub < averageOfferPriceRub) ? this.ragfairConfig.sell.chance.underpriced : 1;
}
/**
@ -114,10 +112,7 @@ export class RagfairSellHelper
this.ragfairConfig.sell.time.min * 60,
);
result.push({
sellTime: sellTime,
amount: boughtAmount,
});
result.push({sellTime: sellTime, amount: boughtAmount});
this.logger.debug(`Offer will sell at: ${new Date(sellTime * 1000).toLocaleTimeString("en-US")}`);
}

View File

@ -75,11 +75,7 @@ export class RagfairSortHelper
const nameA = locale[`${tplA} Name`] || tplA;
const nameB = locale[`${tplB} Name`] || tplB;
return (nameA < nameB)
? -1
: (nameA > nameB)
? 1
: 0;
return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0;
}
/**

View File

@ -68,10 +68,7 @@ export class RepairHelper
}
// Construct object to return
itemToRepair.upd.Repairable = {
Durability: newCurrentDurability,
MaxDurability: newCurrentMaxDurability,
};
itemToRepair.upd.Repairable = {Durability: newCurrentDurability, MaxDurability: newCurrentMaxDurability};
// when modders set the repair coefficient to 0 it means that they dont want to lose durability on items
// the code below generates a random degradation on the weapon durability
@ -138,12 +135,8 @@ export class RepairHelper
traderQualityMultipler: number,
): number
{
const minRepairDeg = isRepairKit
? itemProps.MinRepairKitDegradation
: itemProps.MinRepairDegradation;
let maxRepairDeg = isRepairKit
? itemProps.MaxRepairKitDegradation
: itemProps.MaxRepairDegradation;
const minRepairDeg = isRepairKit ? itemProps.MinRepairKitDegradation : itemProps.MinRepairDegradation;
let maxRepairDeg = isRepairKit ? itemProps.MaxRepairKitDegradation : itemProps.MaxRepairDegradation;
// WORKAROUND: Some items are always 0 when repairkit is true
if (maxRepairDeg === 0)

View File

@ -14,9 +14,7 @@ export interface OwnerInventoryItems
@injectable()
export class SecureContainerHelper
{
constructor(
@inject("ItemHelper") protected itemHelper: ItemHelper,
)
constructor(@inject("ItemHelper") protected itemHelper: ItemHelper)
{}
public getSecureContainerItems(items: Item[]): string[]

View File

@ -60,13 +60,11 @@ export class TradeHelper
let output = this.eventOutputHolder.getOutput(sessionID);
const newReq = {
items: [
{
items: [{
// eslint-disable-next-line @typescript-eslint/naming-convention
item_id: buyRequestData.item_id,
count: buyRequestData.count,
},
],
}],
tid: buyRequestData.tid,
};

View File

@ -26,11 +26,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export class TraderAssortHelper
{
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;
constructor(

View File

@ -199,9 +199,7 @@ export class TraderHelper
{
const newStanding = currentStanding + standingToAdd;
return newStanding < 0
? 0
: newStanding;
return newStanding < 0 ? 0 : newStanding;
}
/**
@ -229,8 +227,7 @@ export class TraderHelper
if (
(loyalty.minLevel <= pmcData.Info.Level
&& loyalty.minSalesSum <= pmcData.TradersInfo[traderID].salesSum
&& loyalty.minStanding <= pmcData.TradersInfo[traderID].standing)
&& targetLevel < 4
&& loyalty.minStanding <= pmcData.TradersInfo[traderID].standing) && targetLevel < 4
)
{
// level reached
@ -271,10 +268,7 @@ export class TraderHelper
}),
);
this.traderConfig.updateTime.push( // create temporary entry to prevent logger spam
{
traderId: traderId,
seconds: this.traderConfig.updateTimeDefault,
},
{traderId: traderId, seconds: this.traderConfig.updateTimeDefault},
);
}
else

View File

@ -77,10 +77,7 @@ export class WeightedRandomHelper
{
if (cumulativeWeights[itemIndex] >= randomNumber)
{
return {
item: items[itemIndex],
index: itemIndex,
};
return {item: items[itemIndex], index: itemIndex};
}
}
}

View File

@ -111,11 +111,7 @@ const createHttpDecorator = (httpMethod: HttpMethods) =>
}
// Flag the method as a HTTP handler
target.handlers.push({
handlerName: propertyKey,
path,
httpMethod,
});
target.handlers.push({handlerName: propertyKey, path, httpMethod});
};
};
};

View File

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

View File

@ -22,10 +22,7 @@ export class EventOutputHolder
{}
// TODO REMEMBER TO CHANGE OUTPUT
protected output: IItemEventRouterResponse = {
warnings: [],
profileChanges: {},
};
protected output: IItemEventRouterResponse = {warnings: [], profileChanges: {}};
public getOutput(sessionID: string): IItemEventRouterResponse
{
@ -54,18 +51,10 @@ export class EventOutputHolder
ragFairOffers: [],
weaponBuilds: [],
equipmentBuilds: [],
items: {
new: [],
change: [],
del: [],
},
items: {new: [], change: [], del: []},
production: {},
improvements: {},
skills: {
Common: [],
Mastering: [],
Points: 0,
},
skills: {Common: [], Mastering: [], Points: 0},
health: this.jsonUtil.clone(pmcData.Health),
traderRelations: {},
// changedHideoutStashes: {},

View File

@ -87,8 +87,6 @@ export class HttpRouter
class ResponseWrapper
{
constructor(
public output: string,
)
constructor(public output: string)
{}
}

View File

@ -6,12 +6,9 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class BotDynamicRouter extends DynamicRouter
{
constructor(
@inject("BotCallbacks") protected botCallbacks: BotCallbacks,
)
constructor(@inject("BotCallbacks") protected botCallbacks: BotCallbacks)
{
super(
[
super([
new RouteAction(
"/singleplayer/settings/bot/limit/",
(url: string, info: any, sessionID: string, output: string): any =>
@ -40,7 +37,6 @@ export class BotDynamicRouter extends DynamicRouter
return this.botCallbacks.getBotBehaviours();
},
),
],
);
]);
}
}

View File

@ -6,20 +6,13 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class BundleDynamicRouter extends DynamicRouter
{
constructor(
@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks,
)
constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks)
{
super(
[
new RouteAction(
".bundle",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction(".bundle", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.bundleCallbacks.getBundle(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -6,12 +6,9 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class CustomizationDynamicRouter extends DynamicRouter
{
constructor(
@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks,
)
constructor(@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks)
{
super(
[
super([
new RouteAction(
"/client/trading/customization/",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class CustomizationDynamicRouter extends DynamicRouter
return this.customizationCallbacks.getTraderSuits(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,34 +6,21 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class DataDynamicRouter extends DynamicRouter
{
constructor(
@inject("DataCallbacks") protected dataCallbacks: DataCallbacks,
)
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
{
super(
[
new RouteAction(
"/client/menu/locale/",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/client/menu/locale/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
},
),
new RouteAction(
"/client/locale/",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/locale/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
},
),
new RouteAction(
"/client/items/prices/",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/items/prices/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getItemPrices(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -6,34 +6,21 @@ import { ImageRouter } from "@spt-aki/routers/ImageRouter";
@injectable()
export class HttpDynamicRouter extends DynamicRouter
{
constructor(
@inject("ImageRouter") protected imageRouter: ImageRouter,
)
constructor(@inject("ImageRouter") protected imageRouter: ImageRouter)
{
super(
[
new RouteAction(
".jpg",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction(".jpg", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
new RouteAction(
".png",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction(".png", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
new RouteAction(
".ico",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction(".ico", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
],
);
}),
]);
}
}

View File

@ -6,12 +6,9 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class InraidDynamicRouter extends DynamicRouter
{
constructor(
@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks,
)
constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks)
{
super(
[
super([
new RouteAction(
"/client/location/getLocalloot",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,8 +16,7 @@ export class InraidDynamicRouter extends DynamicRouter
return this.inraidCallbacks.registerPlayer(url, info, sessionID);
},
),
],
);
]);
}
public override getTopLevelRoute(): string

View File

@ -6,12 +6,9 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class LocationDynamicRouter extends DynamicRouter
{
constructor(
@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks,
)
constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks)
{
super(
[
super([
new RouteAction(
"/client/location/getLocalloot",
(url: string, info: any, sessionID: string, _output: string): any =>
@ -19,8 +16,7 @@ export class LocationDynamicRouter extends DynamicRouter
return this.locationCallbacks.getLocation(url, info, sessionID);
},
),
],
);
]);
}
public override getTopLevelRoute(): string

View File

@ -6,33 +6,21 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class NotifierDynamicRouter extends DynamicRouter
{
constructor(
@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks,
)
constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks)
{
super(
[
new RouteAction(
"/?last_id",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/?last_id", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.notify(url, info, sessionID);
},
),
new RouteAction(
"/notifierServer",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/notifierServer", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.notify(url, info, sessionID);
},
),
new RouteAction(
"/push/notifier/get/",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/push/notifier/get/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.notifierCallbacks.getNotifier(url, info, sessionID);
},
),
}),
new RouteAction(
"/push/notifier/getwebsocket/",
(url: string, info: any, sessionID: string, output: string): any =>
@ -40,7 +28,6 @@ export class NotifierDynamicRouter extends DynamicRouter
return this.notifierCallbacks.getNotifier(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class TraderDynamicRouter extends DynamicRouter
{
constructor(
@inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks,
)
constructor(@inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks)
{
super(
[
super([
new RouteAction(
"/client/trading/api/getTrader/",
(url: string, info: any, sessionID: string, output: string): any =>
@ -26,7 +23,6 @@ export class TraderDynamicRouter extends DynamicRouter
return this.traderCallbacks.getAssort(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -17,10 +17,7 @@ export class CustomizationItemEventRouter extends ItemEventRouterDefinition
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("CustomizationWear", false),
new HandledRoute("CustomizationBuy", false),
];
return [new HandledRoute("CustomizationWear", false), new HandledRoute("CustomizationBuy", false)];
}
public override handleItemEvent(

View File

@ -9,9 +9,7 @@ import { HideoutEventActions } from "@spt-aki/models/enums/HideoutEventActions";
@injectable()
export class HideoutItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("HideoutCallbacks") protected hideoutCallbacks: HideoutCallbacks,
)
constructor(@inject("HideoutCallbacks") protected hideoutCallbacks: HideoutCallbacks)
{
super();
}

View File

@ -17,9 +17,7 @@ export class InsuranceItemEventRouter extends ItemEventRouterDefinition
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("Insure", false),
];
return [new HandledRoute("Insure", false)];
}
public override handleItemEvent(

View File

@ -9,9 +9,7 @@ import { ItemEventActions } from "@spt-aki/models/enums/ItemEventActions";
@injectable()
export class PresetBuildItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("PresetBuildCallbacks") protected presetBuildCallbacks: PresetBuildCallbacks,
)
constructor(@inject("PresetBuildCallbacks") protected presetBuildCallbacks: PresetBuildCallbacks)
{
super();
}

View File

@ -8,9 +8,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
@injectable()
export class RagfairItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks,
)
constructor(@inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks)
{
super();
}

View File

@ -8,19 +8,14 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
@injectable()
export class RepairItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("RepairCallbacks") protected repairCallbacks: RepairCallbacks,
)
constructor(@inject("RepairCallbacks") protected repairCallbacks: RepairCallbacks)
{
super();
}
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("Repair", false),
new HandledRoute("TraderRepair", false),
];
return [new HandledRoute("Repair", false), new HandledRoute("TraderRepair", false)];
}
public override handleItemEvent(

View File

@ -8,9 +8,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
@injectable()
export class TradeItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("TradeCallbacks") protected tradeCallbacks: TradeCallbacks,
)
constructor(@inject("TradeCallbacks") protected tradeCallbacks: TradeCallbacks)
{
super();
}

View File

@ -8,19 +8,14 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
@injectable()
export class WishlistItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("WishlistCallbacks") protected wishlistCallbacks: WishlistCallbacks,
)
constructor(@inject("WishlistCallbacks") protected wishlistCallbacks: WishlistCallbacks)
{
super();
}
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("AddToWishList", false),
new HandledRoute("RemoveFromWishList", false),
];
return [new HandledRoute("AddToWishList", false), new HandledRoute("RemoveFromWishList", false)];
}
public override handleItemEvent(

View File

@ -8,19 +8,14 @@ export class HealthSaveLoadRouter extends SaveLoadRouter
{
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("aki-health", false),
];
return [new HandledRoute("aki-health", false)];
}
public override handleLoad(profile: IAkiProfile): IAkiProfile
{
if (!profile.vitality)
{ // Occurs on newly created profiles
profile.vitality = {
health: null,
effects: null,
};
profile.vitality = {health: null, effects: null};
}
profile.vitality.health = {
Hydration: 0,

View File

@ -8,19 +8,14 @@ export class InraidSaveLoadRouter extends SaveLoadRouter
{
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("aki-inraid", false),
];
return [new HandledRoute("aki-inraid", false)];
}
public override handleLoad(profile: IAkiProfile): IAkiProfile
{
if (profile.inraid === undefined)
{
profile.inraid = {
location: "none",
character: "none",
};
profile.inraid = {location: "none", character: "none"};
}
return profile;

View File

@ -8,9 +8,7 @@ export class InsuranceSaveLoadRouter extends SaveLoadRouter
{
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("aki-insurance", false),
];
return [new HandledRoute("aki-insurance", false)];
}
public override handleLoad(profile: IAkiProfile): IAkiProfile

View File

@ -9,19 +9,14 @@ export class ProfileSaveLoadRouter extends SaveLoadRouter
{
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("aki-profile", false),
];
return [new HandledRoute("aki-profile", false)];
}
public override handleLoad(profile: IAkiProfile): IAkiProfile
{
if (profile.characters === null)
{
profile.characters = {
pmc: {} as IPmcData,
scav: {} as IPmcData,
};
profile.characters = {pmc: {} as IPmcData, scav: {} as IPmcData};
}
return profile;
}

View File

@ -7,9 +7,7 @@ import { ImageRouter } from "@spt-aki/routers/ImageRouter";
@injectable()
export class ImageSerializer extends Serializer
{
constructor(
@inject("ImageRouter") protected imageRouter: ImageRouter,
)
constructor(@inject("ImageRouter") protected imageRouter: ImageRouter)
{
super();
}

View File

@ -27,9 +27,9 @@ export class NotifySerializer extends Serializer
* Take our array of JSON message objects and cast them to JSON strings, so that they can then
* be sent to client as NEWLINE separated strings... yup.
*/
this.notifierController.notifyAsync(tmpSessionID)
.then((messages: any) => messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n"))
.then((text) => this.httpServerHelper.sendTextJson(resp, text));
this.notifierController.notifyAsync(tmpSessionID).then((messages: any) =>
messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n")
).then((text) => this.httpServerHelper.sendTextJson(resp, text));
}
public override canHandle(route: string): boolean

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class BotStaticRouter extends StaticRouter
{
constructor(
@inject("BotCallbacks") protected botCallbacks: BotCallbacks,
)
constructor(@inject("BotCallbacks") protected botCallbacks: BotCallbacks)
{
super(
[
super([
new RouteAction(
"/client/game/bot/generate",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class BotStaticRouter extends StaticRouter
return this.botCallbacks.generateBots(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,20 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class BundleStaticRouter extends StaticRouter
{
constructor(
@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks,
)
constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks)
{
super(
[
new RouteAction(
"/singleplayer/bundles",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/singleplayer/bundles", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.bundleCallbacks.getBundles(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -6,20 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class ClientLogStaticRouter extends StaticRouter
{
constructor(
@inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks,
)
constructor(@inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks)
{
super(
[
new RouteAction(
"/singleplayer/log",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/singleplayer/log", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.clientLogCallbacks.clientLog(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class CustomizationStaticRouter extends StaticRouter
{
constructor(
@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks,
)
constructor(@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks)
{
super(
[
super([
new RouteAction(
"/client/trading/customization/storage",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class CustomizationStaticRouter extends StaticRouter
return this.customizationCallbacks.getSuits(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,33 +6,21 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class DataStaticRouter extends StaticRouter
{
constructor(
@inject("DataCallbacks") protected dataCallbacks: DataCallbacks,
)
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
{
super(
[
new RouteAction(
"/client/settings",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/client/settings", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getSettings(url, info, sessionID);
},
),
new RouteAction(
"/client/globals",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/globals", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getGlobals(url, info, sessionID);
},
),
new RouteAction(
"/client/items",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/items", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getTemplateItems(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/handbook/templates",
(url: string, info: any, sessionID: string, output: string): any =>
@ -40,13 +28,10 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getTemplateHandbook(url, info, sessionID);
},
),
new RouteAction(
"/client/customization",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/customization", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getTemplateSuits(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/account/customization",
(url: string, info: any, sessionID: string, output: string): any =>
@ -68,13 +53,10 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getHideoutSettings(url, info, sessionID);
},
),
new RouteAction(
"/client/hideout/areas",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/hideout/areas", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getHideoutAreas(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/hideout/production/scavcase/recipes",
(url: string, info: any, sessionID: string, output: string): any =>
@ -82,13 +64,10 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getHideoutScavcase(url, info, sessionID);
},
),
new RouteAction(
"/client/languages",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/languages", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/hideout/qte/list",
(url: string, info: any, sessionID: string, output: string): any =>
@ -96,7 +75,6 @@ export class DataStaticRouter extends StaticRouter
return this.dataCallbacks.getQteList(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class DialogStaticRouter extends StaticRouter
{
constructor(
@inject("DialogueCallbacks") protected dialogueCallbacks: DialogueCallbacks,
)
constructor(@inject("DialogueCallbacks") protected dialogueCallbacks: DialogueCallbacks)
{
super(
[
super([
new RouteAction(
"/client/chatServer/list",
(url: string, info: any, sessionID: string, output: string): any =>
@ -82,13 +79,10 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.getAllAttachments(url, info, sessionID);
},
),
new RouteAction(
"/client/mail/msg/send",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/mail/msg/send", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.sendMessage(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/mail/dialog/clear",
(url: string, info: any, sessionID: string, output: string): any =>
@ -96,13 +90,10 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.clearMail(url, info, sessionID);
},
),
new RouteAction(
"/client/friend/list",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/friend/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.getFriendList(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/friend/request/list/outbox",
(url: string, info: any, sessionID: string, output: string): any =>
@ -138,13 +129,10 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID);
},
),
new RouteAction(
"/client/friend/delete",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/friend/delete", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.deleteFriend(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/friend/ignore/set",
(url: string, info: any, sessionID: string, output: string): any =>
@ -159,7 +147,6 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.unIgnoreFriend(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,26 +6,17 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class GameStaticRouter extends StaticRouter
{
constructor(
@inject("GameCallbacks") protected gameCallbacks: GameCallbacks,
)
constructor(@inject("GameCallbacks") protected gameCallbacks: GameCallbacks)
{
super(
[
new RouteAction(
"/client/game/config",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/client/game/config", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.getGameConfig(url, info, sessionID);
},
),
new RouteAction(
"/client/server/list",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/server/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.getServer(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/match/group/current",
(url: string, info: any, sessionID: string, output: string): any =>
@ -40,27 +31,18 @@ export class GameStaticRouter extends StaticRouter
return this.gameCallbacks.versionValidate(url, info, sessionID);
},
),
new RouteAction(
"/client/game/start",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/game/start", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.gameStart(url, info, sessionID);
},
),
new RouteAction(
"/client/game/logout",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/game/logout", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.gameLogout(url, info, sessionID);
},
),
new RouteAction(
"/client/checkVersion",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/checkVersion", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.gameCallbacks.validateGameVersion(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/game/keepalive",
(url: string, info: any, sessionID: string, output: string): any =>
@ -82,7 +64,6 @@ export class GameStaticRouter extends StaticRouter
return this.gameCallbacks.reportNickname(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,19 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class HealthStaticRouter extends StaticRouter
{
constructor(
@inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks,
)
constructor(@inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks)
{
super(
[
new RouteAction(
"/player/health/sync",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/player/health/sync", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.healthCallbacks.syncHealth(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/hideout/workout",
(url: string, info: any, sessionID: string, output: string): any =>
@ -26,7 +20,6 @@ export class HealthStaticRouter extends StaticRouter
return this.healthCallbacks.handleWorkoutEffects(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,19 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class InraidStaticRouter extends StaticRouter
{
constructor(
@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks,
)
constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks)
{
super(
[
new RouteAction(
"/raid/profile/save",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/raid/profile/save", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.inraidCallbacks.saveProgress(url, info, sessionID);
},
),
}),
new RouteAction(
"/singleplayer/settings/raid/endstate",
(url: string, info: any, sessionID: string, output: string): any =>
@ -47,7 +41,6 @@ export class InraidStaticRouter extends StaticRouter
return this.inraidCallbacks.getAirdropConfig();
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class InsuranceStaticRouter extends StaticRouter
{
constructor(
@inject("InsuranceCallbacks") protected insuranceCallbacks: InsuranceCallbacks,
)
constructor(@inject("InsuranceCallbacks") protected insuranceCallbacks: InsuranceCallbacks)
{
super(
[
super([
new RouteAction(
"/client/insurance/items/list/cost",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class InsuranceStaticRouter extends StaticRouter
return this.insuranceCallbacks.getInsuranceCost(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class ItemEventStaticRouter extends StaticRouter
{
constructor(
@inject("ItemEventCallbacks") protected itemEventCallbacks: ItemEventCallbacks,
)
constructor(@inject("ItemEventCallbacks") protected itemEventCallbacks: ItemEventCallbacks)
{
super(
[
super([
new RouteAction(
"/client/game/profile/items/moving",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class ItemEventStaticRouter extends StaticRouter
return this.itemEventCallbacks.handleEvents(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,19 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class LauncherStaticRouter extends StaticRouter
{
constructor(
@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks,
)
constructor(@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks)
{
super(
[
new RouteAction(
"/launcher/ping",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/launcher/ping", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.launcherCallbacks.ping(url, info, sessionID);
},
),
}),
new RouteAction(
"/launcher/server/connect",
(url: string, info: any, sessionID: string, output: string): any =>
@ -40,13 +34,10 @@ export class LauncherStaticRouter extends StaticRouter
return this.launcherCallbacks.register(url, info, sessionID);
},
),
new RouteAction(
"/launcher/profile/get",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/launcher/profile/get", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.launcherCallbacks.get(url, info, sessionID);
},
),
}),
new RouteAction(
"/launcher/profile/change/username",
(url: string, info: any, sessionID: string, output: string): any =>
@ -103,7 +94,6 @@ export class LauncherStaticRouter extends StaticRouter
return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,19 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class LocationStaticRouter extends StaticRouter
{
constructor(
@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks,
)
constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks)
{
super(
[
new RouteAction(
"/client/locations",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/client/locations", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.locationCallbacks.getLocationData(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/location/getAirdropLoot",
(url: string, info: any, sessionID: string, _output: string): any =>
@ -26,7 +20,6 @@ export class LocationStaticRouter extends StaticRouter
return this.locationCallbacks.getAirdropLoot(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,19 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class MatchStaticRouter extends StaticRouter
{
constructor(
@inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks,
)
constructor(@inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks)
{
super(
[
new RouteAction(
"/raid/profile/list",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/raid/profile/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.getProfile(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/match/available",
(url: string, info: any, sessionID: string, output: string): any =>
@ -33,20 +27,14 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.updatePing(url, info, sessionID);
},
),
new RouteAction(
"/client/match/join",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/match/join", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
},
),
new RouteAction(
"/client/match/exit",
(url: string, info: any, sessionID: string, output: string): any =>
}),
new RouteAction("/client/match/exit", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.exitMatch(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/match/group/create",
(url: string, info: any, sessionID: string, output: string): any =>
@ -145,13 +133,10 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.endOfflineRaid(url, info, sessionID);
},
),
new RouteAction(
"/client/putMetrics",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/putMetrics", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.putMetrics(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/getMetricsConfig",
(url: string, info: any, sessionID: string, output: string): any =>
@ -173,7 +158,6 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class NotifierStaticRouter extends StaticRouter
{
constructor(
@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks,
)
constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks)
{
super(
[
super([
new RouteAction(
"/client/notifier/channel/create",
(url: string, info: any, sessionID: string, output: string): any =>
@ -26,7 +23,6 @@ export class NotifierStaticRouter extends StaticRouter
return this.notifierCallbacks.selectProfile(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class PresetStaticRouter extends StaticRouter
{
constructor(
@inject("PresetBuildCallbacks") protected presetCallbacks: PresetBuildCallbacks,
)
constructor(@inject("PresetBuildCallbacks") protected presetCallbacks: PresetBuildCallbacks)
{
super(
[
super([
new RouteAction(
"/client/handbook/builds/my/list",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class PresetStaticRouter extends StaticRouter
return this.presetCallbacks.getHandbookUserlist(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class ProfileStaticRouter extends StaticRouter
{
constructor(
@inject("ProfileCallbacks") protected profileCallbacks: ProfileCallbacks,
)
constructor(@inject("ProfileCallbacks") protected profileCallbacks: ProfileCallbacks)
{
super(
[
super([
new RouteAction(
"/client/game/profile/create",
(url: string, info: any, sessionID: string, output: string): any =>
@ -89,14 +86,10 @@ export class ProfileStaticRouter extends StaticRouter
return this.profileCallbacks.getMiniProfile(url, info, sessionID);
},
),
new RouteAction(
"/launcher/profiles",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/launcher/profiles", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -6,19 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class QuestStaticRouter extends StaticRouter
{
constructor(
@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks,
)
constructor(@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks)
{
super(
[
new RouteAction(
"/client/quest/list",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/client/quest/list", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.questCallbacks.listQuests(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/repeatalbeQuests/activityPeriods",
(url: string, info: any, sessionID: string, output: string): any =>
@ -26,7 +20,6 @@ export class QuestStaticRouter extends StaticRouter
return this.questCallbacks.activityPeriods(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class RagfairStaticRouter extends StaticRouter
{
constructor(
@inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks,
)
constructor(@inject("RagfairCallbacks") protected ragfairCallbacks: RagfairCallbacks)
{
super(
[
super([
new RouteAction(
"/client/ragfair/search",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,13 +16,10 @@ export class RagfairStaticRouter extends StaticRouter
return this.ragfairCallbacks.search(url, info, sessionID);
},
),
new RouteAction(
"/client/ragfair/find",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/ragfair/find", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.search(url, info, sessionID);
},
),
}),
new RouteAction(
"/client/ragfair/itemMarketPrice",
(url: string, info: any, sessionID: string, output: string): any =>
@ -47,14 +41,10 @@ export class RagfairStaticRouter extends StaticRouter
return this.ragfairCallbacks.sendReport(url, info, sessionID);
},
),
new RouteAction(
"/client/items/prices",
(url: string, info: any, sessionID: string, output: string): any =>
new RouteAction("/client/items/prices", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.getFleaPrices(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -6,12 +6,9 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class TraderStaticRouter extends StaticRouter
{
constructor(
@inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks,
)
constructor(@inject("TraderCallbacks") protected traderCallbacks: TraderCallbacks)
{
super(
[
super([
new RouteAction(
"/client/trading/api/traderSettings",
(url: string, info: any, sessionID: string, output: string): any =>
@ -19,7 +16,6 @@ export class TraderStaticRouter extends StaticRouter
return this.traderCallbacks.getTraderSettings(url, info, sessionID);
},
),
],
);
]);
}
}

View File

@ -6,20 +6,13 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
@injectable()
export class WeatherStaticRouter extends StaticRouter
{
constructor(
@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks,
)
constructor(@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks)
{
super(
[
new RouteAction(
"/client/weather",
(url: string, info: any, sessionID: string, output: string): any =>
super([
new RouteAction("/client/weather", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.weatherCallbacks.getWeather(url, info, sessionID);
},
),
],
);
}),
]);
}
}

View File

@ -36,9 +36,7 @@ export class ConfigServer
this.logger.debug("Importing configs...");
// Get all filepaths
const filepath = (globalThis.G_RELEASE_CONFIGURATION)
? "Aki_Data/Server/configs/"
: "./assets/configs/";
const filepath = (globalThis.G_RELEASE_CONFIGURATION) ? "Aki_Data/Server/configs/" : "./assets/configs/";
const files = this.vfs.getFiles(filepath);
// Add file content to result

View File

@ -142,10 +142,7 @@ export class SaveServer
throw new Error(`profile already exists for sessionId: ${profileInfo.id}`);
}
this.profiles[profileInfo.id] = {
info: profileInfo,
characters: {pmc: {}, scav: {}},
};
this.profiles[profileInfo.id] = {info: profileInfo, characters: {pmc: {}, scav: {}}};
}
/**

View File

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

View File

@ -141,9 +141,7 @@ export class AkiHttpListener implements IHttpListener
if (globalThis.G_LOG_REQUESTS)
{
// Parse quest info into object
const data = (typeof info === "object")
? info
: this.jsonUtil.deserialize(info);
const data = (typeof info === "object") ? info : this.jsonUtil.deserialize(info);
const log = new Request(req.method, new RequestData(req.url, req.headers, data));
this.requestsLogger.info(`REQUEST=${this.jsonUtil.serialize(log)}`);
@ -184,28 +182,18 @@ export class AkiHttpListener implements IHttpListener
class RequestData
{
constructor(
public url: string,
public headers: IncomingHttpHeaders,
public data?: any,
)
constructor(public url: string, public headers: IncomingHttpHeaders, public data?: any)
{}
}
class Request
{
constructor(
public type: string,
public req: RequestData,
)
constructor(public type: string, public req: RequestData)
{}
}
class Response
{
constructor(
public type: string,
public response: any,
)
constructor(public type: string, public response: any)
{}
}

View File

@ -54,9 +54,7 @@ export class BotEquipmentFilterService
{
const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
const botRole = (botGenerationDetails.isPmc)
? "pmc"
: botGenerationDetails.role;
const botRole = (botGenerationDetails.isPmc) ? "pmc" : botGenerationDetails.role;
const botEquipmentBlacklist = this.getBotEquipmentBlacklist(botRole, botLevel);
const botEquipmentWhitelist = this.getBotEquipmentWhitelist(botRole, botLevel);
const botWeightingAdjustments = this.getBotWeightingAdjustments(botRole, botLevel);

View File

@ -168,8 +168,7 @@ export class BotLootCacheService
const specialLootItems = (botJsonTemplate.generation.items.specialItems.whitelist?.length > 0)
? botJsonTemplate.generation.items.specialItems.whitelist.map((x) => this.itemHelper.getItem(x)[1])
: specialLootTemplates.filter((template) =>
!(this.isBulletOrGrenade(template._props)
|| this.isMagazine(template._props))
!(this.isBulletOrGrenade(template._props) || this.isMagazine(template._props))
);
const healingItems = (botJsonTemplate.generation.items.healing.whitelist?.length > 0)
@ -183,15 +182,13 @@ export class BotLootCacheService
const drugItems = (botJsonTemplate.generation.items.drugs.whitelist?.length > 0)
? botJsonTemplate.generation.items.drugs.whitelist.map((x) => this.itemHelper.getItem(x)[1])
: combinedPoolTemplates.filter((template) =>
this.isMedicalItem(template._props)
&& template._parent === BaseClasses.DRUGS
this.isMedicalItem(template._props) && template._parent === BaseClasses.DRUGS
);
const stimItems = (botJsonTemplate.generation.items.stims.whitelist?.length > 0)
? botJsonTemplate.generation.items.stims.whitelist.map((x) => this.itemHelper.getItem(x)[1])
: combinedPoolTemplates.filter((template) =>
this.isMedicalItem(template._props)
&& template._parent === BaseClasses.STIMULATOR
this.isMedicalItem(template._props) && template._parent === BaseClasses.STIMULATOR
);
const grenadeItems = (botJsonTemplate.generation.items.grenades.whitelist?.length > 0)
@ -201,9 +198,7 @@ export class BotLootCacheService
// Get loot items (excluding magazines, bullets, grenades and healing items)
const backpackLootItems = backpackLootTemplates.filter((template) =>
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
!this.isBulletOrGrenade(template._props)
&& !this.isMagazine(template._props)
// && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot
!this.isBulletOrGrenade(template._props) && !this.isMagazine(template._props) // && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot
&& !this.isGrenade(template._props)
);

View File

@ -294,9 +294,7 @@ export class FenceService
const desiredTotalCount = this.traderConfig.fence.assortSize;
const actualTotalCount = this.fenceAssort.items.reduce((count, item) =>
{
return item.slotId === "hideout"
? count + 1
: count;
return item.slotId === "hideout" ? count + 1 : count;
}, 0);
return actualTotalCount < desiredTotalCount
@ -587,10 +585,7 @@ export class FenceService
// Multiply weapon+mods rouble price by multipler in config
assorts.barter_scheme[weaponAndMods[0]._id] = [[]];
assorts.barter_scheme[weaponAndMods[0]._id][0][0] = {
_tpl: Money.ROUBLES,
count: Math.round(rub),
};
assorts.barter_scheme[weaponAndMods[0]._id][0][0] = {_tpl: Money.ROUBLES, count: Math.round(rub)};
assorts.loyal_level_items[weaponAndMods[0]._id] = loyaltyLevel;
@ -658,8 +653,7 @@ export class FenceService
// Roll from 0 to 9999, then divide it by 100: 9999 = 99.99%
const randomChance = this.randomUtil.getInt(0, 9999) / 100;
return randomChance > removalChance
&& !itemsBeingDeleted.includes(weaponMod._id);
return randomChance > removalChance && !itemsBeingDeleted.includes(weaponMod._id);
}
/**
@ -681,9 +675,7 @@ export class FenceService
// Randomise hp resource of med items
if ("MaxHpResource" in itemDetails._props && itemDetails._props.MaxHpResource > 0)
{
itemToAdjust.upd.MedKit = {
HpResource: this.randomUtil.getInt(1, itemDetails._props.MaxHpResource),
};
itemToAdjust.upd.MedKit = {HpResource: this.randomUtil.getInt(1, itemDetails._props.MaxHpResource)};
}
// Randomise armor durability
@ -692,8 +684,7 @@ export class FenceService
|| itemDetails._parent === BaseClasses.HEADWEAR
|| itemDetails._parent === BaseClasses.VEST
|| itemDetails._parent === BaseClasses.ARMOREDEQUIPMENT
|| itemDetails._parent === BaseClasses.FACECOVER)
&& itemDetails._props.MaxDurability > 0
|| itemDetails._parent === BaseClasses.FACECOVER) && itemDetails._props.MaxDurability > 0
)
{
const armorMaxDurabilityLimits = this.traderConfig.fence.armorMaxDurabilityPercentMinMax;
@ -703,10 +694,7 @@ export class FenceService
const maxDurability = this.randomUtil.getInt(duraMin, duraMax);
const durability = this.randomUtil.getInt(1, maxDurability);
itemToAdjust.upd.Repairable = {
Durability: durability,
MaxDurability: maxDurability,
};
itemToAdjust.upd.Repairable = {Durability: durability, MaxDurability: maxDurability};
return;
}
@ -721,19 +709,14 @@ export class FenceService
const maxDurability = this.randomUtil.getInt(duraMin, duraMax);
const durability = this.randomUtil.getInt(1, maxDurability);
itemToAdjust.upd.Repairable = {
Durability: durability,
MaxDurability: maxDurability,
};
itemToAdjust.upd.Repairable = {Durability: durability, MaxDurability: maxDurability};
return;
}
if (this.itemHelper.isOfBaseclass(itemDetails._id, BaseClasses.REPAIR_KITS))
{
itemToAdjust.upd.RepairKit = {
Resource: this.randomUtil.getInt(1, itemDetails._props.MaxRepairResource),
};
itemToAdjust.upd.RepairKit = {Resource: this.randomUtil.getInt(1, itemDetails._props.MaxRepairResource)};
return;
}
@ -757,10 +740,7 @@ export class FenceService
const resourceMax = itemDetails._props.MaxResource;
const resourceCurrent = this.randomUtil.getInt(1, itemDetails._props.MaxResource);
itemToAdjust.upd.Resource = {
Value: resourceMax - resourceCurrent,
UnitsConsumed: resourceCurrent,
};
itemToAdjust.upd.Resource = {Value: resourceMax - resourceCurrent, UnitsConsumed: resourceCurrent};
}
}
@ -775,10 +755,7 @@ export class FenceService
for (const x in limits)
{
itemTypeCounts[x] = {
current: 0,
max: limits[x],
};
itemTypeCounts[x] = {current: 0, max: limits[x]};
}
return itemTypeCounts;

View File

@ -202,9 +202,8 @@ export class InsuranceService
}
const insuranceReturnTimeBonus = pmcData.Bonuses.find((b) => b.type === "InsuranceReturnTime");
const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonus
? Math.abs(insuranceReturnTimeBonus.value)
: 0) / 100;
const insuranceReturnTimeBonusPercent = 1.0
- (insuranceReturnTimeBonus ? Math.abs(insuranceReturnTimeBonus.value) : 0) / 100;
const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.oneHourAsSeconds;
const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.oneHourAsSeconds;
@ -335,9 +334,7 @@ export class InsuranceService
// Item didnt have faceshield object pre-raid, add it
if (!itemToReturn.upd.FaceShield)
{
itemToReturn.upd.FaceShield = {
Hits: insuredItemFromClient.hits,
};
itemToReturn.upd.FaceShield = {Hits: insuredItemFromClient.hits};
}
else
{
@ -355,12 +352,7 @@ export class InsuranceService
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void
{
const pocketSlots = [
"pocket1",
"pocket2",
"pocket3",
"pocket4",
];
const pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"];
// Some pockets can lose items with player death, some don't
if (!("slotId" in itemToReturn) || pocketSlots.includes(itemToReturn.slotId))

View File

@ -30,14 +30,12 @@ export class LocalisationService
? "Aki_Data/Server/database/locales/server"
: "./assets/database/locales/server",
);
this.i18n = new I18n(
{
this.i18n = new I18n({
locales: this.localeService.getServerSupportedLocales(),
defaultLocale: "en",
directory: localeFileDirectory,
retryInDefaultLocale: true,
},
);
});
this.i18n.setLocale(this.localeService.getDesiredServerLocale());
}

View File

@ -420,10 +420,7 @@ export class MailSendService
parentItem.parentId = this.hashUtil.generate();
}
itemsToSendToPlayer = {
stash: parentItem.parentId,
data: [],
};
itemsToSendToPlayer = {stash: parentItem.parentId, data: []};
// Ensure Ids are unique and cont collide with items in player inventory later
messageDetails.items = this.itemHelper.replaceIDs(null, messageDetails.items);

View File

@ -8,9 +8,7 @@ export class MatchLocationService
{
protected locations = {};
constructor(
@inject("TimeUtil") protected timeUtil: TimeUtil,
)
constructor(@inject("TimeUtil") protected timeUtil: TimeUtil)
{}
public createGroup(sessionID: string, info: ICreateGroupRequestData): any
@ -27,15 +25,13 @@ export class MatchLocationService
isSavage: false,
timeShift: "CURR",
dt: this.timeUtil.getTimestamp(),
players: [
{
players: [{
_id: `pmc${sessionID}`,
region: "EUR",
ip: "127.0.0.1",
savageId: `scav${sessionID}`,
accessKeyId: "",
},
],
}],
customDataCenter: [],
};

View File

@ -93,8 +93,7 @@ export class ProfileFixerService
HideoutAreas.GENERATOR,
6
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
.Generator
.Slots,
.Generator.Slots,
pmcProfile,
);
}
@ -276,8 +275,7 @@ export class ProfileFixerService
{
if (!pmcProfile.Hideout.Areas.find((x) => x.type === HideoutAreas.WEAPON_STAND))
{
pmcProfile.Hideout.Areas.push(
{
pmcProfile.Hideout.Areas.push({
type: 24,
level: 0,
active: true,
@ -286,14 +284,12 @@ export class ProfileFixerService
constructing: false,
slots: [],
lastRecipe: "",
},
);
});
}
if (!pmcProfile.Hideout.Areas.find((x) => x.type === HideoutAreas.WEAPON_STAND_SECONDARY))
{
pmcProfile.Hideout.Areas.push(
{
pmcProfile.Hideout.Areas.push({
type: 25,
level: 0,
active: true,
@ -302,8 +298,7 @@ export class ProfileFixerService
constructing: false,
slots: [],
lastRecipe: "",
},
);
});
}
}
@ -357,10 +352,7 @@ export class ProfileFixerService
if (!fullProfile.aki)
{
this.logger.debug("Adding aki object to profile");
fullProfile.aki = {
version: this.watermark.getVersionTag(),
receivedGifts: [],
};
fullProfile.aki = {version: this.watermark.getVersionTag(), receivedGifts: []};
}
}
@ -404,9 +396,7 @@ export class ProfileFixerService
if (!pmcProfile.UnlockedInfo)
{
this.logger.debug("Adding UnlockedInfo object to profile");
pmcProfile.UnlockedInfo = {
unlockedProductionRecipe: [],
};
pmcProfile.UnlockedInfo = {unlockedProductionRecipe: []};
}
}
@ -554,9 +544,9 @@ export class ProfileFixerService
{
if (
!(currentRepeatable.changeRequirement
&& currentRepeatable.activeQuests.every(
(x) => (typeof x.changeCost !== "undefined" && typeof x.changeStandingCost !== "undefined"),
))
&& currentRepeatable.activeQuests.every((
x,
) => (typeof x.changeCost !== "undefined" && typeof x.changeStandingCost !== "undefined")))
)
{
repeatablesCompatible = false;
@ -798,28 +788,17 @@ export class ProfileFixerService
if (bonus.type.toLowerCase() === "stashsize")
{
return profileBonuses.find(
(x) =>
x.type === bonus.type
&& x.templateId === bonus.templateId,
);
return profileBonuses.find((x) => x.type === bonus.type && x.templateId === bonus.templateId);
}
if (bonus.type.toLowerCase() === "additionalslots")
{
return profileBonuses.find(
(x) =>
x.type === bonus.type
&& x.value === bonus.value
&& x.visible === bonus.visible,
return profileBonuses.find((x) =>
x.type === bonus.type && x.value === bonus.value && x.visible === bonus.visible
);
}
return profileBonuses.find(
(x) =>
x.type === bonus.type
&& x.value === bonus.value,
);
return profileBonuses.find((x) => x.type === bonus.type && x.value === bonus.value);
}
/**

View File

@ -8,9 +8,7 @@ export class ProfileSnapshotService
{
protected storedProfileSnapshots: Record<string, IAkiProfile> = {};
constructor(
@inject("JsonUtil") protected jsonUtil: JsonUtil,
)
constructor(@inject("JsonUtil") protected jsonUtil: JsonUtil)
{}
/**

View File

@ -8,9 +8,7 @@ export class RagfairCategoriesService
{
protected categories: Record<string, number> = {};
constructor(
@inject("WinstonLogger") protected logger: ILogger,
)
constructor(@inject("WinstonLogger") protected logger: ILogger)
{}
/**
@ -58,9 +56,7 @@ export class RagfairCategoriesService
const itemId = offer.items[0]._tpl;
if (increment)
{
categories[itemId] = categories[itemId]
? categories[itemId] + 1
: 1;
categories[itemId] = categories[itemId] ? categories[itemId] + 1 : 1;
}
else
{

View File

@ -29,10 +29,7 @@ export class RagfairPriceService implements OnLoad
protected generatedDynamicPrices: boolean;
protected generatedStaticPrices: boolean;
protected prices: IRagfairServerPrices = {
static: {},
dynamic: {},
};
protected prices: IRagfairServerPrices = {static: {}, dynamic: {}};
constructor(
@inject("HandbookHelper") protected handbookHelper: HandbookHelper,
@ -298,8 +295,7 @@ export class RagfairPriceService implements OnLoad
// Only adjust price if difference is > a percent AND item price passes threshhold set in config
if (
priceDifferencePercent
> this.ragfairConfig.dynamic.offerAdjustment.maxPriceDifferenceBelowHandbookPercent
priceDifferencePercent > this.ragfairConfig.dynamic.offerAdjustment.maxPriceDifferenceBelowHandbookPercent
&& itemPrice >= this.ragfairConfig.dynamic.offerAdjustment.priceThreshholdRub
)
{
@ -418,10 +414,7 @@ export class RagfairPriceService implements OnLoad
const defaultPreset = presets.find((x) => x._encyclopedia);
if (defaultPreset)
{
return {
isDefault: true,
preset: defaultPreset,
};
return {isDefault: true, preset: defaultPreset};
}
if (presets.length === 1)
@ -441,9 +434,6 @@ export class RagfairPriceService implements OnLoad
);
}
return {
isDefault: false,
preset: presets[0],
};
return {isDefault: false, preset: presets[0]};
}
}

View File

@ -69,9 +69,7 @@ export class RepairService
const priceCoef = this.traderHelper.getLoyaltyLevel(traderId, pmcData).repair_price_coef;
const traderRepairDetails = this.traderHelper.getTrader(traderId, sessionID).repair;
const repairQualityMultiplier = traderRepairDetails.quality;
const repairRate = (priceCoef <= 0)
? 1
: (priceCoef / 100 + 1);
const repairRate = (priceCoef <= 0) ? 1 : (priceCoef / 100 + 1);
const itemToRepairDetails = this.databaseServer.getTables().templates.items[itemToRepair._tpl];
const repairItemIsArmor = !!itemToRepairDetails._props.ArmorMaterial;
@ -124,12 +122,7 @@ export class RepairService
{
const options: IProcessBuyTradeRequestData = {
// eslint-disable-next-line @typescript-eslint/naming-convention
scheme_items: [
{
id: repairedItemId,
count: Math.round(repairCost),
},
],
scheme_items: [{id: repairedItemId, count: Math.round(repairCost)}],
tid: traderId,
Action: "",
type: "",
@ -149,11 +142,7 @@ export class RepairService
* @param repairDetails details of item repaired, cost/item
* @param pmcData Profile to add points to
*/
public addRepairSkillPoints(
sessionId: string,
repairDetails: RepairDetails,
pmcData: IPmcData,
): void
public addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData): void
{
if (
repairDetails.repairedByKit
@ -186,9 +175,7 @@ export class RepairService
}
const isHeavyArmor = itemDetails[1]._props.ArmorType === "Heavy";
const vestSkillToLevel = isHeavyArmor
? SkillTypes.HEAVY_VESTS
: SkillTypes.LIGHT_VESTS;
const vestSkillToLevel = isHeavyArmor ? SkillTypes.HEAVY_VESTS : SkillTypes.LIGHT_VESTS;
const pointsToAddToVestSkill = repairDetails.repairPoints
* this.repairConfig.armorKitSkillPointGainPerRepairPointMultiplier;
@ -227,9 +214,7 @@ export class RepairService
* @param repairDetails the repair details to calculate skill points for
* @returns the number of skill points to reward the user
*/
protected getWeaponRepairSkillPoints(
repairDetails: RepairDetails,
): number
protected getWeaponRepairSkillPoints(repairDetails: RepairDetails): number
{
// This formula and associated configs is calculated based on 30 repairs done on live
// The points always came out 2-aligned, which is why there's a divide/multiply by 2 with ceil calls
@ -420,17 +405,11 @@ export class RepairService
if (!repairKitInInventory.upd)
{
this.logger.debug(`Repair kit: ${repairKitInInventory._id} in inventory lacks upd object, adding`);
repairKitInInventory.upd = {
RepairKit: {
Resource: maxRepairAmount,
},
};
repairKitInInventory.upd = {RepairKit: {Resource: maxRepairAmount}};
}
if (!repairKitInInventory.upd.RepairKit?.Resource)
{
repairKitInInventory.upd.RepairKit = {
Resource: maxRepairAmount,
};
repairKitInInventory.upd.RepairKit = {Resource: maxRepairAmount};
}
}

View File

@ -236,10 +236,7 @@ export class SeasonalEventService
const eventEndDate = new Date(currentDate.getFullYear(), event.endMonth - 1, event.endDay);
// Current date is between start/end dates
if (
currentDate >= eventStartDate
&& currentDate <= eventEndDate
)
if (currentDate >= eventStartDate && currentDate <= eventEndDate)
{
this.christmasEventActive = SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS;
this.halloweenEventActive = SeasonalEventType[event.type] === SeasonalEventType.HALLOWEEN;

View File

@ -120,9 +120,7 @@ export class CustomItemService
*/
protected getOrGenerateIdForItem(newId: string): string
{
return (newId === "")
? this.hashUtil.generate()
: newId;
return (newId === "") ? this.hashUtil.generate() : newId;
}
/**
@ -157,13 +155,7 @@ export class CustomItemService
*/
protected addToHandbookDb(newItemId: string, parentId: string, priceRoubles: number): void
{
this.tables.templates.handbook.Items.push(
{
Id: newItemId,
ParentId: parentId,
Price: priceRoubles,
},
);
this.tables.templates.handbook.Items.push({Id: newItemId, ParentId: parentId, Price: priceRoubles});
}
/**

View File

@ -2,10 +2,7 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
export class DynamicRouterMod extends DynamicRouter
{
public constructor(
routes: RouteAction[],
private topLevelRoute: string,
)
public constructor(routes: RouteAction[], private topLevelRoute: string)
{
super(routes);
}

View File

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

View File

@ -2,10 +2,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
export class OnLoadMod implements OnLoad
{
public constructor(
private onLoadOverride: () => void,
private getRouteOverride: () => string,
)
public constructor(private onLoadOverride: () => void, private getRouteOverride: () => string)
{
// super();
}

View File

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

View File

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

View File

@ -2,10 +2,7 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
export class StaticRouterMod extends StaticRouter
{
public constructor(
routes: RouteAction[],
private topLevelRoute: string,
)
public constructor(routes: RouteAction[], private topLevelRoute: string)
{
super(routes);
}

View File

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

View File

@ -45,9 +45,7 @@ export class DatabaseImporter implements OnLoad
*/
public getSptDataPath(): string
{
return (globalThis.G_RELEASE_CONFIGURATION)
? "Aki_Data/Server/"
: "./assets/";
return (globalThis.G_RELEASE_CONFIGURATION) ? "Aki_Data/Server/" : "./assets/";
}
public async onLoad(): Promise<void>

View File

@ -6,9 +6,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
@injectable()
export class HashUtil
{
constructor(
@inject("TimeUtil") protected timeUtil: TimeUtil,
)
constructor(@inject("TimeUtil") protected timeUtil: TimeUtil)
{}
/**

View File

@ -7,9 +7,7 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
@injectable()
export class HttpFileUtil
{
constructor(
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
)
constructor(@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper)
{
}

View File

@ -18,12 +18,10 @@ export class HttpResponseUtil
protected clearString(s: string): any
{
return s.replace(/[\b]/g, "")
.replace(/[\f]/g, "")
.replace(/[\n]/g, "")
.replace(/[\r]/g, "")
.replace(/[\t]/g, "")
.replace(/[\\]/g, "");
return s.replace(/[\b]/g, "").replace(/[\f]/g, "").replace(/[\n]/g, "").replace(/[\r]/g, "").replace(
/[\t]/g,
"",
).replace(/[\\]/g, "");
}
/**
@ -43,11 +41,7 @@ export class HttpResponseUtil
public getUnclearedBody(data: any, err = 0, errmsg = null): string
{
return this.jsonUtil.serialize({
err: err,
errmsg: errmsg,
data: data,
});
return this.jsonUtil.serialize({err: err, errmsg: errmsg, data: data});
}
public emptyResponse(): IGetBodyResponseData<string>
@ -71,11 +65,7 @@ export class HttpResponseUtil
errorCode = BackendErrorCodes.NONE,
): IItemEventRouterResponse
{
output.warnings = [{
index: 0,
errmsg: message,
code: errorCode.toString(),
}];
output.warnings = [{index: 0, errmsg: message, code: errorCode.toString()}];
return output;
}

View File

@ -9,10 +9,7 @@ import { Queue } from "@spt-aki/utils/collections/queue/Queue";
@injectable()
export class ImporterUtil
{
constructor(
@inject("VFS") protected vfs: VFS,
@inject("JsonUtil") protected jsonUtil: JsonUtil,
)
constructor(@inject("VFS") protected vfs: VFS, @inject("JsonUtil") protected jsonUtil: JsonUtil)
{}
/**
@ -74,13 +71,9 @@ export class ImporterUtil
* @param filepath Path to folder with files
* @returns
*/
public loadRecursive<T>(
filepath: string,
onReadCallback: (fileWithPath: string, data: string) => void = () =>
{},
onObjectDeserialized: (fileWithPath: string, object: any) => void = () =>
{},
): T
public loadRecursive<T>(filepath: string, onReadCallback: (fileWithPath: string, data: string) => void = () =>
{}, onObjectDeserialized: (fileWithPath: string, object: any) => void = () =>
{}): T
{
const result = {} as T;
@ -148,13 +141,11 @@ export class ImporterUtil
{
const filePathAndName = `${fileNode.filePath}${fileNode.fileName}`;
promises.push(
this.vfs.readFileAsync(filePathAndName)
.then(async (fileData) =>
this.vfs.readFileAsync(filePathAndName).then(async (fileData) =>
{
onReadCallback(filePathAndName, fileData);
return this.jsonUtil.deserializeWithCacheCheckAsync<any>(fileData, filePathAndName);
})
.then(async (fileDeserialized) =>
}).then(async (fileDeserialized) =>
{
onObjectDeserialized(filePathAndName, fileDeserialized);
const strippedFilePath = this.vfs.stripExtension(filePathAndName).replace(filepath, "");
@ -196,9 +187,6 @@ export class ImporterUtil
class VisitNode
{
constructor(
public filePath: string,
public fileName: string,
)
constructor(public filePath: string, public fileName: string)
{}
}

View File

@ -63,11 +63,7 @@ export class JsonUtil
* @param options Stringify options or a replacer.
* @returns The string converted from the JavaScript value
*/
public serializeJsonC(
data: any,
filename?: string | null,
options?: IStringifyOptions | Reviver,
): string
public serializeJsonC(data: any, filename?: string | null, options?: IStringifyOptions | Reviver): string
{
try
{
@ -81,11 +77,7 @@ export class JsonUtil
}
}
public serializeJson5(
data: any,
filename?: string | null,
prettify = false,
): string
public serializeJson5(data: any, filename?: string | null, prettify = false): string
{
try
{

View File

@ -6,9 +6,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
@injectable()
export class ObjectId
{
constructor(
@inject("TimeUtil") protected timeUtil: TimeUtil,
)
constructor(@inject("TimeUtil") protected timeUtil: TimeUtil)
{}
protected randomBytes = crypto.randomBytes(5);

View File

@ -21,11 +21,7 @@ import { MathUtil } from "@spt-aki/utils/MathUtil";
*/
export class ProbabilityObjectArray<K, V = undefined> extends Array<ProbabilityObject<K, V>>
{
constructor(
private mathUtil: MathUtil,
private jsonUtil: JsonUtil,
...items: ProbabilityObject<K, V>[]
)
constructor(private mathUtil: MathUtil, private jsonUtil: JsonUtil, ...items: ProbabilityObject<K, V>[])
{
super();
this.push(...items);
@ -204,10 +200,7 @@ export class ProbabilityObject<K, V = undefined>
@injectable()
export class RandomUtil
{
constructor(
@inject("JsonUtil") protected jsonUtil: JsonUtil,
@inject("WinstonLogger") protected logger: ILogger,
)
constructor(@inject("JsonUtil") protected jsonUtil: JsonUtil, @inject("WinstonLogger") protected logger: ILogger)
{
}
@ -381,10 +374,7 @@ export class RandomUtil
if (n < 1)
{
throw {
name: "Invalid argument",
message: `'n' must be 1 or greater (received ${n})`,
};
throw {name: "Invalid argument", message: `'n' must be 1 or greater (received ${n})`};
}
if (min === max)
@ -453,10 +443,7 @@ export class RandomUtil
currentIndex--;
// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex],
array[currentIndex],
];
[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
}
return array;

View File

@ -26,9 +26,7 @@ export class VFS
rmdirPromisify: (path: fs.PathLike) => Promise<void>;
renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise<void>;
constructor(
@inject("AsyncQueue") protected asyncQueue: IAsyncQueue,
)
constructor(@inject("AsyncQueue") protected asyncQueue: IAsyncQueue)
{
this.accessFilePromisify = promisify(fs.access);
this.copyFilePromisify = promisify(fs.copyFile);
@ -52,10 +50,7 @@ export class VFS
try
{
// Create the command to add to the queue
const command = {
uuid: crypto.randomUUID(),
cmd: async () => await this.accessFilePromisify(filepath),
};
const command = {uuid: crypto.randomUUID(), cmd: async () => await this.accessFilePromisify(filepath)};
// Wait for the command completion
await this.asyncQueue.waitFor(command);
@ -76,10 +71,7 @@ export class VFS
public async copyAsync(filepath: fs.PathLike, target: fs.PathLike): Promise<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);
}

View File

@ -14,9 +14,7 @@ export class WatermarkLocale
protected warning: string[];
protected modding: string[];
constructor(
@inject("LocalisationService") protected localisationService: LocalisationService,
)
constructor(@inject("LocalisationService") protected localisationService: LocalisationService)
{
this.description = [
this.localisationService.getText("watermark-discord_url"),

View File

@ -17,22 +17,8 @@ export abstract class AbstractWinstonLogger implements ILogger
protected showDebugInConsole = false;
protected filePath: string;
protected logLevels = {
levels: {
error: 0,
warn: 1,
succ: 2,
info: 3,
custom: 4,
debug: 5,
},
colors: {
error: "red",
warn: "yellow",
succ: "green",
info: "white",
custom: "black",
debug: "gray",
},
levels: {error: 0, warn: 1, succ: 2, info: 3, custom: 4, debug: 5},
colors: {error: "red", warn: "yellow", succ: "green", info: "white", custom: "black", debug: "gray"},
bgColors: {
default: "",
blackBG: "blackBG",
@ -48,9 +34,7 @@ export abstract class AbstractWinstonLogger implements ILogger
protected logger: winston.Logger & SptLogger;
protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise<void>;
constructor(
protected asyncQueue: IAsyncQueue,
)
constructor(protected asyncQueue: IAsyncQueue)
{
this.filePath = `${this.getFilePath()}${this.getFileName()}`;
this.writeFilePromisify = promisify(fs.writeFile);
@ -101,10 +85,7 @@ export abstract class AbstractWinstonLogger implements ILogger
}
winston.addColors(this.logLevels.colors);
this.logger = createLogger({
levels: this.logLevels.levels,
transports: [...transportsList],
});
this.logger = createLogger({levels: this.logLevels.levels, transports: [...transportsList]});
if (this.isLogExceptions())
{
@ -165,10 +146,7 @@ export abstract class AbstractWinstonLogger implements ILogger
if (typeof data === "string")
{
command = {
uuid: crypto.randomUUID(),
cmd: async () => await tmpLogger.log("custom", data),
};
command = {uuid: crypto.randomUUID(), cmd: async () => await tmpLogger.log("custom", data)};
}
else
{
@ -183,37 +161,25 @@ export abstract class AbstractWinstonLogger implements ILogger
public async error(data: string | Record<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);
}
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);
}
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);
}
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);
}
@ -243,17 +209,11 @@ export abstract class AbstractWinstonLogger implements ILogger
if (onlyShowInConsole)
{
command = {
uuid: crypto.randomUUID(),
cmd: async () => await this.log(data, this.logLevels.colors.debug),
};
command = {uuid: crypto.randomUUID(), cmd: async () => await this.log(data, this.logLevels.colors.debug)};
}
else
{
command = {
uuid: crypto.randomUUID(),
cmd: async () => await this.logger.debug(data),
};
command = {uuid: crypto.randomUUID(), cmd: async () => await this.logger.debug(data)};
}
await this.asyncQueue.waitFor(command);

View File

@ -6,9 +6,7 @@ import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLog
@injectable()
export class WinstonMainLogger extends AbstractWinstonLogger
{
constructor(
@inject("AsyncQueue") protected asyncQueue: IAsyncQueue,
)
constructor(@inject("AsyncQueue") protected asyncQueue: IAsyncQueue)
{
super(asyncQueue);
}

View File

@ -6,9 +6,7 @@ import { AbstractWinstonLogger } from "@spt-aki/utils/logging/AbstractWinstonLog
@injectable()
export class WinstonRequestLogger extends AbstractWinstonLogger
{
constructor(
@inject("AsyncQueue") protected asyncQueue: IAsyncQueue,
)
constructor(@inject("AsyncQueue") protected asyncQueue: IAsyncQueue)
{
super(asyncQueue);
}

View File

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

View File

@ -34,10 +34,7 @@ describe("InsuranceController", () =>
{
const session1 = "session1";
const session2 = "session2";
const profiles = {
[session1]: {},
[session2]: {},
};
const profiles = {[session1]: {}, [session2]: {}};
const getProfilesSpy = vi.spyOn(insuranceController.saveServer, "getProfiles").mockReturnValue(profiles);
const processReturnByProfileSpy = vi.spyOn(insuranceController, "processReturnByProfile").mockReturnValue(
vi.fn(),
@ -75,10 +72,12 @@ describe("InsuranceController", () =>
const sessionId = "session-id";
// Mock internal methods.
const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems")
.mockReturnValue(insuranceFixture);
const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems")
.mockImplementation(vi.fn());
const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems").mockReturnValue(
insuranceFixture,
);
const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems").mockImplementation(
vi.fn(),
);
insuranceController.processReturnByProfile(sessionId);
@ -92,10 +91,10 @@ describe("InsuranceController", () =>
const sessionId = "session-id";
// Mock internal methods.
const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems")
.mockReturnValue([]); // Return an empty array.
const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems")
.mockImplementation(vi.fn());
const mockFilterInsuredItems = vi.spyOn(insuranceController, "filterInsuredItems").mockReturnValue([]); // Return an empty array.
const mockProcessInsuredItems = vi.spyOn(insuranceController, "processInsuredItems").mockImplementation(
vi.fn(),
);
insuranceController.processReturnByProfile(sessionId);
@ -113,8 +112,9 @@ describe("InsuranceController", () =>
const insured = JSON.parse(JSON.stringify(insuranceFixture));
// Mock getProfile to return the fixture.
const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile")
.mockReturnValue({insurance: insured});
const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile").mockReturnValue({
insurance: insured,
});
const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug");
// Execute the method.
@ -137,8 +137,9 @@ describe("InsuranceController", () =>
insured[0].scheduledTime = Math.floor((Date.now() / 1000) + (2 * 60 * 60));
// Mock getProfile to return the fixture.
const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile")
.mockReturnValue({insurance: insured});
const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile").mockReturnValue({
insurance: insured,
});
const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug");
// Execute the method.
@ -158,8 +159,9 @@ describe("InsuranceController", () =>
const insured = JSON.parse(JSON.stringify(insuranceFixture));
// Mock getProfile to return the fixture.
const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile")
.mockReturnValue({insurance: insured});
const mockGetProfile = vi.spyOn(insuranceController.saveServer, "getProfile").mockReturnValue({
insurance: insured,
});
const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug");
// Execute the method, passing in a time that's two hours in the past. The function should use this past
@ -241,25 +243,19 @@ describe("InsuranceController", () =>
{
it("should return the total number of items in all insurance packages", () =>
{
const insurance = [
{
const insurance = [{
_id: "1",
upd: 1234567890,
items: [
{_id: "1", parentId: "1", slotId: "1"},
{_id: "2", parentId: "1", slotId: "2"},
],
},
{
items: [{_id: "1", parentId: "1", slotId: "1"}, {_id: "2", parentId: "1", slotId: "2"}],
}, {
_id: "2",
upd: 1234567890,
items: [
{_id: "3", parentId: "2", slotId: "1"},
{_id: "4", parentId: "2", slotId: "2"},
{_id: "5", parentId: "2", slotId: "3"},
],
},
];
items: [{_id: "3", parentId: "2", slotId: "1"}, {_id: "4", parentId: "2", slotId: "2"}, {
_id: "5",
parentId: "2",
slotId: "3",
}],
}];
const expectedCount = 5; // 2 items in the first package + 3 items in the second package.
// Execute the method.
@ -283,18 +279,7 @@ describe("InsuranceController", () =>
it("should return 0 if there are no items in any of the insurance packages", () =>
{
const insurance = [
{
_id: "1",
upd: 1234567890,
items: [],
},
{
_id: "2",
upd: 1234567890,
items: [],
},
];
const insurance = [{_id: "1", upd: 1234567890, items: []}, {_id: "2", upd: 1234567890, items: []}];
const expectedCount = 0;
// Execute the method.
@ -310,32 +295,13 @@ describe("InsuranceController", () =>
it("should remove the specified insurance package from the profile", () =>
{
const sessionID = "session-id";
const packageToRemove = {
date: "01.11.2023",
time: "10:51",
location: "factory4_day",
};
const packageToRemove = {date: "01.11.2023", time: "10:51", location: "factory4_day"};
const profile = {
insurance: [
{
messageContent: {
systemData: {
date: "01.11.2023",
time: "11:18",
location: "factory4_day",
},
},
},
{ // This one should be removed
messageContent: {
systemData: {
date: "01.11.2023",
time: "10:51",
location: "factory4_day",
},
},
},
],
insurance: [{
messageContent: {systemData: {date: "01.11.2023", time: "11:18", location: "factory4_day"}},
}, { // This one should be removed
messageContent: {systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}},
}],
};
// Mock the getProfile method to return the above profile.
@ -356,23 +322,11 @@ describe("InsuranceController", () =>
it("should log a message indicating that the package was removed", () =>
{
const sessionID = "session-id";
const packageToRemove = {
date: "01.11.2023",
time: "10:51",
location: "factory4_day",
};
const packageToRemove = {date: "01.11.2023", time: "10:51", location: "factory4_day"};
const profile = {
insurance: [
{
messageContent: {
systemData: {
date: "01.11.2023",
time: "10:51",
location: "factory4_day",
},
},
},
],
insurance: [{
messageContent: {systemData: {date: "01.11.2023", time: "10:51", location: "factory4_day"}},
}],
};
// Mock the getProfile method to return the above profile.
@ -393,23 +347,11 @@ describe("InsuranceController", () =>
it("should not remove any packages if the specified package is not found", () =>
{
const sessionID = "session-id";
const packageToRemove = {
date: "01.11.2023",
time: "10:51",
location: "factory4_day",
};
const packageToRemove = {date: "01.11.2023", time: "10:51", location: "factory4_day"};
const profile = {
insurance: [
{
messageContent: {
systemData: {
date: "02.11.2023",
time: "10:50",
location: "factory4_night",
},
},
},
],
insurance: [{
messageContent: {systemData: {date: "02.11.2023", time: "10:50", location: "factory4_night"}},
}],
};
// Mock the getProfile method to return the above profile.
@ -975,10 +917,11 @@ describe("InsuranceController", () =>
{
it("should log details for each attachment", () =>
{
const attachments = [
{_id: "item1", name: "Item 1", maxPrice: 100},
{_id: "item2", name: "Item 2", maxPrice: 200},
];
const attachments = [{_id: "item1", name: "Item 1", maxPrice: 100}, {
_id: "item2",
name: "Item 2",
maxPrice: 200,
}];
// Mock the logger.debug function.
const loggerDebugSpy = vi.spyOn(insuranceController.logger, "debug");
@ -1018,8 +961,7 @@ describe("InsuranceController", () =>
// Mock rollForDelete to return true for the first two attachments.
const mockRollForDelete = vi.spyOn(insuranceController, "rollForDelete").mockReturnValue(false)
.mockReturnValueOnce(true)
.mockReturnValueOnce(true);
.mockReturnValueOnce(true).mockReturnValueOnce(true);
// Execute the method.
const result = insuranceController.countSuccessfulRolls(attachments, insured.traderId);
@ -1298,8 +1240,9 @@ describe("InsuranceController", () =>
const insuranceFailedTpl = "failed-message-template";
// Mock the randomUtil to return a static failed template string.
const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue")
.mockReturnValue(insuranceFailedTpl);
const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue").mockReturnValue(
insuranceFailedTpl,
);
// Don't actually send the message.
const sendMessageSpy = vi.spyOn(insuranceController.mailSendService, "sendLocalisedNpcMessageToPlayer")
@ -1332,8 +1275,9 @@ describe("InsuranceController", () =>
const insuranceFailedTpl = "failed-message-template";
// Mock the randomUtil to return a static failed template string.
const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue")
.mockReturnValue(insuranceFailedTpl);
const mockGetArrayValue = vi.spyOn(insuranceController.randomUtil, "getArrayValue").mockReturnValue(
insuranceFailedTpl,
);
// Don't actually send the message.
const sendMessageSpy = vi.spyOn(insuranceController.mailSendService, "sendLocalisedNpcMessageToPlayer")
@ -1452,18 +1396,10 @@ describe("InsuranceController", () =>
// Setup shared test data.
pmcData = {
Inventory: {
items: [
{_id: "item1", otherProps: "value1"},
{_id: "item2", otherProps: "value2"},
],
},
Inventory: {items: [{_id: "item1", otherProps: "value1"}, {_id: "item2", otherProps: "value2"}]},
InsuredItems: [],
};
body = {
items: ["item1", "item2"],
tid: "someTraderId",
};
body = {items: ["item1", "item2"], tid: "someTraderId"};
sessionId = "session-id";
// Setup shared mocks.
@ -1488,10 +1424,7 @@ describe("InsuranceController", () =>
expect(mockPayMoney).toHaveBeenCalledWith(
pmcData,
{
scheme_items: [
{id: "item1", count: 100},
{id: "item2", count: 100},
],
scheme_items: [{id: "item1", count: 100}, {id: "item2", count: 100}],
tid: "someTraderId",
Action: "",
type: "",
@ -1500,10 +1433,7 @@ describe("InsuranceController", () =>
scheme_id: 0,
},
sessionId,
{
warnings: [],
otherProperty: "property-value",
},
{warnings: [], otherProperty: "property-value"},
);
});
@ -1529,10 +1459,7 @@ describe("InsuranceController", () =>
// Define the expected payment options structure based on the setup data.
const expectedPaymentOptions = {
scheme_items: [
{id: "item1", count: 100},
{id: "item2", count: 100},
],
scheme_items: [{id: "item1", count: 100}, {id: "item2", count: 100}],
tid: body.tid,
Action: "",
type: "",
@ -1571,11 +1498,7 @@ describe("InsuranceController", () =>
{
// Override the payMoney mock to simulate a payment failure with a warning.
const expectedPayMoneyReturn = {
warnings: [{
index: 0,
errmsg: "Not enough money to complete transaction",
code: 500,
}],
warnings: [{index: 0, errmsg: "Not enough money to complete transaction", code: 500}],
otherProperty: "property-value",
};
mockPayMoney.mockReturnValue(expectedPayMoneyReturn);
@ -1594,11 +1517,7 @@ describe("InsuranceController", () =>
{
// Override the payMoney mock to simulate a payment failure with a warning.
const expectedPayMoneyReturn = {
warnings: [{
index: 0,
errmsg: "Not enough money to complete transaction",
code: 500,
}],
warnings: [{index: 0, errmsg: "Not enough money to complete transaction", code: 500}],
otherProperty: "property-value",
};
mockPayMoney.mockReturnValue(expectedPayMoneyReturn);
@ -1623,11 +1542,11 @@ describe("InsuranceController", () =>
vi.spyOn(insuranceController.profileHelper, "getPmcProfile").mockReturnValue({
Inventory: {
items: [
{_id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1"},
{_id: "itemId2", _tpl: "itemTpl2", otherProperty: "property-value2"},
{_id: "itemId3", _tpl: "itemTpl3", otherProperty: "property-value3"},
],
items: [{_id: "itemId1", _tpl: "itemTpl1", otherProperty: "property-value1"}, {
_id: "itemId2",
_tpl: "itemTpl2",
otherProperty: "property-value2",
}, {_id: "itemId3", _tpl: "itemTpl3", otherProperty: "property-value3"}],
},
});
});
@ -1664,23 +1583,16 @@ describe("InsuranceController", () =>
it("should return the expected cost for each item and trader", () =>
{
const request = {
traders: ["prapor", "therapist"],
items: ["itemId1", "itemId2", "itemId3"],
};
const request = {traders: ["prapor", "therapist"], items: ["itemId1", "itemId2", "itemId3"]};
const expected = {
prapor: {itemTpl1: 100, itemTpl2: 200, itemTpl3: 300},
therapist: {itemTpl1: 150, itemTpl2: 250, itemTpl3: 350},
};
// Mock the InsuranceService.getPremium method to return the expected values.
vi.spyOn(insuranceController.insuranceService, "getPremium")
.mockReturnValueOnce(100)
.mockReturnValueOnce(200)
.mockReturnValueOnce(300)
.mockReturnValueOnce(150)
.mockReturnValueOnce(250)
.mockReturnValueOnce(350);
vi.spyOn(insuranceController.insuranceService, "getPremium").mockReturnValueOnce(100).mockReturnValueOnce(
200,
).mockReturnValueOnce(300).mockReturnValueOnce(150).mockReturnValueOnce(250).mockReturnValueOnce(350);
const result = insuranceController.cost(request, sessionId);
@ -1697,14 +1609,12 @@ describe("InsuranceController", () =>
"itemId4", // Doesn't exist in the player's inventory.
],
};
const expected = {
prapor: {itemTpl1: 100, itemTpl2: 200},
};
const expected = {prapor: {itemTpl1: 100, itemTpl2: 200}};
// Mock the InsuranceService.getPremium method to return the expected values.
vi.spyOn(insuranceController.insuranceService, "getPremium")
.mockReturnValueOnce(100)
.mockReturnValueOnce(200);
vi.spyOn(insuranceController.insuranceService, "getPremium").mockReturnValueOnce(100).mockReturnValueOnce(
200,
);
const result = insuranceController.cost(request, sessionId);

View File

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

View File

@ -27,10 +27,7 @@ describe("BotLevelGenerator", () =>
{
it("should return value between 5 and 10 when player is level 5 and max is 10", () =>
{
const levelDetails: MinMax = {
min: 5,
max: 10,
};
const levelDetails: MinMax = {min: 5, max: 10};
const botGenerationDetails: BotGenerationDetails = {
isPmc: false,
@ -53,10 +50,7 @@ describe("BotLevelGenerator", () =>
{
it("should return 10 when player level is 5 and delta is 5", () =>
{
const levelDetails: MinMax = {
min: 5,
max: 10,
};
const levelDetails: MinMax = {min: 5, max: 10};
const expTable = databaseServer.getTables().globals.config.exp.level.exp_table;
@ -67,10 +61,7 @@ describe("BotLevelGenerator", () =>
it("should return 79 when player level is above possible max (100), desired max is 100 and delta is 5", () =>
{
const levelDetails: MinMax = {
min: 100,
max: 100,
};
const levelDetails: MinMax = {min: 100, max: 100};
const expTable = databaseServer.getTables().globals.config.exp.level.exp_table;
const playerLevel = 100;

View File

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

View File

@ -249,10 +249,7 @@ describe("ItemHelper", () =>
{
it("should set upd.StackObjectsCount to 1 if upd is undefined", () =>
{
const initialItem: Item = {
_id: "",
_tpl: "",
};
const initialItem: Item = {_id: "", _tpl: ""};
const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined();
@ -261,11 +258,7 @@ describe("ItemHelper", () =>
it("should set upd.StackObjectsCount to 1 if upd.StackObjectsCount is undefined", () =>
{
const initialItem: Item = {
_id: "",
_tpl: "",
upd: {},
};
const initialItem: Item = {_id: "", _tpl: "", upd: {}};
const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined();
@ -274,13 +267,7 @@ describe("ItemHelper", () =>
it("should not change upd.StackObjectsCount if it is already defined", () =>
{
const initialItem: Item = {
_id: "",
_tpl: "",
upd: {
StackObjectsCount: 5,
},
};
const initialItem: Item = {_id: "", _tpl: "", upd: {StackObjectsCount: 5}};
const fixedItem = itemHelper.fixItemStackCount(initialItem);
expect(fixedItem.upd).toBeDefined();
@ -465,12 +452,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "5b40e1525acfc4771e1c6611", // "HighCom Striker ULACH IIIA helmet (Black)"
upd: {
Repairable: {
Durability: 19,
MaxDurability: 38,
},
},
upd: {Repairable: {Durability: 19, MaxDurability: 38}},
};
const result = itemHelper.getItemQualityModifier(item);
@ -484,12 +466,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "5a38e6bac4a2826c6e06d79b", // "TOZ-106 20ga bolt-action shotgun"
upd: {
Repairable: {
Durability: 20,
MaxDurability: 100,
},
},
upd: {Repairable: {Durability: 20, MaxDurability: 100}},
};
const result = itemHelper.getItemQualityModifier(item);
@ -521,11 +498,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "5780cf7f2459777de4559322", // "Dorm room 314 marked key"
upd: {
Key: {
NumberOfUsages: 5,
},
},
upd: {Key: {NumberOfUsages: 5}},
};
const result = itemHelper.getItemQualityModifier(item);
@ -558,11 +531,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {
RepairKit: {
Resource: 600,
},
},
upd: {RepairKit: {Resource: 600}},
};
const result = itemHelper.getItemQualityModifier(item);
@ -576,11 +545,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {
RepairKit: {
Resource: 0,
},
},
upd: {RepairKit: {Resource: 0}},
};
const result = itemHelper.getItemQualityModifier(item);
@ -594,10 +559,7 @@ describe("ItemHelper", () =>
it("should return the correct quality value for armor items", () =>
{
const armor = itemHelper.getItem("5648a7494bdc2d9d488b4583")[1]; // "PACA Soft Armor"
const repairable: Repairable = {
Durability: 25,
MaxDurability: 50,
};
const repairable: Repairable = {Durability: 25, MaxDurability: 50};
const item: Item = { // Not used for armor, but required for the method.
_id: "",
_tpl: "",
@ -630,14 +592,8 @@ describe("ItemHelper", () =>
it("should return the correct quality value for weapon items", () =>
{
const weapon = itemHelper.getItem("5a38e6bac4a2826c6e06d79b")[1]; // "TOZ-106 20ga bolt-action shotgun"
const repairable: Repairable = {
Durability: 50,
MaxDurability: 100,
};
const item: Item = {
_id: "",
_tpl: "",
};
const repairable: Repairable = {Durability: 50, MaxDurability: 100};
const item: Item = {_id: "", _tpl: ""};
// Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -653,10 +609,7 @@ describe("ItemHelper", () =>
Durability: 50,
MaxDurability: 200, // This should be used now.
};
const item: Item = {
_id: "",
_tpl: "",
};
const item: Item = {_id: "", _tpl: ""};
// Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -672,10 +625,7 @@ describe("ItemHelper", () =>
Durability: 50,
MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type.
};
const item: Item = {
_id: "",
_tpl: "",
};
const item: Item = {_id: "", _tpl: ""};
// Mock the logger's error method to prevent it from being actually called.
const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error").mockImplementation(() =>
@ -696,10 +646,7 @@ describe("ItemHelper", () =>
Durability: 50,
MaxDurability: 0, // This is a problem.
};
const item: Item = {
_id: "",
_tpl: "",
};
const item: Item = {_id: "", _tpl: ""};
// Cast the method to any to allow access to private/protected method.
const result = (itemHelper as any).getRepairableItemQualityValue(weapon, repairable, item);
@ -715,10 +662,7 @@ describe("ItemHelper", () =>
Durability: 50,
MaxDurability: undefined, // Remove the MaxDurability property value... Technically an invalid Type.
};
const item: Item = {
_id: "",
_tpl: "",
};
const item: Item = {_id: "", _tpl: ""};
const loggerErrorSpy = vi.spyOn((itemHelper as any).logger, "error");
@ -733,44 +677,40 @@ describe("ItemHelper", () =>
{
it("should return an array containing only the parent ID when no children are found", () =>
{
const items: Item[] = [
{_id: "1", _tpl: "", parentId: null},
{_id: "2", _tpl: "", parentId: null},
{_id: "3", _tpl: "", parentId: "2"},
];
const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: null}, {
_id: "3",
_tpl: "",
parentId: "2",
}];
const result = itemHelper.findAndReturnChildrenByItems(items, "1");
expect(result).toEqual(["1"]);
});
it("should return array of child IDs when single-level children are found", () =>
{
const items: Item[] = [
{_id: "1", _tpl: "", parentId: null},
{_id: "2", _tpl: "", parentId: "1"},
{_id: "3", _tpl: "", parentId: "1"},
];
const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: "1"}, {
_id: "3",
_tpl: "",
parentId: "1",
}];
const result = itemHelper.findAndReturnChildrenByItems(items, "1");
expect(result).toEqual(["2", "3", "1"]);
});
it("should return array of child IDs when multi-level children are found", () =>
{
const items: Item[] = [
{_id: "1", _tpl: "", parentId: null},
{_id: "2", _tpl: "", parentId: "1"},
{_id: "3", _tpl: "", parentId: "2"},
{_id: "4", _tpl: "", parentId: "3"},
];
const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: "1"}, {
_id: "3",
_tpl: "",
parentId: "2",
}, {_id: "4", _tpl: "", parentId: "3"}];
const result = itemHelper.findAndReturnChildrenByItems(items, "1");
expect(result).toEqual(["4", "3", "2", "1"]);
});
it("should return an array containing only the parent ID when parent ID does not exist in items", () =>
{
const items: Item[] = [
{_id: "1", _tpl: "", parentId: null},
{_id: "2", _tpl: "", parentId: "1"},
];
const items: Item[] = [{_id: "1", _tpl: "", parentId: null}, {_id: "2", _tpl: "", parentId: "1"}];
const result = itemHelper.findAndReturnChildrenByItems(items, "3");
expect(result).toEqual(["3"]);
});
@ -807,9 +747,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {
StackObjectsCount: 5,
},
upd: {StackObjectsCount: 5},
};
const result = itemHelper.getItemStackSize(item);
expect(result).toBe(5);
@ -824,10 +762,7 @@ describe("ItemHelper", () =>
const item: Item = {
_id: itemId,
_tpl: "591094e086f7747caa7bb2ef", // "Body armor repair kit"
upd: {
BuyRestrictionCurrent: 0,
BuyRestrictionMax: 1,
},
upd: {BuyRestrictionCurrent: 0, BuyRestrictionMax: 1},
};
const result = itemHelper.hasBuyRestrictions(item);
expect(result).toBe(true);
@ -1089,15 +1024,7 @@ describe("ItemHelper", () =>
const mockTemplateItem = {
_id: "571a29dc2459771fb2755a6a",
_name: "mag_tt_toz_std_762x25tt_8",
_props: {
Cartridges: [{
_props: {
filters: [{
Filter: validAmmoItems,
}],
},
}],
},
_props: {Cartridges: [{_props: {filters: [{Filter: validAmmoItems}]}}]},
};
vi.spyOn((itemHelper as any).randomUtil, "getArrayValue").mockReturnValue(validAmmoItems[0]);
@ -1109,13 +1036,7 @@ describe("ItemHelper", () =>
it("should return null when passed template has empty cartridge property", () =>
{
const fakeTemplateItem = {
_props: {
Cartridges: [
{},
],
},
};
const fakeTemplateItem = {_props: {Cartridges: [{}]}};
const result = itemHelper.getRandomCompatibleCaliberTemplateId(fakeTemplateItem as ITemplateItem);
expect(result).toBe(null);

View File

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

View File

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