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

feat: changing equipped shawzin/instrument (#762)

25459503
Sainan <sainan@calamity.inc>
提交于

代码差异

3 个文件 +20 -1
Added src/controllers/api/setEquippedInstrumentController.ts +17 -0
@@ -0,0 +1,17 @@
1 import { RequestHandler } from "express";
2 import { getAccountIdForRequest } from "@/src/services/loginService";
3 import { getInventory } from "@/src/services/inventoryService";
4 import { getJSONfromString } from "@/src/helpers/stringHelpers";
5
6 export const setEquippedInstrumentController: RequestHandler = async (req, res) => {
7 const accountId = await getAccountIdForRequest(req);
8 const inventory = await getInventory(accountId);
9 const body = getJSONfromString(String(req.body)) as ISetEquippedInstrumentRequest;
10 inventory.EquippedInstrument = body.Instrument;
11 await inventory.save();
12 res.end();
13 };
14
15 interface ISetEquippedInstrumentRequest {
16 Instrument: string;
17 }
Modified src/routes/api.ts +2 -0
@@ -56,6 +56,7 @@ import { sellController } from "@/src/controllers/api/sellController";
56 56 import { setActiveQuestController } from "@/src/controllers/api/setActiveQuestController";
57 57 import { setActiveShipController } from "@/src/controllers/api/setActiveShipController";
58 58 import { setBootLocationController } from "@/src/controllers/api/setBootLocationController";
59 import { setEquippedInstrumentController } from "@/src/controllers/api/setEquippedInstrumentController";
59 60 import { setPlacedDecoInfoController } from "@/src/controllers/api/setPlacedDecoInfoController";
60 61 import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
61 62 import { setShipFavouriteLoadoutController } from "@/src/controllers/api/setShipFavouriteLoadoutController";
@@ -141,6 +142,7 @@ apiRouter.post("/purchase.php", purchaseController);
141 142 apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
142 143 apiRouter.post("/saveLoadout.php", saveLoadoutController);
143 144 apiRouter.post("/sell.php", sellController);
145 apiRouter.post("/setEquippedInstrument.php", setEquippedInstrumentController);
144 146 apiRouter.post("/setPlacedDecoInfo.php", setPlacedDecoInfoController);
145 147 apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
146 148 apiRouter.post("/setShipFavouriteLoadout.php", setShipFavouriteLoadoutController);
Modified src/types/inventoryTypes/inventoryTypes.ts +1 -1
@@ -250,7 +250,7 @@ export interface IInventoryResponse {
250 250 CompletedJobChains: ICompletedJobChain[];
251 251 SeasonChallengeHistory: ISeasonChallenge[];
252 252 MoaPets: IEquipmentDatabase[];
253 EquippedInstrument: string;
253 EquippedInstrument?: string;
254 254 InvasionChainProgress: IInvasionChainProgress[];
255 255 DataKnives: IEquipmentDatabase[];
256 256 Motorcycles: IEquipmentDatabase[];