XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: add universalPolarityEverywhere (#368)

fda7b5f8
Sainan <sainan@calamity.gg>
提交于

代码差异

8 个文件 +84 -38
Modified config.json.example +1 -0
@@ -20,5 +20,6 @@
20 20 "unlockAllShipDecorations": true,
21 21 "unlockAllFlavourItems": true,
22 22 "unlockAllSkins": true,
23 "universalPolarityEverywhere": true,
23 24 "spoofMasteryRank": -1
24 25 }
Modified src/controllers/api/inventoryController.ts +19 -1
@@ -5,7 +5,8 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
5 5 import { config } from "@/src/services/configService";
6 6 import allMissions from "@/static/fixed_responses/allMissions.json";
7 7 import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
8 import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
8 import { IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
9 import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
9 10 import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus";
10 11
11 12 // eslint-disable-next-line @typescript-eslint/no-misused-promises
@@ -118,6 +119,23 @@ const inventoryController: RequestHandler = async (request, response) => {
118 119 }
119 120 }
120 121
122 if (config.universalPolarityEverywhere) {
123 const Polarity: IPolarity[] = [];
124 for (let i = 0; i != 10; ++i) {
125 Polarity.push({
126 Slot: i,
127 Value: ArtifactPolarity.Any
128 });
129 }
130 for (const key of equipmentKeys) {
131 if (key in inventoryResponse) {
132 for (const equipment of inventoryResponse[key]) {
133 equipment.Polarity = Polarity;
134 }
135 }
136 }
137 }
138
121 139 response.json(inventoryResponse);
122 140 };
123 141
Modified src/controllers/api/upgradesController.ts +6 -2
@@ -1,6 +1,10 @@
1 1 import { RequestHandler } from "express";
2 2 import { IUpgradesRequest } from "@/src/types/requestTypes";
3 import { FocusSchool, IEquipmentDatabase, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
3 import {
4 ArtifactPolarity,
5 IEquipmentDatabase,
6 EquipmentFeatures
7 } from "@/src/types/inventoryTypes/commonInventoryTypes";
4 8 import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
5 9 import { getAccountIdForRequest } from "@/src/services/loginService";
6 10 import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
@@ -133,7 +137,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
133 137 res.json({ InventoryChanges });
134 138 };
135 139
136 const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: FocusSchool): void => {
140 const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: ArtifactPolarity): void => {
137 141 item.Polarity ??= [];
138 142 const entry = item.Polarity.find(entry => entry.Slot == slot);
139 143 if (entry) {
Modified src/services/configService.ts +1 -0
@@ -37,6 +37,7 @@ interface IConfig {
37 37 unlockAllShipDecorations?: boolean;
38 38 unlockAllFlavourItems?: boolean;
39 39 unlockAllSkins?: boolean;
40 universalPolarityEverywhere?: boolean;
40 41 spoofMasteryRank?: number;
41 42 }
42 43
Modified src/types/inventoryTypes/commonInventoryTypes.ts +11 -11
@@ -3,19 +3,19 @@ import { Types } from "mongoose";
3 3
4 4 export interface IPolarity {
5 5 Slot: number;
6 Value: FocusSchool;
6 Value: ArtifactPolarity;
7 7 }
8 8
9 export enum FocusSchool {
10 ApAny = "AP_ANY",
11 ApAttack = "AP_ATTACK",
12 ApDefense = "AP_DEFENSE",
13 ApPower = "AP_POWER",
14 ApPrecept = "AP_PRECEPT",
15 ApTactic = "AP_TACTIC",
16 ApUmbra = "AP_UMBRA",
17 ApUniversal = "AP_UNIVERSAL",
18 ApWard = "AP_WARD"
9 export enum ArtifactPolarity {
10 Any = "AP_ANY",
11 Attack = "AP_ATTACK",
12 Defense = "AP_DEFENSE",
13 Power = "AP_POWER",
14 Precept = "AP_PRECEPT",
15 Tactic = "AP_TACTIC",
16 Umbra = "AP_UMBRA",
17 Universal = "AP_UNIVERSAL",
18 Ward = "AP_WARD"
19 19 }
20 20
21 21 export interface IColor {
Modified src/types/inventoryTypes/inventoryTypes.ts +25 -11
@@ -2,8 +2,8 @@
2 2 import { Document, Types } from "mongoose";
3 3 import { IOid, IMongoDate } from "../commonTypes";
4 4 import {
5 ArtifactPolarity,
5 6 IColor,
6 FocusSchool,
7 7 IItemConfig,
8 8 IOperatorConfigClient,
9 9 IEquipmentSelection,
@@ -61,15 +61,21 @@ export interface ITypeCount {
61 61 ItemCount: number;
62 62 }
63 63
64 export type TEquipmentKey =
65 | "Suits"
66 | "LongGuns"
67 | "Pistols"
68 | "Melee"
69 | "SpecialItems"
70 | "Sentinels"
71 | "SentinelWeapons"
72 | "SpaceGuns";
64 export const equipmentKeys = [
65 "Suits",
66 "LongGuns",
67 "Pistols",
68 "Melee",
69 "SpecialItems",
70 "Sentinels",
71 "SentinelWeapons",
72 "SpaceSuits",
73 "SpaceGuns",
74 "SpaceMelee",
75 "Hoverboards"
76 ] as const;
77
78 export type TEquipmentKey = (typeof equipmentKeys)[number];
73 79
74 80 export interface IDuviriInfo {
75 81 Seed: number;
@@ -599,6 +605,14 @@ export interface ILoadOutPresets {
599 605 OPERATOR_ADULT: ILoadoutConfigClient[];
600 606 }
601 607
608 export enum FocusSchool {
609 Attack = "AP_ATTACK",
610 Defense = "AP_DEFENSE",
611 Power = "AP_POWER",
612 Tactic = "AP_TACTIC",
613 Ward = "AP_WARD"
614 }
615
602 616 export interface ILoadoutConfigClient {
603 617 FocusSchool?: FocusSchool;
604 618 PresetIcon?: string;
@@ -707,7 +721,7 @@ export interface IUpgradeFingerprint {
707 721 compat: string;
708 722 lim: number;
709 723 lvlReq: number;
710 pol: FocusSchool;
724 pol: ArtifactPolarity;
711 725 buffs: IBuff[];
712 726 curses: IBuff[];
713 727 }
Modified src/types/requestTypes.ts +2 -2
@@ -1,5 +1,5 @@
1 1 import { IOid } from "./commonTypes";
2 import { IPolarity, FocusSchool, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
2 import { ArtifactPolarity, IPolarity, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
3 3 import {
4 4 IBooster,
5 5 IChallengeProgress,
@@ -98,6 +98,6 @@ export interface IUpgradeOperation {
98 98 OperationType: string;
99 99 UpgradeRequirement: string; // uniqueName of item being consumed
100 100 PolarizeSlot: number;
101 PolarizeValue: FocusSchool;
101 PolarizeValue: ArtifactPolarity;
102 102 PolarityRemap: IPolarity[];
103 103 }
Modified static/webui/index.html +19 -11
@@ -231,9 +231,9 @@
231 231 </div>
232 232 <div class="form-check">
233 233 <input class="form-check-input" type="checkbox" id="infiniteResources" />
234 <label class="form-check-label" for="infiniteResources"
235 >Infinite Credits and Platinum</label
236 >
234 <label class="form-check-label" for="infiniteResources">
235 Infinite Credits and Platinum
236 </label>
237 237 </div>
238 238 <div class="form-check">
239 239 <input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" />
@@ -241,22 +241,30 @@
241 241 </div>
242 242 <div class="form-check">
243 243 <input class="form-check-input" type="checkbox" id="unlockAllShipDecorations" />
244 <label class="form-check-label" for="unlockAllShipDecorations"
245 >Unlock All Ship Decorations</label
246 >
244 <label class="form-check-label" for="unlockAllShipDecorations">
245 Unlock All Ship Decorations
246 </label>
247 247 </div>
248 248 <div class="form-check">
249 249 <input class="form-check-input" type="checkbox" id="unlockAllFlavourItems" />
250 <label class="form-check-label" for="unlockAllFlavourItems">Unlock All Accessories</label>
250 <label class="form-check-label" for="unlockAllFlavourItems">
251 Unlock All Flavor Items (Glyphs & co.)
252 </label>
251 253 </div>
252 254 <div class="form-check">
253 255 <input class="form-check-input" type="checkbox" id="unlockAllSkins" />
254 256 <label class="form-check-label" for="unlockAllSkins">Unlock All Skins</label>
255 257 </div>
256 <div class="form-group">
257 <label class="form-label" for="spoofMasteryRank"
258 >Spoofed Mastery Rank (-1 to disable)</label
259 >
258 <div class="form-check">
259 <input class="form-check-input" type="checkbox" id="universalPolarityEverywhere" />
260 <label class="form-check-label" for="universalPolarityEverywhere">
261 Universal Polarity Everywhere
262 </label>
263 </div>
264 <div class="form-group mt-2 mb-2">
265 <label class="form-label" for="spoofMasteryRank">
266 Spoofed Mastery Rank (-1 to disable)
267 </label>
260 268 <input class="form-control" id="spoofMasteryRank" type="number" min="-1" />
261 269 </div>
262 270 <button class="btn btn-primary mt-3" type="submit">Save Settings</button>