fixed lint/complexity/useLiteralKeys

This commit is contained in:
TheSparta 2023-10-31 22:52:09 +00:00
parent 3eee163aae
commit 5b46e956c4
26 changed files with 166 additions and 161 deletions

View File

@ -65,13 +65,13 @@ export class DialogueCallbacks implements OnUpdate
DateTime: this.timeUtil.getTimestamp(),
IsDeveloper: true,
Regions: ["EUR"],
"VersionId": "bgkidft87ddd",
"Ip": "",
"Port": 0,
"Chats": [
VersionId: "bgkidft87ddd",
Ip: "",
Port: 0,
Chats: [
{
"_id": "0",
"Members": 0
_id: "0",
Members: 0
}
]
};

View File

@ -109,7 +109,7 @@ export class ProfileCallbacks
return this.httpResponse.getBody(null, 256, "256 - ");
}
return this.httpResponse.getBody({ "status": "ok" });
return this.httpResponse.getBody({ status: "ok" });
}
/**
@ -131,12 +131,12 @@ export class ProfileCallbacks
maxPveCountExceeded: false,
profiles: [
{
"profileid": `scav${sessionID}`,
profileid: `scav${sessionID}`,
profileToken: null,
"status": "Free",
"sid": "",
"ip": "",
"port": 0,
status: "Free",
sid: "",
ip: "",
port: 0,
version: "live",
location: "bigmap",
raidMode: "Online",
@ -145,12 +145,12 @@ export class ProfileCallbacks
},
{
"profileid": `pmc${sessionID}`,
profileid: `pmc${sessionID}`,
profileToken: null,
"status": "Free",
"sid": "",
"ip": "",
"port": 0
status: "Free",
sid: "",
ip: "",
port: 0
}
]
};

View File

@ -62,9 +62,9 @@ export class DialogueController
{
// Force a fake friend called SPT into friend list
return {
"Friends": [this.getSptFriendData()],
"Ignore": [],
"InIgnoreList": []
Friends: [this.getSptFriendData()],
Ignore: [],
InIgnoreList: []
};
}

View File

@ -652,7 +652,10 @@ export class HideoutController
let counterHoursCrafting = pmcData.BackendCounters[HideoutController.nameBackendCountersCrafting];
if (!counterHoursCrafting)
{
pmcData.BackendCounters[HideoutController.nameBackendCountersCrafting] = { "id": HideoutController.nameBackendCountersCrafting, "value": 0 };
pmcData.BackendCounters[HideoutController.nameBackendCountersCrafting] = {
id: HideoutController.nameBackendCountersCrafting,
value: 0
};
counterHoursCrafting = pmcData.BackendCounters[HideoutController.nameBackendCountersCrafting];
}
let hoursCrafting = counterHoursCrafting.value;
@ -856,10 +859,10 @@ export class HideoutController
public handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse
{
// {
// "Action": "HideoutQuickTimeEvent",
// "results": [true, false, true, true, true, true, true, true, true, false, false, false, false, false, false],
// "id": "63b16feb5d012c402c01f6ef",
// "timestamp": 1672585349
// Action: "HideoutQuickTimeEvent",
// results: [true, false, true, true, true, true, true, true, true, false, false, false, false, false, false],
// id: "63b16feb5d012c402c01f6ef",
// timestamp: 1672585349
// }
// Skill changes are done in

View File

@ -434,7 +434,7 @@ export class InventoryController
{
if (item._id && item._id === body.item)
{
item.upd.Foldable = { "Folded": body.value };
item.upd.Foldable = { Folded: body.value };
return this.eventOutputHolder.getOutput(sessionID);
}
}

View File

@ -53,7 +53,7 @@ export class LauncherController
protected getProfileDescriptions(): Record<string, string>
{
return {
"Standard": this.localisationService.getText("launcher-profile_standard"),
Standard: this.localisationService.getText("launcher-profile_standard"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"Left Behind": this.localisationService.getText("launcher-profile_leftbehind"),
// eslint-disable-next-line @typescript-eslint/naming-convention

View File

@ -109,17 +109,17 @@ export class MatchController
// get list of players joining into the match
output.profiles.push({
"profileid": "TODO",
profileid: "TODO",
profileToken: "TODO",
"status": "MatchWait",
"sid": "",
"ip": "",
"port": 0,
"version": "live",
"location": "TODO get location",
status: "MatchWait",
sid: "",
ip: "",
port: 0,
version: "live",
location: "TODO get location",
raidMode: "Online",
"mode": "deathmatch",
"shortid": null,
mode: "deathmatch",
shortid: null,
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info: null
});

View File

@ -740,7 +740,7 @@ export class QuestController
let index = pmcData.Inventory.items.length;
// Important: don't tell the client to remove the attachments, it will handle it
output.profileChanges[sessionID].items.del.push({ "_id": itemHandover.id });
output.profileChanges[sessionID].items.del.push({ _id: itemHandover.id });
// Important: loop backward when removing items from the array we're looping on
while (index-- > 0)
@ -805,8 +805,9 @@ export class QuestController
}
pmcData.BackendCounters[conditionId] = {
"id": conditionId,
"qid": questId,
"value": counterValue };
id: conditionId,
qid: questId,
value: counterValue
};
}
}

View File

@ -613,10 +613,10 @@ export class BotEquipmentModGenerator
protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item
{
return {
"_id": modId,
"_tpl": modTpl,
"parentId": parentId,
"slotId": modSlot,
_id: modId,
_tpl: modTpl,
parentId: parentId,
slotId: modSlot,
...this.botGeneratorHelper.generateExtraPropertiesForItem(modTemplate, botRole)
};
}

View File

@ -98,24 +98,24 @@ export class BotInventoryGenerator
return {
items: [
{
"_id": equipmentId,
"_tpl": equipmentTpl
_id: equipmentId,
_tpl: equipmentTpl
},
{
"_id": stashId,
"_tpl": stashTpl
_id: stashId,
_tpl: stashTpl
},
{
"_id": questRaidItemsId,
"_tpl": questRaidItemsTpl
_id: questRaidItemsId,
_tpl: questRaidItemsTpl
},
{
"_id": questStashItemsId,
"_tpl": questStashItemsTpl
_id: questStashItemsId,
_tpl: questStashItemsTpl
},
{
"_id": sortingTableId,
"_tpl": sortingTableTpl
_id: sortingTableId,
_tpl: sortingTableTpl
}
],
equipment: equipmentId,
@ -223,10 +223,10 @@ export class BotInventoryGenerator
}
const item = {
"_id": id,
"_tpl": equipmentItemTpl,
"parentId": inventory.equipment,
"slotId": equipmentSlot,
_id: id,
_tpl: equipmentItemTpl,
parentId: inventory.equipment,
slotId: equipmentSlot,
...this.botGeneratorHelper.generateExtraPropertiesForItem(itemTemplate[1], botRole)
};

View File

@ -261,8 +261,8 @@ export class BotWeaponGenerator
const parentItem = preset._items[0];
preset._items[0] = {
...parentItem, ...{
"parentId": weaponParentId,
"slotId": equipmentSlot,
parentId: weaponParentId,
slotId: equipmentSlot,
...this.botGeneratorHelper.generateExtraPropertiesForItem(itemTemplate, botRole)
}
};

View File

@ -372,7 +372,7 @@ export class LocationGenerator
const rotation = result.rotation ? 1 : 0;
items[0].slotId = "main";
items[0].location = { "x": result.x, "y": result.y, "r": rotation };
items[0].location = { x: result.x, y: result.y, r: rotation };
// Add loot to container before returning
for (const item of items)

View File

@ -635,36 +635,36 @@ export class RagfairOfferGenerator
if (isRepairable && props.Durability > 0)
{
item.upd.Repairable = {
"Durability": props.Durability,
"MaxDurability": props.Durability
Durability: props.Durability,
MaxDurability: props.Durability
};
}
if (isMedkit && props.MaxHpResource > 0)
{
item.upd.MedKit = {
"HpResource": props.MaxHpResource
HpResource: props.MaxHpResource
};
}
if (isKey)
{
item.upd.Key = {
"NumberOfUsages": 0
NumberOfUsages: 0
};
}
if (isConsumable)
{
item.upd.FoodDrink = {
"HpPercent": props.MaxResource
HpPercent: props.MaxResource
};
}
if (isRepairKit)
{
item.upd.RepairKit = {
"Resource": props.MaxRepairResource
Resource: props.MaxRepairResource
};
}

View File

@ -142,10 +142,10 @@ export class RepeatableQuestGenerator
// a random combination of listed conditions can be required
// possible conditions elements and their relative probability can be defined in QuestConfig.js
// We use ProbabilityObjectArray to draw by relative probability. e.g. for targets:
// "targets": {
// "Savage": 7,
// "AnyPmc": 2,
// "bossBully": 0.5
// targets: {
// Savage: 7,
// AnyPmc: 2,
// bossBully: 0.5
//}
// higher is more likely. We define the difficulty to be the inverse of the relative probability.
@ -467,7 +467,7 @@ export class RepeatableQuestGenerator
itemSelection = itemSelection.filter(x => this.itemHelper.getItemPrice(x[0]) < roublesBudget);
// We also have the option to use whitelist and/or blacklist which is defined in repeatableQuests.json as
// [{"minPlayerLevel": 1, "itemIds": ["id1",...]}, {"minPlayerLevel": 15, "itemIds": ["id3",...]}]
// [{minPlayerLevel: 1, itemIds: ["id1",...]}, {minPlayerLevel: 15, itemIds: ["id3",...]}]
if (repeatableConfig.questConfig.Completion.useWhitelist)
{
const itemWhitelist = this.databaseServer.getTables().templates.repeatableQuests.data.Completion.itemsWhitelist;

View File

@ -118,7 +118,7 @@ export class BotWeaponGeneratorHelper
const ammoItems = this.itemHelper.splitStack({
_id: this.hashUtil.generate(),
_tpl: ammoTpl,
upd: { "StackObjectsCount": cartridgeCount }
upd: { StackObjectsCount: cartridgeCount }
});
for (const ammoItem of ammoItems)

View File

@ -753,7 +753,7 @@ export class HideoutHelper
_id: this.hashUtil.generate(),
_tpl: "59faff1d86f7746c51718c9c",
upd: {
"StackObjectsCount": 1
StackObjectsCount: 1
}
});

View File

@ -10,15 +10,15 @@ export class HttpServerHelper
protected httpConfig: IHttpConfig;
protected mime = {
"css": "text/css",
"bin": "application/octet-stream",
"html": "text/html",
"jpg": "image/jpeg",
"js": "text/javascript",
"json": "application/json",
"png": "image/png",
"svg": "image/svg+xml",
"txt": "text/plain"
css: "text/css",
bin: "application/octet-stream",
html: "text/html",
jpg: "image/jpeg",
js: "text/javascript",
json: "application/json",
png: "image/png",
svg: "image/svg+xml",
txt: "text/plain"
};
constructor(

View File

@ -788,13 +788,12 @@ export class InventoryHelper
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash
{
const inventoryItemHash: InventoryHelper.InventoryItemHash = {
"byItemId": {},
"byParentId": {}
byItemId: {},
byParentId: {}
};
for (let i = 0; i < inventoryItem.length; i++)
for (const item of inventoryItem)
{
const item = inventoryItem[i];
inventoryItemHash.byItemId[item._id] = item;
if (!("parentId" in item))

View File

@ -192,27 +192,27 @@ class ItemHelper
* AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content.
* Here's what a filled AmmoBox looks like:
* {
* "_id": "b1bbe982daa00ac841d4ae4d",
* "_tpl": "57372c89245977685d4159b1",
* "parentId": "5fe49a0e2694b0755a504876",
* "slotId": "hideout",
* "location": {
* "x": 3,
* "y": 4,
* "r": 0
* _id: "b1bbe982daa00ac841d4ae4d",
* _tpl: "57372c89245977685d4159b1",
* parentId: "5fe49a0e2694b0755a504876",
* slotId: "hideout",
* location: {
* x: 3,
* y: 4,
* r: 0
* },
* "upd": {
* "StackObjectsCount": 1
* upd: {
* StackObjectsCount: 1
* }
* },
* {
* "_id": "b997b4117199033afd274a06",
* "_tpl": "56dff061d2720bb5668b4567",
* "parentId": "b1bbe982daa00ac841d4ae4d",
* "slotId": "cartridges",
* "location": 0,
* "upd": {
* "StackObjectsCount": 30
* _id: "b997b4117199033afd274a06",
* _tpl: "56dff061d2720bb5668b4567",
* parentId: "b1bbe982daa00ac841d4ae4d",
* slotId: "cartridges",
* location: 0,
* upd: {
* StackObjectsCount: 30
* }
* }
* Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it.

View File

@ -211,7 +211,7 @@ export class ProfileHelper
public getDefaultAkiDataObject(): any
{
return {
"version": this.getServerVersion()
version: this.getServerVersion()
};
}

View File

@ -532,7 +532,7 @@ export class QuestHelper
{
// this case is probably dead Code right now, since the only calling function
// checks explicitly for Value > 0.
output.profileChanges[sessionID].items.del.push({ "_id": itemId });
output.profileChanges[sessionID].items.del.push({ _id: itemId });
pmcData.Inventory.items.splice(inventoryItemIndex, 1);
}
}
@ -546,12 +546,14 @@ export class QuestHelper
protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void
{
output.profileChanges[sessionId].items.change.push({
"_id": item._id,
"_tpl": item._tpl,
"parentId": item.parentId,
"slotId": item.slotId,
"location": item.location,
"upd": { "StackObjectsCount": item.upd.StackObjectsCount }
_id: item._id,
_tpl: item._tpl,
parentId: item.parentId,
slotId: item.slotId,
location: item.location,
upd: {
StackObjectsCount: item.upd.StackObjectsCount
}
});
}

View File

@ -13,32 +13,32 @@ export interface IGetRaidConfigurationRequestData
}
// {
// "keyId": "",
// "side": "Pmc",
// "location": "factory4_day",
// "timeVariant": "CURR", or "PAST"
// "raidMode": "Local",
// "metabolismDisabled": false,
// "playersSpawnPlace": "SamePlace",
// "timeAndWeatherSettings": {
// "isRandomTime": false,
// "isRandomWeather": false,
// "cloudinessType": "Clear",
// "rainType": "NoRain",
// "windType": "Light",
// "fogType": "NoFog",
// "timeFlowType": "x1",
// "hourOfDay": -1
// keyId: "",
// side: "Pmc",
// location: "factory4_day",
// timeVariant: "CURR", or "PAST"
// raidMode: "Local",
// metabolismDisabled: false,
// playersSpawnPlace: "SamePlace",
// timeAndWeatherSettings: {
// isRandomTime: false,
// isRandomWeather: false,
// cloudinessType: "Clear",
// rainType: "NoRain",
// windType: "Light",
// fogType: "NoFog",
// timeFlowType: "x1",
// hourOfDay: -1
// },
// "botSettings": {
// "isScavWars": false,
// "botAmount": "AsOnline"
// botSettings: {
// isScavWars: false,
// botAmount: "AsOnline"
// },
// "wavesSettings": {
// "botAmount": "AsOnline",
// "botDifficulty": "AsOnline",
// "isBosses": true,
// "isTaggedAndCursed": false
// wavesSettings: {
// botAmount: "AsOnline",
// botDifficulty: "AsOnline",
// isBosses: true,
// isTaggedAndCursed: false
// }
// }

View File

@ -40,7 +40,7 @@ export class WebSocketServer
public setupWebSocket(httpServer: http.Server): void
{
const webSocketServer = new WebSocket.Server({
"server": httpServer
server: httpServer
});
webSocketServer.addListener("listening", () =>

View File

@ -18,25 +18,25 @@ export class MatchLocationService
const groupID = "test";
this.locations[info.location].groups[groupID] = {
"_id": groupID,
"owner": `pmc${sessionID}`,
"location": info.location,
"gameVersion": "live",
"region": "EUR",
"status": "wait",
"isSavage": false,
"timeShift": "CURR",
"dt": this.timeUtil.getTimestamp(),
"players": [
_id: groupID,
owner: `pmc${sessionID}`,
location: info.location,
gameVersion: "live",
region: "EUR",
status: "wait",
isSavage: false,
timeShift: "CURR",
dt: this.timeUtil.getTimestamp(),
players: [
{
"_id": `pmc${sessionID}`,
"region": "EUR",
"ip": "127.0.0.1",
"savageId": `scav${sessionID}`,
"accessKeyId": ""
_id: `pmc${sessionID}`,
region: "EUR",
ip: "127.0.0.1",
savageId: `scav${sessionID}`,
accessKeyId: ""
}
],
"customDataCenter": []
customDataCenter: []
};
return this.locations[info.location].groups[groupID];

View File

@ -365,16 +365,16 @@ export class RandomUtil
if (max < min)
{
throw {
"name": "Invalid arguments",
"message": `Bounded random number generation max is smaller than min (${max} < ${min})`
name: "Invalid arguments",
message: `Bounded random number generation max is smaller than min (${max} < ${min})`
};
}
if (n < 1)
{
throw {
"name": "Invalid argument",
"message": `'n' must be 1 or greater (received ${n})`
name: "Invalid argument",
message: `'n' must be 1 or greater (received ${n})`
};
}

View File

@ -82,14 +82,14 @@ export class VFS
public createDir(filepath: string): void
{
fs.mkdirSync(filepath.substr(0, filepath.lastIndexOf("/")), { "recursive": true });
fs.mkdirSync(filepath.substr(0, filepath.lastIndexOf("/")), { recursive: true });
}
public async createDirAsync(filepath: string): Promise<void>
{
const command = {
uuid: crypto.randomUUID(),
cmd: async () => await this.mkdirPromisify(filepath.substr(0, filepath.lastIndexOf("/")), { "recursive": true })
cmd: async () => await this.mkdirPromisify(filepath.substr(0, filepath.lastIndexOf("/")), { recursive: true })
};
await this.asyncQueue.waitFor(command);
}
@ -167,7 +167,7 @@ export class VFS
public writeFile(filepath: any, data = "", append = false, atomic = true): void
{
const options = (append) ? { "flag": "a" } : { "flag": "w" };
const options = append ? { flag: "a" } : { flag: "w" };
if (!this.exists(filepath))
{
@ -194,7 +194,7 @@ export class VFS
public async writeFileAsync(filepath: any, data = "", append = false, atomic = true): Promise<void>
{
const options = (append) ? { "flag": "a" } : { "flag": "w" };
const options = append ? { flag: "a" } : { flag: "w" };
if (!await this.exists(filepath))
{