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: add all lore, song, & fighter fragments with "unlock all scans" (#3895)

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

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

代码差异

4 个文件 +58 -7
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.105",
21 "warframe-public-export-plus": "^0.5.106",
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.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=="
4089 "version": "0.5.106",
4090 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.106.tgz",
4091 "integrity": "sha512-sEeHu/znVquK5gNjFZScjjNiWld1BpF+1xN7E1dZY/oIQLkprFUreOYiXb18DqcHoDsiJvrnMy4m18ft5fuxaQ=="
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.105",
38 "warframe-public-export-plus": "^0.5.106",
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/custom/unlockAllScansController.ts +43 -2
@@ -3,13 +3,15 @@ import allScans from "../../../static/fixed_responses/allScans.json" with { type
3 3 import { ExportCodex, ExportEnemies } from "warframe-public-export-plus";
4 4 import { getAccountIdForRequest } from "../../services/loginService.ts";
5 5 import { getStats } from "../../services/statsService.ts";
6 import { getInventory, updateIncentiveStates } from "../../services/inventoryService.ts";
6 import { addShipDecorations, getInventory, updateIncentiveStates } from "../../services/inventoryService.ts";
7 import { getShipDecoByNameTag } from "../../services/itemDataService.ts";
8 import { broadcastInventoryUpdate } from "../../services/wsService.ts";
7 9
8 10 export const unlockAllScansController: RequestHandler = async (req, res) => {
9 11 const accountId = await getAccountIdForRequest(req);
10 12 const [stats, inventory] = await Promise.all([
11 13 getStats(accountId),
12 getInventory(accountId, "ChallengeProgress CollectibleSeries")
14 getInventory(accountId, "ChallengeProgress CollectibleSeries LoreFragmentScans ShipDecorations")
13 15 ]);
14 16
15 17 // Unlock all enemy & object scans
@@ -95,6 +97,45 @@ export const unlockAllScansController: RequestHandler = async (req, res) => {
95 97 "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
96 98 }
97 99
100 // Unlock all lore fragment scans
101 const existingPrex = new Set<string>();
102 for (const lfs of inventory.LoreFragmentScans) {
103 if (lfs.ItemType.startsWith("/Lotus/Types/Lore/Fragments/LoreCardFragments/")) {
104 existingPrex.add(lfs.ItemType);
105 }
106 }
107 inventory.LoreFragmentScans = [];
108 for (const [ItemType, data] of Object.entries(ExportCodex.loreFragments)) {
109 inventory.LoreFragmentScans.push({
110 Progress: data.reqScans,
111 Region: "",
112 ItemType
113 });
114 if (ItemType.startsWith("/Lotus/Types/Lore/Fragments/LoreCardFragments/") && !existingPrex.has(ItemType)) {
115 addShipDecorations(inventory, [
116 {
117 ItemType: getShipDecoByNameTag(data.name),
118 ItemCount: 1
119 }
120 ]);
121 }
122 }
123 for (const [ItemType, data] of Object.entries(ExportCodex.songs)) {
124 inventory.LoreFragmentScans.push({
125 Progress: data.reqScans,
126 Region: "",
127 ItemType
128 });
129 }
130 for (const [ItemType, data] of Object.entries(ExportCodex.fighterFrames)) {
131 inventory.LoreFragmentScans.push({
132 Progress: data.reqScans,
133 Region: "",
134 ItemType
135 });
136 }
137
98 138 await Promise.all([stats.save(), inventory.save()]);
99 139 res.end();
140 broadcastInventoryUpdate(req);
100 141 };
Modified src/services/itemDataService.ts +10 -0
@@ -2020,3 +2020,13 @@ export const getRegion = async (uniqueName: string, buildLabel: string | undefin
2020 2020 }
2021 2021 return ExportRegions[uniqueName];
2022 2022 };
2023
2024 // For prex cards
2025 export const getShipDecoByNameTag = (name: string): string => {
2026 for (const [uniqueName, data] of Object.entries(ExportResources)) {
2027 if (data.productCategory == "ShipDecorations" && data.name == name) {
2028 return uniqueName;
2029 }
2030 }
2031 throw new Error(`No ship deco with name tag ${name}`);
2032 };