0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-12 22:10:44 -05:00

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},
{
ProductName: manifest.author,
FileDescription: manifest.description,
CompanyName: manifest.name,
LegalCopyright: manifest.license,
},
);
vi.setStringValues({lang: 1033, codepage: 1200}, {
ProductName: manifest.author,
FileDescription: manifest.description,
CompanyName: manifest.name,
LegalCopyright: manifest.license,
});
vi.removeStringValue({lang: 1033, codepage: 1200}, "OriginalFilename");
vi.removeStringValue({lang: 1033, codepage: 1200}, "InternalName");
vi.setFileVersion(...manifest.version.split(".").map(Number));

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,29 +138,19 @@ export class ProfileCallbacks
{
const response: GetProfileStatusResponseData = {
maxPveCountExceeded: false,
profiles: [
{
profileid: `scav${sessionID}`,
profileToken: null,
status: "Free",
sid: "",
ip: "",
port: 0,
version: "live",
location: "bigmap",
raidMode: "Online",
mode: "deathmatch",
shortId: "xxx1x1",
},
{
profileid: `pmc${sessionID}`,
profileToken: null,
status: "Free",
sid: "",
ip: "",
port: 0,
},
],
profiles: [{
profileid: `scav${sessionID}`,
profileToken: null,
status: "Free",
sid: "",
ip: "",
port: 0,
version: "live",
location: "bigmap",
raidMode: "Online",
mode: "deathmatch",
shortId: "xxx1x1",
}, {profileid: `pmc${sessionID}`, profileToken: null, status: "Free", sid: "", ip: "", port: 0}],
};
return this.httpResponse.getBody(response);

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(
{
_id: item.id,
_tpl: item.tpl,
slotId: "main",
parentId: parentId,
upd: {
StackObjectsCount: item.stackCount,
SpawnedInSession: true,
},
},
);
mailableLoot.push({
_id: item.id,
_tpl: item.tpl,
slotId: "main",
parentId: parentId,
upd: {StackObjectsCount: item.stackCount, SpawnedInSession: true},
});
}
// Send message from fence giving player reward generated above

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) =>
x.name === repeatableQuestProfile.sptRepatableGroupName
)
.id,
id: repeatableSettings.id ?? this.questConfig.repeatableQuests.find((x) =>
x.name === repeatableQuestProfile.sptRepatableGroupName
).id,
name: repeatableSettings.name,
endTime: repeatableSettings.endTime,
changeRequirement: change,
@ -957,10 +955,6 @@ export class QuestController
return;
}
pmcData.BackendCounters[conditionId] = {
id: conditionId,
qid: questId,
value: counterValue,
};
pmcData.BackendCounters[conditionId] = {id: conditionId, qid: questId, value: counterValue};
}
}

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,
},
{
slot: EquipmentSlots.SECOND_PRIMARY_WEAPON,
shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon)
: false,
},
{
slot: EquipmentSlots.HOLSTER,
shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol
: true, // No primary = force pistol
},
];
return [{slot: EquipmentSlots.FIRST_PRIMARY_WEAPON, shouldSpawn: shouldSpawnPrimary}, {
slot: EquipmentSlots.SECOND_PRIMARY_WEAPON,
shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon)
: false,
}, {
slot: EquipmentSlots.HOLSTER,
shouldSpawn: shouldSpawnPrimary
? this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol
: true, // No primary = force pistol
}];
}
/**

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(
{
_id: this.hashUtil.generate(),
_tpl: ubglAmmoTpl,
parentId: ubglMod._id,
slotId: "patron_in_weapon",
upd: {
StackObjectsCount: 1,
},
},
);
weaponMods.push({
_id: this.hashUtil.generate(),
_tpl: ubglAmmoTpl,
parentId: ubglMod._id,
slotId: "patron_in_weapon",
upd: {StackObjectsCount: 1},
});
}
/**

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

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,14 +392,13 @@ export class LootGenerator
}
// Get all items of the desired type + not quest items + not globally blacklisted
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items)
.filter((x) =>
x._parent === rewardTypeId
&& x._type.toLowerCase() === "item"
&& !this.itemFilterService.isItemBlacklisted(x._id)
&& (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id)))
&& !x._props.QuestItem
);
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items).filter((x) =>
x._parent === rewardTypeId
&& x._type.toLowerCase() === "item"
&& !this.itemFilterService.isItemBlacklisted(x._id)
&& (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id)))
&& !x._props.QuestItem
);
if (rewardItemPool.length === 0)
{

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

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) =>
(!("PassageRequirement" in x)
|| repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes(
x.PassageRequirement,
))
&& x.Chance > 0,
const possibleExists = mapExits.filter((x) =>
(!("PassageRequirement" in x)
|| repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes(
x.PassageRequirement,
)) && x.Chance > 0
);
const exit = this.randomUtil.drawRandomFromList(possibleExists, 1)[0];
const exitCondition = this.generateExplorationExitCondition(exit);
@ -823,14 +797,7 @@ export class RepeatableQuestGenerator
*/
protected generateExplorationExitCondition(exit: Exit): IExplorationCondition
{
return {
_parent: "ExitName",
_props: {
exitName: exit.Name,
id: this.objectId.generate(),
dynamicLocale: true,
},
};
return {_parent: "ExitName", _props: {exitName: exit.Name, id: this.objectId.generate(), dynamicLocale: true}};
}
/**
@ -890,10 +857,11 @@ export class RepeatableQuestGenerator
1,
Math.round(this.mathUtil.interp1(pmcLevel, levelsConfig, itemsConfig)) + 1,
);
const rewardReputation = Math.round(
100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig)
* this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
) / 100;
const rewardReputation =
Math.round(
100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig)
* this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
) / 100;
const skillRewardChance = this.mathUtil.interp1(pmcLevel, levelsConfig, skillRewardChanceConfig);
const skillPointReward = this.mathUtil.interp1(pmcLevel, levelsConfig, skillPointRewardConfig);
@ -901,17 +869,7 @@ export class RepeatableQuestGenerator
let roublesBudget = rewardRoubles;
let chosenRewardItems = this.chooseRewardItemsWithinBudget(repeatableConfig, roublesBudget);
const rewards: IRewards = {
Started: [],
Success: [
{
value: rewardXP,
type: "Experience",
index: 0,
},
],
Fail: [],
};
const rewards: IRewards = {Started: [], Success: [{value: rewardXP, type: "Experience", index: 0}], Fail: []};
if (traderId === Traders.PEACEKEEPER)
{
@ -988,12 +946,7 @@ export class RepeatableQuestGenerator
// Add rep reward to rewards array
if (rewardReputation > 0)
{
const reward: IReward = {
target: traderId,
value: rewardReputation,
type: "TraderStanding",
index: index,
};
const reward: IReward = {target: traderId, value: rewardReputation, type: "TraderStanding", index: index};
rewards.Success.push(reward);
}
@ -1057,21 +1010,9 @@ export class RepeatableQuestGenerator
protected generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward
{
const id = this.objectId.generate();
const rewardItem: IReward = {
target: id,
value: value,
type: "Item",
index: index,
};
const rewardItem: IReward = {target: id, value: value, type: "Item", index: index};
const rootItem = {
_id: id,
_tpl: tpl,
upd: {
StackObjectsCount: value,
SpawnedInSession: true,
},
};
const rootItem = {_id: id, _tpl: tpl, upd: {StackObjectsCount: value, SpawnedInSession: true}};
if (preset)
{
@ -1094,18 +1035,16 @@ export class RepeatableQuestGenerator
// check for specific baseclasses which don't make sense as reward item
// also check if the price is greater than 0; there are some items whose price can not be found
// those are not in the game yet (e.g. AGS grenade launcher)
return Object.entries(this.databaseServer.getTables().templates.items).filter(
([tpl, itemTemplate]) =>
return Object.entries(this.databaseServer.getTables().templates.items).filter(([tpl, itemTemplate]) =>
{
// Base "Item" item has no parent, ignore it
if (itemTemplate._parent === "")
{
// Base "Item" item has no parent, ignore it
if (itemTemplate._parent === "")
{
return false;
}
return false;
}
return this.isValidRewardItem(tpl, repeatableQuestConfig);
},
);
return this.isValidRewardItem(tpl, repeatableQuestConfig);
});
}
/**
@ -1123,10 +1062,7 @@ export class RepeatableQuestGenerator
}
// Item is on repeatable or global blacklist
if (
repeatableQuestConfig.rewardBlacklist.includes(tpl)
|| this.itemFilterService.isItemBlacklisted(tpl)
)
if (repeatableQuestConfig.rewardBlacklist.includes(tpl) || this.itemFilterService.isItemBlacklisted(tpl))
{
return false;
}
@ -1152,8 +1088,7 @@ export class RepeatableQuestGenerator
// Skip globally blacklisted items + boss items
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <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,14 +927,16 @@ export class InventoryHelper
const tmpSize = this.getSizeByInventoryItemHash(item._tpl, item._id, inventoryItemHash);
const iW = tmpSize[0]; // x
const iH = tmpSize[1]; // y
const fH = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|| (item.location as Location).rotation === "Vertical")
? iW
: iH;
const fW = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|| (item.location as Location).rotation === "Vertical")
? iH
: iW;
const fH =
((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|| (item.location as Location).rotation === "Vertical")
? iW
: iH;
const fW =
((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|| (item.location as Location).rotation === "Vertical")
? iH
: iW;
const fillTo = (item.location as Location).x + fW;
for (let y = 0; y < fH; y++)
@ -1002,9 +989,7 @@ export class InventoryHelper
else if (request.fromOwner.type.toLocaleLowerCase() === "mail")
{
// Split requests dont use 'use' but 'splitItem' property
const item = "splitItem" in request
? request.splitItem
: request.item;
const item = "splitItem" in request ? request.splitItem : request.item;
fromInventoryItems = this.dialogueHelper.getMessageItemContents(request.fromOwner.id, sessionId, item);
fromType = "mail";
}

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

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

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: [
{
// eslint-disable-next-line @typescript-eslint/naming-convention
item_id: buyRequestData.item_id,
count: buyRequestData.count,
},
],
items: [{
// eslint-disable-next-line @typescript-eslint/naming-convention
item_id: buyRequestData.item_id,
count: buyRequestData.count,
}],
tid: buyRequestData.tid,
};

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,41 +6,37 @@ import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
@injectable()
export class BotDynamicRouter extends DynamicRouter
{
constructor(
@inject("BotCallbacks") protected botCallbacks: BotCallbacks,
)
constructor(@inject("BotCallbacks") protected botCallbacks: BotCallbacks)
{
super(
[
new RouteAction(
"/singleplayer/settings/bot/limit/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotLimit(url, info, sessionID);
},
),
new RouteAction(
"/singleplayer/settings/bot/difficulty/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotDifficulty(url, info, sessionID);
},
),
new RouteAction(
"/singleplayer/settings/bot/maxCap",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotCap();
},
),
new RouteAction(
"/singleplayer/settings/bot/getBotBehaviours/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotBehaviours();
},
),
],
);
super([
new RouteAction(
"/singleplayer/settings/bot/limit/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotLimit(url, info, sessionID);
},
),
new RouteAction(
"/singleplayer/settings/bot/difficulty/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotDifficulty(url, info, sessionID);
},
),
new RouteAction(
"/singleplayer/settings/bot/maxCap",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotCap();
},
),
new RouteAction(
"/singleplayer/settings/bot/getBotBehaviours/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.botCallbacks.getBotBehaviours();
},
),
]);
}
}

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 =>
{
return this.bundleCallbacks.getBundle(url, info, sessionID);
},
),
],
);
super([
new RouteAction(".bundle", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.bundleCallbacks.getBundle(url, info, sessionID);
}),
]);
}
}

View File

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

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 =>
{
return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
},
),
new RouteAction(
"/client/locale/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
},
),
new RouteAction(
"/client/items/prices/",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getItemPrices(url, info, sessionID);
},
),
],
);
super([
new RouteAction("/client/menu/locale/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
}),
new RouteAction("/client/locale/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
}),
new RouteAction("/client/items/prices/", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.dataCallbacks.getItemPrices(url, info, sessionID);
}),
]);
}
}

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 =>
{
return this.imageRouter.getImage();
},
),
new RouteAction(
".png",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
new RouteAction(
".ico",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
},
),
],
);
super([
new RouteAction(".jpg", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
}),
new RouteAction(".png", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
}),
new RouteAction(".ico", (url: string, info: any, sessionID: string, output: string): any =>
{
return this.imageRouter.getImage();
}),
]);
}
}

View File

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

View File

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

View File

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

View File

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

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(

Some files were not shown because too many files have changed in this diff Show More