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

feat: implement polarization (forma) (#173)

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

代码差异

3 个文件 +20 -2
Modified src/controllers/api/upgradesController.ts +15 -0
@@ -1,5 +1,6 @@
1 1 import { RequestHandler } from "express";
2 2 import { IUpgradesRequest } from "@/src/types/requestTypes";
3 import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
3 4 import { IGenericItemDatabase, IMiscItem, TGenericItemKey } from "@/src/types/inventoryTypes/inventoryTypes";
4 5 import { addMiscItems, getInventory } from "@/src/services/inventoryService";
5 6
@@ -42,6 +43,20 @@ export const upgradesController: RequestHandler = async (req, res) => {
42 43 if (item._id.toString() == payload.ItemId.$oid) {
43 44 item.Features ??= 0;
44 45 item.Features |= 32;
46 }
47 }
48 break;
49 case "/Lotus/Types/Items/MiscItems/Forma":
50 for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) {
51 if (item._id.toString() == payload.ItemId.$oid) {
52 item.XP = 0;
53 item.Polarity ??= [];
54 item.Polarity.push({
55 Slot: operation.PolarizeSlot,
56 Value: operation.PolarizeValue
57 } satisfies IPolarity);
58 item.Polarized ??= 0;
59 item.Polarized += 1;
45 60 break;
46 61 }
47 62 }
Modified src/types/inventoryTypes/inventoryTypes.ts +3 -1
@@ -91,7 +91,9 @@ export interface IGenericItem {
91 91 Configs: IItemConfig[];
92 92 UpgradeVer: number;
93 93 ItemId: IOid;
94 Features?: number; //space suit has this
94 Features?: number;
95 Polarity?: IPolarity[];
96 Polarized?: number;
95 97 }
96 98
97 99 export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> {
Modified src/types/requestTypes.ts +2 -1
@@ -1,4 +1,5 @@
1 1 import { IOid } from "./commonTypes";
2 import { FocusSchool } from "@/src/types/inventoryTypes/commonInventoryTypes";
2 3 import {
3 4 IBooster,
4 5 IChallengeProgress,
@@ -78,6 +79,6 @@ export interface IUpgradeOperation {
78 79 OperationType: string;
79 80 UpgradeRequirement: string; // uniqueName of item being consumed
80 81 PolarizeSlot: number;
81 PolarizeValue: string; // polarity
82 PolarizeValue: FocusSchool;
82 83 PolarityRemap: {}[];
83 84 }