XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: replace instances of `find(x => x = ...)` with `indexOf(...)`

b01376f7
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

6 个文件 +6 -6
Modified src/controllers/api/inventoryController.ts +1 -1
@@ -340,7 +340,7 @@ export const getInventoryResponse = async (
340 340 };
341 341
342 342 const addString = (arr: string[], str: string): void => {
343 if (!arr.find(x => x == str)) {
343 if (arr.indexOf(str) == -1) {
344 344 arr.push(str);
345 345 }
346 346 };
Modified src/controllers/api/loginRewardsSelectionController.ts +1 -1
@@ -26,7 +26,7 @@ export const loginRewardsSelectionController: RequestHandler = async (req, res)
26 26 StoreItemType: body.ChosenReward
27 27 };
28 28 inventoryChanges = (await handleStoreItemAcquisition(body.ChosenReward, inventory)).InventoryChanges;
29 if (!evergreenRewards.find(x => x == body.ChosenReward)) {
29 if (evergreenRewards.indexOf(body.ChosenReward) == -1) {
30 30 inventory.LoginMilestoneRewards.push(body.ChosenReward);
31 31 }
32 32 } else {
Modified src/controllers/api/nemesisController.ts +1 -1
@@ -177,7 +177,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
177 177 weaponIdx = initialWeaponIdx;
178 178 do {
179 179 const weapon = weapons[weaponIdx];
180 if (!body.target.DisallowedWeapons.find(x => x == weapon)) {
180 if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
181 181 break;
182 182 }
183 183 weaponIdx = (weaponIdx + 1) % weapons.length;
Modified src/services/guildService.ts +1 -1
@@ -445,7 +445,7 @@ export const addGuildMemberShipDecoContribution = (guildMember: IGuildMemberData
445 445 export const processDojoBuildMaterialsGathered = (guild: TGuildDatabaseDocument, build: IDojoBuild): void => {
446 446 if (build.guildXpValue) {
447 447 guild.ClaimedXP ??= [];
448 if (!guild.ClaimedXP.find(x => x == build.resultType)) {
448 if (guild.ClaimedXP.indexOf(build.resultType) == -1) {
449 449 guild.ClaimedXP.push(build.resultType);
450 450 guild.XP += build.guildXpValue;
451 451 }
Modified src/services/loginService.ts +1 -1
@@ -90,7 +90,7 @@ export const getAccountIdForRequest = async (req: Request): Promise<string> => {
90 90 };
91 91
92 92 export const isAdministrator = (account: TAccountDocument): boolean => {
93 return !!config.administratorNames?.find(x => x == account.DisplayName);
93 return config.administratorNames?.indexOf(account.DisplayName) != -1;
94 94 };
95 95
96 96 const platform_magics = [753, 639, 247, 37, 60];
Modified src/services/missionInventoryUpdateService.ts +1 -1
@@ -383,7 +383,7 @@ export const addMissionInventoryUpdates = async (
383 383 }
384 384 if (
385 385 inventory.LibraryActiveDailyTaskInfo &&
386 inventory.LibraryActiveDailyTaskInfo.EnemyTypes.find(x => x == scan.EnemyType)
386 inventory.LibraryActiveDailyTaskInfo.EnemyTypes.indexOf(scan.EnemyType) != -1
387 387 ) {
388 388 inventory.LibraryActiveDailyTaskInfo.Scans ??= 0;
389 389 inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count;