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: filter XPInfo for old clients (#3776)

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

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

代码差异

5 个文件 +45 -22
Modified package-lock.json +4 -4
@@ -18,7 +18,7 @@
18 18 "morgan": "^1.10.0",
19 19 "ncp": "^2.0.0",
20 20 "undici": "^7.10.0",
21 "warframe-public-export-plus": "^0.5.103",
21 "warframe-public-export-plus": "^0.5.105",
22 22 "warframe-riven-info": "^0.1.2",
23 23 "winston": "^3.17.0",
24 24 "winston-daily-rotate-file": "^5.0.0",
@@ -4086,9 +4086,9 @@
4086 4086 }
4087 4087 },
4088 4088 "node_modules/warframe-public-export-plus": {
4089 "version": "0.5.103",
4090 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.103.tgz",
4091 "integrity": "sha512-6Qh0iBkVZkjUkCjgmQF6jvKsZ4uqYgRvObfA++O8Y+hWQ63cKwoTwBAs5EF/DaKnu5BYJtuTHQjznv6ICzwCVg=="
4089 "version": "0.5.105",
4090 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.105.tgz",
4091 "integrity": "sha512-8stUTRCf7ANx1ZiqZOZIXtNnzYkWss9ZhpGc2fWeJdRtXxD9U8QSZD/g3QrSf19CLcUOXqSUMuK+LWQqj396Uw=="
4092 4092 },
4093 4093 "node_modules/warframe-riven-info": {
4094 4094 "version": "0.1.2",
Modified package.json +1 -1
@@ -35,7 +35,7 @@
35 35 "morgan": "^1.10.0",
36 36 "ncp": "^2.0.0",
37 37 "undici": "^7.10.0",
38 "warframe-public-export-plus": "^0.5.103",
38 "warframe-public-export-plus": "^0.5.105",
39 39 "warframe-riven-info": "^0.1.2",
40 40 "winston": "^3.17.0",
41 41 "winston-daily-rotate-file": "^5.0.0",
Modified src/controllers/api/inventoryController.ts +27 -1
@@ -16,7 +16,7 @@ import {
16 16 import type { IPolarity } from "../../types/inventoryTypes/commonInventoryTypes.ts";
17 17 import { ArtifactPolarity } from "../../types/inventoryTypes/commonInventoryTypes.ts";
18 18 import type { ICountedItem } from "warframe-public-export-plus";
19 import { ExportArcanes } from "warframe-public-export-plus";
19 import { ExportArcanes, ExportWarframes, ExportWeapons } from "warframe-public-export-plus";
20 20 import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "../../services/infestedFoundryService.ts";
21 21 import {
22 22 addEmailItem,
@@ -612,6 +612,32 @@ export const getInventoryResponse = async (
612 612 }
613 613 }
614 614
615 // U15 ~ U18 are known to crash with unknown item types in XPInfo, so filter this array.
616 {
617 const prevLength = inventoryResponse.XPInfo.length;
618 inventoryResponse.XPInfo = inventoryResponse.XPInfo.filter(item => {
619 let introducedAt: number | undefined;
620 if (item.ItemType in ExportWarframes) {
621 introducedAt = ExportWarframes[item.ItemType].introducedAt;
622 } else if (item.ItemType in ExportWeapons) {
623 introducedAt = ExportWeapons[item.ItemType].introducedAt;
624 }
625 if (!introducedAt) {
626 return false;
627 }
628 const date = new Date(introducedAt * 1000);
629 return (
630 version_compare(
631 buildLabel,
632 `${date.getUTCFullYear()}.${date.getUTCMonth()}.${date.getUTCDate()}.${date.getUTCHours()}.${date.getUTCMinutes()}`
633 ) >= 0
634 );
635 });
636 if (prevLength != inventoryResponse.XPInfo.length) {
637 logger.debug(`omitting mastery info for ${prevLength - inventoryResponse.XPInfo.length} item(s)`);
638 }
639 }
640
615 641 if (version_compare(buildLabel, gameToBuildVersion["22.13.4"]) <= 0) {
616 642 // Before U22.14.0 Arcanes was installed directly at cosmetic items so client doesn't know about ranked up arcanes and UI displays them unproperly
617 643 inventoryResponse.Upgrades = inventoryResponse.Upgrades.filter(
Modified src/controllers/api/loginController.ts +10 -0
@@ -27,6 +27,7 @@ import { getTokenForClient, getTunablesForClient } from "../../services/tunables
27 27 import type { AddressInfo } from "node:net";
28 28 import gameToBuildVersion from "../../constants/gameToBuildVersion.ts";
29 29 import { getGoogleAccountData } from "../../helpers/customHelpers/customHelpers.ts";
30 import { args } from "../../helpers/commandLineArguments.ts";
30 31
31 32 export const loginController: RequestHandler = async (request, response) => {
32 33 const loginRequest = JSON.parse(String(request.body)) as ILoginRequest; // parse octet stream of json data to json object
@@ -63,6 +64,15 @@ export const loginController: RequestHandler = async (request, response) => {
63 64 ? request.query.buildLabel.split(" ").join("+")
64 65 : buildConfig.buildLabel;
65 66
67 if (version_compare(buildLabel, gameToBuildVersion["42.0.0"]) >= 0) {
68 if (args.dev) {
69 logger.debug(`We are eagerly awaiting your pull requests!`);
70 } else {
71 response.status(400).json({ error: "do you want me to change your diapers, too?" });
72 return;
73 }
74 }
75
66 76 if (
67 77 !account &&
68 78 ((config.autoCreateAccount && loginRequest.ClientType != "webui") ||
Modified src/services/serversideVendorsService.ts +3 -16
@@ -507,22 +507,9 @@ if (args.dev) {
507 507 ads[3].Bin != "BIN_1" ||
508 508 ads[4].Bin != "BIN_0"
509 509 ) {
510 logger.warn(`self test failed for /Lotus/Types/Game/VendorManifests/Hubs/GuildAdvertisementVendorManifest`);
511 }
512
513 const pall = getVendorManifestByTypeName(
514 "/Lotus/Types/Game/VendorManifests/Hubs/IronwakeDondaVendorManifest",
515 fullStock
516 )!.VendorInfo.ItemManifest;
517 if (
518 pall.length != 5 ||
519 pall[0].StoreItem != "/Lotus/StoreItems/Types/Items/ShipDecos/HarrowQuestKeyOrnament" ||
520 pall[1].StoreItem != "/Lotus/StoreItems/Types/BoosterPacks/RivenModPack" ||
521 pall[2].StoreItem != "/Lotus/StoreItems/Types/StoreItems/CreditBundles/150000Credits" ||
522 pall[3].StoreItem != "/Lotus/StoreItems/Types/Items/MiscItems/Kuva" ||
523 pall[4].StoreItem != "/Lotus/StoreItems/Types/BoosterPacks/RivenModPack"
524 ) {
525 logger.warn(`self test failed for /Lotus/Types/Game/VendorManifests/Hubs/IronwakeDondaVendorManifest`);
510 logger.warn(
511 `self test failed for /Lotus/Types/Game/VendorManifests/Hubs/GuildAdvertisementVendorManifest with fullStock=${fullStock}`
512 );
526 513 }
527 514 }
528 515