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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

improve: use equipmentKeys for missionInventoryUpdate's XP logic (#425)

ec9c2c89
Sainan <sainan@calamity.gg>
提交于

代码差异

2 个文件 +15 -6
Modified src/services/inventoryService.ts +5 -5
@@ -14,7 +14,9 @@ import {
14 14 ISeasonChallenge,
15 15 ITypeCount,
16 16 InventorySlot,
17 IWeaponSkinClient
17 IWeaponSkinClient,
18 TEquipmentKey,
19 equipmentKeys
18 20 } from "@/src/types/inventoryTypes/inventoryTypes";
19 21 import { IGenericUpdate } from "../types/genericUpdate";
20 22 import {
@@ -462,7 +464,7 @@ export const addSkin = async (typeName: string, accountId: string): Promise<IWea
462 464 const addGearExpByCategory = (
463 465 inventory: IInventoryDatabaseDocument,
464 466 gearArray: IEquipmentClient[] | undefined,
465 categoryName: "Pistols" | "LongGuns" | "Melee" | "Suits"
467 categoryName: TEquipmentKey
466 468 ) => {
467 469 const category = inventory[categoryName];
468 470
@@ -619,8 +621,6 @@ const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Comple
619 621 }
620 622 };
621 623
622 const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const;
623
624 624 export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
625 625 const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, FusionPoints, Consumables, Recipes, Missions } =
626 626 data;
@@ -651,7 +651,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
651 651 });
652 652
653 653 // Gear XP
654 gearKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
654 equipmentKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
655 655
656 656 // Incarnon Challenges
657 657 if (data.EvolutionProgress) {
Modified src/types/requestTypes.ts +10 -1
@@ -44,10 +44,19 @@ export interface IMissionInventoryUpdateRequest {
44 44 rewardsMultiplier?: number;
45 45 ActiveBoosters?: IBooster[];
46 46 AffiliationChanges?: IAffiliationChange[];
47 Suits?: IEquipmentClient[];
47 48 LongGuns?: IEquipmentClient[];
48 49 Pistols?: IEquipmentClient[];
49 Suits?: IEquipmentClient[];
50 50 Melee?: IEquipmentClient[];
51 SpecialItems?: IEquipmentClient[];
52 Sentinels?: IEquipmentClient[];
53 SentinelWeapons?: IEquipmentClient[];
54 SpaceSuits?: IEquipmentClient[];
55 SpaceGuns?: IEquipmentClient[];
56 SpaceMelee?: IEquipmentClient[];
57 Hoverboards?: IEquipmentClient[];
58 OperatorAmps?: IEquipmentClient[];
59 MoaPets?: IEquipmentClient[];
51 60 FusionBundles?: ITypeCount[];
52 61 RawUpgrades?: IRawUpgrade[];
53 62 MiscItems?: IMiscItem[];