0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:30:45 -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", "trailingCommas": "onlyMultiLine",
"operatorPosition": "nextLine", "operatorPosition": "nextLine",
"preferHanging": false, "preferHanging": false,
"preferSingleLine": false, "preferSingleLine": true,
"arrowFunction.useParentheses": "force", "arrowFunction.useParentheses": "force",
"binaryExpression.linePerExpression": false, "binaryExpression.linePerExpression": false,
"memberExpression.linePerExpression": false, "memberExpression.linePerExpression": false,

View File

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

View File

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

View File

@ -28,10 +28,7 @@ export class CustomizationCallbacks
*/ */
public getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetSuitsResponse> public getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetSuitsResponse>
{ {
const result: IGetSuitsResponse = { const result: IGetSuitsResponse = {_id: `pmc${sessionID}`, suites: this.saveServer.getProfile(sessionID).suits};
_id: `pmc${sessionID}`,
suites: this.saveServer.getProfile(sessionID).suits,
};
return this.httpResponse.getBody(result); return this.httpResponse.getBody(result);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,9 +8,7 @@ import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData";
@injectable() @injectable()
export class NoteCallbacks export class NoteCallbacks
{ {
constructor( constructor(@inject("NoteController") protected noteController: NoteController)
@inject("NoteController") protected noteController: NoteController,
)
{} {}
/** Handle AddNote event */ /** 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 * 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. * be sent to client as NEWLINE separated strings... yup.
*/ */
this.notifierController.notifyAsync(tmpSessionID) this.notifierController.notifyAsync(tmpSessionID).then((messages: any) =>
.then((messages: any) => messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n")) messages.map((message: any) => this.jsonUtil.serialize(message)).join("\n")
.then((text) => this.httpServerHelper.sendTextJson(resp, text)); ).then((text) => this.httpServerHelper.sendTextJson(resp, text));
} }
/** Handle push/notifier/get */ /** Handle push/notifier/get */
@ -68,9 +68,7 @@ export class NotifierCallbacks
sessionID: string, sessionID: string,
): IGetBodyResponseData<ISelectProfileResponse> ): IGetBodyResponseData<ISelectProfileResponse>
{ {
return this.httpResponse.getBody({ return this.httpResponse.getBody({status: "ok"});
status: "ok",
});
} }
public notify(url: string, info: any, sessionID: string): string public notify(url: string, info: any, sessionID: string): string

View File

@ -6,9 +6,7 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
@injectable() @injectable()
export class PresetCallbacks implements OnLoad export class PresetCallbacks implements OnLoad
{ {
constructor( constructor(@inject("PresetController") protected presetController: PresetController)
@inject("PresetController") protected presetController: PresetController,
)
{} {}
public async onLoad(): Promise<void> 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(null, 1, "The nickname is too short");
} }
return this.httpResponse.getBody({ return this.httpResponse.getBody({status: 0, nicknamechangedate: this.timeUtil.getTimestamp()});
status: 0,
nicknamechangedate: this.timeUtil.getTimestamp(),
});
} }
/** /**
@ -141,8 +138,7 @@ export class ProfileCallbacks
{ {
const response: GetProfileStatusResponseData = { const response: GetProfileStatusResponseData = {
maxPveCountExceeded: false, maxPveCountExceeded: false,
profiles: [ profiles: [{
{
profileid: `scav${sessionID}`, profileid: `scav${sessionID}`,
profileToken: null, profileToken: null,
status: "Free", status: "Free",
@ -154,16 +150,7 @@ export class ProfileCallbacks
raidMode: "Online", raidMode: "Online",
mode: "deathmatch", mode: "deathmatch",
shortId: "xxx1x1", shortId: "xxx1x1",
}, }, {profileid: `pmc${sessionID}`, profileToken: null, status: "Free", sid: "", ip: "", port: 0}],
{
profileid: `pmc${sessionID}`,
profileToken: null,
status: "Free",
sid: "",
ip: "",
port: 0,
},
],
}; };
return this.httpResponse.getBody(response); return this.httpResponse.getBody(response);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -448,11 +448,9 @@ export class QuestController
const change = {}; const change = {};
change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id]; change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id];
const responseData: IPmcDataRepeatableQuest = { const responseData: IPmcDataRepeatableQuest = {
id: repeatableSettings.id id: repeatableSettings.id ?? this.questConfig.repeatableQuests.find((x) =>
?? this.questConfig.repeatableQuests.find((x) =>
x.name === repeatableQuestProfile.sptRepatableGroupName x.name === repeatableQuestProfile.sptRepatableGroupName
) ).id,
.id,
name: repeatableSettings.name, name: repeatableSettings.name,
endTime: repeatableSettings.endTime, endTime: repeatableSettings.endTime,
changeRequirement: change, changeRequirement: change,
@ -957,10 +955,6 @@ export class QuestController
return; return;
} }
pmcData.BackendCounters[conditionId] = { pmcData.BackendCounters[conditionId] = {id: conditionId, qid: questId, value: counterValue};
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 min = offers[0].requirementsCost; // Get first item from array as its pre-sorted
const max = offers.at(-1).requirementsCost; // Get last item from array as its pre-sorted const max = offers.at(-1).requirementsCost; // Get last item from array as its pre-sorted
return { return {avg: (min + max) / 2, min: min, max: max};
avg: (min + max) / 2,
min: min,
max: max,
};
} }
// No offers listed, get price from live ragfair price list prices.json // No offers listed, get price from live ragfair price list prices.json
else else
@ -344,11 +340,7 @@ export class RagfairController
tplPrice = this.handbookHelper.getTemplatePrice(getPriceRequest.templateId); tplPrice = this.handbookHelper.getTemplatePrice(getPriceRequest.templateId);
} }
return { return {avg: tplPrice, min: tplPrice, max: tplPrice};
avg: tplPrice,
min: tplPrice,
max: tplPrice,
};
} }
} }
@ -399,9 +391,7 @@ export class RagfairController
const qualityMultiplier = this.itemHelper.getItemQualityModifier(rootItem); const qualityMultiplier = this.itemHelper.getItemQualityModifier(rootItem);
const averageOfferPrice = this.ragfairPriceService.getFleaPriceForItem(rootItem._tpl) const averageOfferPrice = this.ragfairPriceService.getFleaPriceForItem(rootItem._tpl)
* rootItem.upd.StackObjectsCount * qualityMultiplier; * rootItem.upd.StackObjectsCount * qualityMultiplier;
const itemStackCount = (offerRequest.sellInOnePiece) const itemStackCount = (offerRequest.sellInOnePiece) ? 1 : rootItem.upd.StackObjectsCount;
? 1
: rootItem.upd.StackObjectsCount;
// Get averaged price of a single item being listed // Get averaged price of a single item being listed
const averageSingleItemPrice = (offerRequest.sellInOnePiece) const averageSingleItemPrice = (offerRequest.sellInOnePiece)
@ -623,11 +613,7 @@ export class RagfairController
const formattedRequirements: IBarterScheme[] = requirements.map((item) => const formattedRequirements: IBarterScheme[] = requirements.map((item) =>
{ {
return { return {_tpl: item._tpl, count: item.count, onlyFunctional: item.onlyFunctional};
_tpl: item._tpl,
count: item.count,
onlyFunctional: item.onlyFunctional,
};
}); });
return this.ragfairOfferGenerator.createFleaOffer( return this.ragfairOfferGenerator.createFleaOffer(
@ -756,12 +742,7 @@ export class RagfairController
return { return {
tid: "ragfair", tid: "ragfair",
Action: "TradingConfirm", Action: "TradingConfirm",
scheme_items: [ scheme_items: [{id: this.paymentHelper.getCurrency(currency), count: Math.round(value)}],
{
id: this.paymentHelper.getCurrency(currency),
count: Math.round(value),
},
],
type: "", type: "",
item_id: "", item_id: "",
count: 0, count: 0,

View File

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

View File

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

View File

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

View File

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

View File

@ -94,18 +94,12 @@ export class SaveLoadRouter extends Router
export class HandledRoute export class HandledRoute
{ {
constructor( constructor(public route: string, public dynamic: boolean)
public route: string,
public dynamic: boolean,
)
{} {}
} }
export class RouteAction export class RouteAction
{ {
constructor( constructor(public url: string, public action: (url: string, info: any, sessionID: string, output: string) => any)
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 // Ensure submods for nvgs all spawn together
forceSpawn = (modSlot === "mod_nvg") forceSpawn = (modSlot === "mod_nvg") ? true : false;
? true
: false;
let modTpl: string; let modTpl: string;
let found = false; let found = false;
@ -290,13 +288,7 @@ export class BotEquipmentModGenerator
if (this.modSlotCanHoldScope(modSlot, modToAddTemplate._parent)) if (this.modSlotCanHoldScope(modSlot, modToAddTemplate._parent))
{ {
// mod_mount was picked to be added to weapon, force scope chance to ensure its filled // mod_mount was picked to be added to weapon, force scope chance to ensure its filled
const scopeSlots = [ const scopeSlots = ["mod_scope", "mod_scope_000", "mod_scope_001", "mod_scope_002", "mod_scope_003"];
"mod_scope",
"mod_scope_000",
"mod_scope_001",
"mod_scope_002",
"mod_scope_003",
];
this.adjustSlotSpawnChances(modSpawnChances, scopeSlots, 100); this.adjustSlotSpawnChances(modSpawnChances, scopeSlots, 100);
// Hydrate pool of mods that fit into mount as its a randomisable slot // 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 picked item is muzzle adapter that can hold a child, adjust spawn chance
if (this.modSlotCanHoldMuzzleDevices(modSlot, modToAddTemplate._parent)) if (this.modSlotCanHoldMuzzleDevices(modSlot, modToAddTemplate._parent))
{ {
const muzzleSlots = [ const muzzleSlots = ["mod_muzzle", "mod_muzzle_000", "mod_muzzle_001"];
"mod_muzzle",
"mod_muzzle_000",
"mod_muzzle_001",
];
// Make chance of muzzle devices 95%, nearly certain but not guaranteed // Make chance of muzzle devices 95%, nearly certain but not guaranteed
this.adjustSlotSpawnChances(modSpawnChances, muzzleSlots, 95); 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 // 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 // Or if mod_stock is configured to be forced on
if ( if (
modSlot === "mod_stock" modSlot === "mod_stock" && (modToAddTemplate._props.Slots.find((x) =>
&& (modToAddTemplate._props.Slots.find((x) =>
x._name.includes("mod_stock") || botEquipConfig.forceStock x._name.includes("mod_stock") || botEquipConfig.forceStock
)) ))
) )
@ -435,8 +422,7 @@ export class BotEquipmentModGenerator
"mod_scope_001", "mod_scope_001",
"mod_scope_002", "mod_scope_002",
"mod_scope_003", "mod_scope_003",
].includes(modSlot.toLowerCase()) ].includes(modSlot.toLowerCase()) && modsParentId === BaseClasses.MOUNT;
&& modsParentId === BaseClasses.MOUNT;
} }
/** /**
@ -1025,12 +1011,7 @@ export class BotEquipmentModGenerator
{ {
const modSlotId = slot._name; const modSlotId = slot._name;
const modId = this.hashUtil.generate(); const modId = this.hashUtil.generate();
items.push({ items.push({_id: modId, _tpl: modTpl, parentId: parentId, slotId: modSlotId});
_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 * @param botGenerationDetails details on how to generate bots
* @returns array of bots * @returns array of bots
*/ */
public prepareAndGenerateBots( public prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]
sessionId: string,
botGenerationDetails: BotGenerationDetails,
): IBotBase[]
{ {
const output: IBotBase[] = []; const output: IBotBase[] = [];
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++) for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
@ -114,11 +111,9 @@ export class BotGenerator
bot.Info.Settings.BotDifficulty = botGenerationDetails.botDifficulty; bot.Info.Settings.BotDifficulty = botGenerationDetails.botDifficulty;
// Get raw json data for bot (Cloned) // Get raw json data for bot (Cloned)
const botJsonTemplate = this.jsonUtil.clone(this.botHelper.getBotTemplate( const botJsonTemplate = this.jsonUtil.clone(
(botGenerationDetails.isPmc) this.botHelper.getBotTemplate((botGenerationDetails.isPmc) ? bot.Info.Side : botGenerationDetails.role),
? bot.Info.Side );
: botGenerationDetails.role,
));
bot = this.generateBot(sessionId, bot, botJsonTemplate, botGenerationDetails); bot = this.generateBot(sessionId, bot, botJsonTemplate, botGenerationDetails);
@ -328,9 +323,7 @@ export class BotGenerator
*/ */
protected generateHealth(healthObj: Health, playerScav = false): PmcHealth protected generateHealth(healthObj: Health, playerScav = false): PmcHealth
{ {
const bodyParts = playerScav const bodyParts = playerScav ? healthObj.BodyParts[0] : this.randomUtil.getArrayValue(healthObj.BodyParts);
? healthObj.BodyParts[0]
: this.randomUtil.getArrayValue(healthObj.BodyParts);
const newHealth: PmcHealth = { const newHealth: PmcHealth = {
Hydration: { Hydration: {
@ -437,10 +430,7 @@ export class BotGenerator
} }
// All skills have id and progress props // All skills have id and progress props
const skillToAdd: IBaseSkill = { const skillToAdd: IBaseSkill = {Id: skillKey, Progress: this.randomUtil.getInt(skill.min, skill.max)};
Id: skillKey,
Progress: this.randomUtil.getInt(skill.min, skill.max),
};
// Common skills have additional props // Common skills have additional props
if (isCommonSkills) if (isCommonSkills)

View File

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

View File

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

View File

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

View File

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

View File

@ -247,8 +247,7 @@ export class LocationGenerator
*/ */
protected getRandomisableContainersOnMap(staticContainers: IStaticContainerData[]): IStaticContainerData[] protected getRandomisableContainersOnMap(staticContainers: IStaticContainerData[]): IStaticContainerData[]
{ {
return staticContainers return staticContainers.filter((x) =>
.filter((x) =>
x.probability !== 1 && !x.template.IsAlwaysSpawn x.probability !== 1 && !x.template.IsAlwaysSpawn
&& !this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes( && !this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes(
x.template.Items[0]._tpl, x.template.Items[0]._tpl,
@ -530,9 +529,7 @@ export class LocationGenerator
continue; continue;
} }
itemDistribution.push( itemDistribution.push(new ProbabilityObject(icd.tpl, icd.relativeProbability));
new ProbabilityObject(icd.tpl, icd.relativeProbability),
);
} }
return itemDistribution; return itemDistribution;
@ -571,10 +568,7 @@ export class LocationGenerator
// Draw from random distribution // Draw from random distribution
const desiredSpawnpointCount = Math.round( const desiredSpawnpointCount = Math.round(
this.getLooseLootMultiplerForLocation(locationName) this.getLooseLootMultiplerForLocation(locationName)
* this.randomUtil.randn( * this.randomUtil.randn(dynamicLootDist.spawnpointCount.mean, dynamicLootDist.spawnpointCount.std),
dynamicLootDist.spawnpointCount.mean,
dynamicLootDist.spawnpointCount.std,
),
); );
// Positions not in forced but have 100% chance to spawn // Positions not in forced but have 100% chance to spawn
@ -598,9 +592,7 @@ export class LocationGenerator
continue; continue;
} }
spawnpointArray.push( spawnpointArray.push(new ProbabilityObject(spawnpoint.template.Id, spawnpoint.probability, spawnpoint));
new ProbabilityObject(spawnpoint.template.Id, spawnpoint.probability, spawnpoint),
);
} }
// Select a number of spawn points to add loot to // Select a number of spawn points to add loot to
@ -665,9 +657,7 @@ export class LocationGenerator
continue; continue;
} }
itemArray.push( itemArray.push(new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability));
new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability),
);
} }
// Draw a random item from spawn points possible items // Draw a random item from spawn points possible items
@ -720,9 +710,7 @@ export class LocationGenerator
for (const si of items) for (const si of items)
{ {
// use locationId as template.Id is the same across all items // use locationId as template.Id is the same across all items
spawnpointArray.push( spawnpointArray.push(new ProbabilityObject(si.locationId, si.probability, si));
new ProbabilityObject(si.locationId, si.probability, si),
);
} }
// Choose 1 out of all found spawn positions for spawn id and add to loot array // Choose 1 out of all found spawn positions for spawn id and add to loot array
@ -792,22 +780,13 @@ export class LocationGenerator
? 1 ? 1
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom); : this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
itemWithMods.push( itemWithMods.push({_id: this.objectId.generate(), _tpl: chosenTpl, upd: {StackObjectsCount: stackCount}});
{
_id: this.objectId.generate(),
_tpl: chosenTpl,
upd: {StackObjectsCount: stackCount},
},
);
} }
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX)) else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX))
{ {
// Fill with cartrdiges // Fill with cartrdiges
const ammoBoxTemplate = this.itemHelper.getItem(chosenTpl)[1]; const ammoBoxTemplate = this.itemHelper.getItem(chosenTpl)[1];
const ammoBoxItem: Item[] = [{ const ammoBoxItem: Item[] = [{_id: this.objectId.generate(), _tpl: chosenTpl}];
_id: this.objectId.generate(),
_tpl: chosenTpl,
}];
this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, ammoBoxTemplate); this.itemHelper.addCartridgesToAmmoBox(ammoBoxItem, ammoBoxTemplate);
itemWithMods.push(...ammoBoxItem); itemWithMods.push(...ammoBoxItem);
} }
@ -815,10 +794,7 @@ export class LocationGenerator
{ {
// Create array with just magazine + randomised amount of cartridges // Create array with just magazine + randomised amount of cartridges
const magazineTemplate = this.itemHelper.getItem(chosenTpl)[1]; const magazineTemplate = this.itemHelper.getItem(chosenTpl)[1];
const magazineItem: Item[] = [{ const magazineItem: Item[] = [{_id: this.objectId.generate(), _tpl: chosenTpl}];
_id: this.objectId.generate(),
_tpl: chosenTpl,
}];
this.itemHelper.fillMagazineWithRandomCartridge( this.itemHelper.fillMagazineWithRandomCartridge(
magazineItem, magazineItem,
magazineTemplate, magazineTemplate,
@ -845,11 +821,7 @@ export class LocationGenerator
// Get inventory size of item // Get inventory size of item
const size = this.itemHelper.getItemSize(itemWithMods, itemWithMods[0]._id); const size = this.itemHelper.getItemSize(itemWithMods, itemWithMods[0]._id);
return { return {items: itemWithMods, width: size.width, height: size.height};
items: itemWithMods,
width: size.width,
height: size.height,
};
} }
/** /**
@ -901,12 +873,7 @@ export class LocationGenerator
const itemTemplate = this.itemHelper.getItem(tpl)[1]; const itemTemplate = this.itemHelper.getItem(tpl)[1];
let width = itemTemplate._props.Width; let width = itemTemplate._props.Width;
let height = itemTemplate._props.Height; let height = itemTemplate._props.Height;
let items: Item[] = [ let items: Item[] = [{_id: this.objectId.generate(), _tpl: tpl}];
{
_id: this.objectId.generate(),
_tpl: tpl,
},
];
// Use passed in parentId as override for new item // Use passed in parentId as override for new item
if (parentId) if (parentId)
@ -1037,10 +1004,6 @@ export class LocationGenerator
items.splice(items.indexOf(items[0]), 1, ...magazineWithCartridges); items.splice(items.indexOf(items[0]), 1, ...magazineWithCartridges);
} }
return { return {items: items, width: width, height: height};
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 { HashUtil } from "@spt-aki/utils/HashUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil";
type ItemLimit = { type ItemLimit = {current: number; max: number;};
current: number;
max: number;
};
@injectable() @injectable()
export class LootGenerator export class LootGenerator
@ -134,10 +131,7 @@ export class LootGenerator
const itemTypeCounts: Record<string, ItemLimit> = {}; const itemTypeCounts: Record<string, ItemLimit> = {};
for (const itemTypeId in limits) for (const itemTypeId in limits)
{ {
itemTypeCounts[itemTypeId] = { itemTypeCounts[itemTypeId] = {current: 0, max: limits[itemTypeId]};
current: 0,
max: limits[itemTypeId],
};
} }
return itemTypeCounts; return itemTypeCounts;
@ -174,10 +168,7 @@ export class LootGenerator
}; };
// Check if armor has level in allowed whitelist // Check if armor has level in allowed whitelist
if ( if (randomItem._parent === BaseClasses.ARMOR || randomItem._parent === BaseClasses.VEST)
randomItem._parent === BaseClasses.ARMOR
|| randomItem._parent === BaseClasses.VEST
)
{ {
if (!options.armorLevelWhitelist.includes(Number(randomItem._props.armorClass))) if (!options.armorLevelWhitelist.includes(Number(randomItem._props.armorClass)))
{ {
@ -277,11 +268,7 @@ export class LootGenerator
return false; return false;
} }
const newLootItem: LootItem = { const newLootItem: LootItem = {tpl: randomPreset._items[0]._tpl, isPreset: true, stackCount: 1};
tpl: randomPreset._items[0]._tpl,
isPreset: true,
stackCount: 1,
};
result.push(newLootItem); result.push(newLootItem);
@ -405,8 +392,7 @@ export class LootGenerator
} }
// Get all items of the desired type + not quest items + not globally blacklisted // Get all items of the desired type + not quest items + not globally blacklisted
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items) const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items).filter((x) =>
.filter((x) =>
x._parent === rewardTypeId x._parent === rewardTypeId
&& x._type.toLowerCase() === "item" && x._type.toLowerCase() === "item"
&& !this.itemFilterService.isItemBlacklisted(x._id) && !this.itemFilterService.isItemBlacklisted(x._id)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,12 +38,8 @@ export class BotDifficultyHelper
{ {
const difficultySettings = this.getDifficultySettings(pmcType, difficulty); const difficultySettings = this.getDifficultySettings(pmcType, difficulty);
const friendlyType = pmcType === "bear" const friendlyType = pmcType === "bear" ? bearType : usecType;
? bearType const enemyType = pmcType === "bear" ? usecType : 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, this.pmcConfig.enemyTypes, friendlyType); // Add generic bot types to enemy list
this.botHelper.addBotToEnemyList(difficultySettings, [enemyType, friendlyType], ""); // add same/opposite side 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))}; itemProperties.Togglable = {On: (this.randomUtil.getChance100(faceShieldActiveChance))};
} }
return Object.keys(itemProperties).length return Object.keys(itemProperties).length ? {upd: itemProperties} : {};
? {upd: itemProperties}
: {};
} }
/** /**
@ -240,10 +238,7 @@ export class BotGeneratorHelper
maxDurability, maxDurability,
); );
return { return {Durability: currentDurability, MaxDurability: maxDurability};
Durability: currentDurability,
MaxDurability: maxDurability,
};
} }
/** /**
@ -271,10 +266,7 @@ export class BotGeneratorHelper
); );
} }
return { return {Durability: currentDurability, MaxDurability: maxDurability};
Durability: currentDurability,
MaxDurability: maxDurability,
};
} }
/** /**
@ -381,11 +373,7 @@ export class ExhaustableArray<T>
{ {
private pool: T[]; private pool: T[];
constructor( constructor(private itemPool: T[], private randomUtil: RandomUtil, private jsonUtil: JsonUtil)
private itemPool: T[],
private randomUtil: RandomUtil,
private jsonUtil: JsonUtil,
)
{ {
this.pool = this.jsonUtil.clone(itemPool); this.pool = this.jsonUtil.clone(itemPool);
} }

View File

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

View File

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

View File

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

View File

@ -177,9 +177,7 @@ export class DurabilityLimitsHelper
); );
// Dont let weapon dura go below the percent defined in config // Dont let weapon dura go below the percent defined in config
return (result >= durabilityValueMinLimit) return (result >= durabilityValueMinLimit) ? result : durabilityValueMinLimit;
? result
: durabilityValueMinLimit;
} }
protected generateArmorDurability(botRole: string, maxDurability: number): number 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 // Dont let armor dura go below the percent defined in config
return (result >= durabilityValueMinLimit) return (result >= durabilityValueMinLimit) ? result : durabilityValueMinLimit;
? result
: durabilityValueMinLimit;
} }
protected getMinWeaponDeltaFromConfig(botRole: string): number 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.set(handbookItem.ParentId, []);
} }
this.handbookPriceCache.items.byParent this.handbookPriceCache.items.byParent.get(handbookItem.ParentId).push(handbookItem.Id);
.get(handbookItem.ParentId)
.push(handbookItem.Id);
} }
for (const handbookCategory of handbookDb.Categories) for (const handbookCategory of handbookDb.Categories)
@ -63,9 +61,7 @@ export class HandbookHelper
{ {
this.handbookPriceCache.categories.byParent.set(handbookCategory.ParentId, []); this.handbookPriceCache.categories.byParent.set(handbookCategory.ParentId, []);
} }
this.handbookPriceCache.categories.byParent this.handbookPriceCache.categories.byParent.get(handbookCategory.ParentId).push(handbookCategory.Id);
.get(handbookCategory.ParentId)
.push(handbookCategory.Id);
} }
} }
} }

View File

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

View File

@ -651,13 +651,7 @@ export class HideoutHelper
*/ */
protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd
{ {
return { return {StackObjectsCount: stackCount, Resource: {Value: resourceValue, UnitsConsumed: resourceUnitsConsumed}};
StackObjectsCount: stackCount,
Resource: {
Value: resourceValue,
UnitsConsumed: resourceUnitsConsumed,
},
};
} }
protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void
@ -705,10 +699,7 @@ export class HideoutHelper
{ {
airFilterArea.slots[i].item[0].upd = { airFilterArea.slots[i].item[0].upd = {
StackObjectsCount: 1, StackObjectsCount: 1,
Resource: { Resource: {Value: resourceValue, UnitsConsumed: pointsConsumed},
Value: resourceValue,
UnitsConsumed: pointsConsumed,
},
}; };
this.logger.debug(`Air filter: ${resourceValue} filter left on slot ${i + 1}`); this.logger.debug(`Air filter: ${resourceValue} filter left on slot ${i + 1}`);
break; // Break here to avoid updating all filters break; // Break here to avoid updating all filters
@ -815,9 +806,7 @@ export class HideoutHelper
btcProd.Products.push({ btcProd.Products.push({
_id: this.hashUtil.generate(), _id: this.hashUtil.generate(),
_tpl: "59faff1d86f7746c51718c9c", _tpl: "59faff1d86f7746c51718c9c",
upd: { upd: {StackObjectsCount: 1},
StackObjectsCount: 1,
},
}); });
btcProd.Progress -= coinCraftTimeSeconds; 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 // 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 // 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); let roundedLevel = Math.floor(hideoutManagementSkill.Progress / 100);
roundedLevel = (roundedLevel === 51) roundedLevel = (roundedLevel === 51) ? roundedLevel - 1 : roundedLevel;
? roundedLevel - 1
: roundedLevel;
return (roundedLevel return (roundedLevel
* this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement * this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement
@ -1023,9 +1010,7 @@ export class HideoutHelper
*/ */
protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean
{ {
return improvement?.completed return improvement?.completed ? true : false;
? true
: false;
} }
/** /**

View File

@ -21,9 +21,7 @@ export class HttpServerHelper
txt: "text/plain", txt: "text/plain",
}; };
constructor( constructor(@inject("ConfigServer") protected configServer: ConfigServer)
@inject("ConfigServer") protected configServer: ConfigServer,
)
{ {
this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP); 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 // Add these new found items to our list of inventory items
inventoryItems = [ inventoryItems = [...inventoryItems, ...foundItems];
...inventoryItems,
...foundItems,
];
// Now find the children of these items // Now find the children of these items
newItems = foundItems; newItems = foundItems;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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