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: handle focus UnlockUpgrade request from U18.5 (#4122)

Closes #4121 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4122 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

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

代码差异

1 个文件 +4 -7
Modified src/controllers/api/focusController.ts +4 -7
@@ -216,10 +216,10 @@ export const focusController: RequestHandler = async (req, res) => {
216 216 break;
217 217 }
218 218 case "UnlockUpgrade": {
219 if (focusVersion > 1) {
220 const request = JSON.parse(String(req.body)) as IUnlockUpgrade2Request;
219 const request = JSON.parse(String(req.body)) as IUnlockUpgrade2Request | IUnlockUpgrade1Request;
220 const inventory = await getInventory2(account._id, "FocusUpgrades", "FocusXP");
221 if ("FocusTypes" in request) {
221 222 const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]);
222 const inventory = await getInventory2(account._id, "FocusUpgrades", "FocusXP");
223 223 let cost = 0;
224 224 for (const focusType of request.FocusTypes) {
225 225 cost += getUpgradeUnlockCost(focusType);
@@ -232,7 +232,6 @@ export const focusController: RequestHandler = async (req, res) => {
232 232 FocusPointCosts: { [focusPolarity]: cost }
233 233 });
234 234 } else {
235 const request = JSON.parse(String(req.body)) as IUnlockUpgrade1Request;
236 235 const focusPolarity = focusTypeToPolarity(request.FocusType);
237 236 const inventory = await getInventory2(account._id, "FocusUpgrades", "FocusXP");
238 237 const cost = getUpgradeUnlockCost(request.FocusType);
@@ -467,12 +466,10 @@ interface IWayRequest {
467 466 FocusType: string;
468 467 }
469 468
470 // Focus 2.0 & Focus 3.0
469 // Format changed in U18.5, maybe earlier
471 470 interface IUnlockUpgrade2Request {
472 471 FocusTypes: string[];
473 472 }
474
475 // Focus 1.0
476 473 interface IUnlockUpgrade1Request {
477 474 FocusType: string;
478 475 ActivateUpgrade: boolean;