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

chore: hard-code data for EntratiSyndicate for pre-U41 clients (#3150)

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

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

代码差异

3 个文件 +955 -6
Modified src/controllers/api/syndicateSacrificeController.ts +5 -6
@@ -1,8 +1,7 @@
1 1 import { getJSONfromString } from "../../helpers/stringHelpers.ts";
2 2 import type { RequestHandler } from "express";
3 import { getAccountIdForRequest } from "../../services/loginService.ts";
3 import { getAccountForRequest } from "../../services/loginService.ts";
4 4 import type { ISyndicateSacrifice } from "warframe-public-export-plus";
5 import { ExportSyndicates } from "warframe-public-export-plus";
6 5 import { handleStoreItemAcquisition } from "../../services/purchaseService.ts";
7 6 import {
8 7 addItem,
@@ -12,12 +11,12 @@ import {
12 11 updateCurrency
13 12 } from "../../services/inventoryService.ts";
14 13 import type { IInventoryChanges } from "../../types/purchaseTypes.ts";
15 import { toStoreItem } from "../../services/itemDataService.ts";
14 import { getSyndicate, toStoreItem } from "../../services/itemDataService.ts";
16 15 import { logger } from "../../utils/logger.ts";
17 16
18 17 export const syndicateSacrificeController: RequestHandler = async (request, response) => {
19 const accountId = await getAccountIdForRequest(request);
20 const inventory = await getInventory(accountId);
18 const account = await getAccountForRequest(request);
19 const inventory = await getInventory(account._id.toString());
21 20 const data = getJSONfromString<ISyndicateSacrificeRequest>(String(request.body));
22 21
23 22 let syndicate = inventory.Affiliations.find(x => x.Tag == data.AffiliationTag);
@@ -43,7 +42,7 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
43 42 };
44 43
45 44 // Process sacrifices and rewards for every level we're reaching
46 const manifest = ExportSyndicates[data.AffiliationTag];
45 const manifest = getSyndicate(data.AffiliationTag, account.BuildLabel)!;
47 46 for (let level = oldLevel + Math.min(levelIncrease, 1); level <= data.SacrificeLevel; ++level) {
48 47 let sacrifice: ISyndicateSacrifice | undefined;
49 48 if (level == 0) {
Modified src/services/itemDataService.ts +10 -0
@@ -5,6 +5,7 @@ import type {
5 5 IKey,
6 6 IMissionReward,
7 7 IRecipe,
8 ISyndicate,
8 9 TReward
9 10 } from "warframe-public-export-plus";
10 11 import {
@@ -35,6 +36,7 @@ import {
35 36 ExportRecipes,
36 37 ExportResources,
37 38 ExportSentinels,
39 ExportSyndicates,
38 40 ExportWarframes,
39 41 ExportWeapons
40 42 } from "warframe-public-export-plus";
@@ -43,6 +45,7 @@ import { logger } from "../utils/logger.ts";
43 45 import { version_compare } from "../helpers/inventoryHelpers.ts";
44 46 import vorsPrizePreU40Rewards from "../../static/fixed_responses/vorsPrizePreU40Rewards.json" with { type: "json" };
45 47 import gameToBuildVersion from "../../static/fixed_responses/gameToBuildVersion.json" with { type: "json" };
48 import EntratiSyndicate_pre_U41 from "../../static/fixed_responses/data/EntratiSyndicate_pre_U41.json" with { type: "json" };
46 49
47 50 export type WeaponTypeInternal =
48 51 | "LongGuns"
@@ -92,6 +95,13 @@ export const getRecipe = (uniqueName: string): IRecipe | undefined => {
92 95 return ExportRecipes[uniqueName];
93 96 };
94 97
98 export const getSyndicate = (tag: string, buildLabel: string | undefined): ISyndicate | undefined => {
99 if (tag == "EntratiSyndicate" && buildLabel && version_compare(buildLabel, gameToBuildVersion["41.0.0"]) < 0) {
100 return EntratiSyndicate_pre_U41 as ISyndicate;
101 }
102 return ExportSyndicates[tag];
103 };
104
95 105 export const getRecipeByResult = (resultType: string): IRecipe | undefined => {
96 106 return Object.values(ExportRecipes).find(x => x.resultType == resultType);
97 107 };