feat: add universalPolarityEverywhere (#368)

This commit is contained in:
Sainan 2024-06-22 23:22:38 +02:00 committed by GitHub
parent b4fedb7fff
commit fda7b5f816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 84 additions and 38 deletions

View File

@ -20,5 +20,6 @@
"unlockAllShipDecorations": true, "unlockAllShipDecorations": true,
"unlockAllFlavourItems": true, "unlockAllFlavourItems": true,
"unlockAllSkins": true, "unlockAllSkins": true,
"universalPolarityEverywhere": true,
"spoofMasteryRank": -1 "spoofMasteryRank": -1
} }

View File

@ -5,7 +5,8 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
import { config } from "@/src/services/configService"; import { config } from "@/src/services/configService";
import allMissions from "@/static/fixed_responses/allMissions.json"; import allMissions from "@/static/fixed_responses/allMissions.json";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes"; import { IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus"; import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
@ -118,6 +119,23 @@ const inventoryController: RequestHandler = async (request, response) => {
} }
} }
if (config.universalPolarityEverywhere) {
const Polarity: IPolarity[] = [];
for (let i = 0; i != 10; ++i) {
Polarity.push({
Slot: i,
Value: ArtifactPolarity.Any
});
}
for (const key of equipmentKeys) {
if (key in inventoryResponse) {
for (const equipment of inventoryResponse[key]) {
equipment.Polarity = Polarity;
}
}
}
}
response.json(inventoryResponse); response.json(inventoryResponse);
}; };

View File

@ -1,6 +1,10 @@
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { IUpgradesRequest } from "@/src/types/requestTypes"; import { IUpgradesRequest } from "@/src/types/requestTypes";
import { FocusSchool, IEquipmentDatabase, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes"; import {
ArtifactPolarity,
IEquipmentDatabase,
EquipmentFeatures
} from "@/src/types/inventoryTypes/commonInventoryTypes";
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
import { getAccountIdForRequest } from "@/src/services/loginService"; import { getAccountIdForRequest } from "@/src/services/loginService";
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService"; import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
@ -133,7 +137,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
res.json({ InventoryChanges }); res.json({ InventoryChanges });
}; };
const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: FocusSchool): void => { const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: ArtifactPolarity): void => {
item.Polarity ??= []; item.Polarity ??= [];
const entry = item.Polarity.find(entry => entry.Slot == slot); const entry = item.Polarity.find(entry => entry.Slot == slot);
if (entry) { if (entry) {

View File

@ -37,6 +37,7 @@ interface IConfig {
unlockAllShipDecorations?: boolean; unlockAllShipDecorations?: boolean;
unlockAllFlavourItems?: boolean; unlockAllFlavourItems?: boolean;
unlockAllSkins?: boolean; unlockAllSkins?: boolean;
universalPolarityEverywhere?: boolean;
spoofMasteryRank?: number; spoofMasteryRank?: number;
} }

View File

@ -3,19 +3,19 @@ import { Types } from "mongoose";
export interface IPolarity { export interface IPolarity {
Slot: number; Slot: number;
Value: FocusSchool; Value: ArtifactPolarity;
} }
export enum FocusSchool { export enum ArtifactPolarity {
ApAny = "AP_ANY", Any = "AP_ANY",
ApAttack = "AP_ATTACK", Attack = "AP_ATTACK",
ApDefense = "AP_DEFENSE", Defense = "AP_DEFENSE",
ApPower = "AP_POWER", Power = "AP_POWER",
ApPrecept = "AP_PRECEPT", Precept = "AP_PRECEPT",
ApTactic = "AP_TACTIC", Tactic = "AP_TACTIC",
ApUmbra = "AP_UMBRA", Umbra = "AP_UMBRA",
ApUniversal = "AP_UNIVERSAL", Universal = "AP_UNIVERSAL",
ApWard = "AP_WARD" Ward = "AP_WARD"
} }
export interface IColor { export interface IColor {

View File

@ -2,8 +2,8 @@
import { Document, Types } from "mongoose"; import { Document, Types } from "mongoose";
import { IOid, IMongoDate } from "../commonTypes"; import { IOid, IMongoDate } from "../commonTypes";
import { import {
ArtifactPolarity,
IColor, IColor,
FocusSchool,
IItemConfig, IItemConfig,
IOperatorConfigClient, IOperatorConfigClient,
IEquipmentSelection, IEquipmentSelection,
@ -61,15 +61,21 @@ export interface ITypeCount {
ItemCount: number; ItemCount: number;
} }
export type TEquipmentKey = export const equipmentKeys = [
| "Suits" "Suits",
| "LongGuns" "LongGuns",
| "Pistols" "Pistols",
| "Melee" "Melee",
| "SpecialItems" "SpecialItems",
| "Sentinels" "Sentinels",
| "SentinelWeapons" "SentinelWeapons",
| "SpaceGuns"; "SpaceSuits",
"SpaceGuns",
"SpaceMelee",
"Hoverboards"
] as const;
export type TEquipmentKey = (typeof equipmentKeys)[number];
export interface IDuviriInfo { export interface IDuviriInfo {
Seed: number; Seed: number;
@ -599,6 +605,14 @@ export interface ILoadOutPresets {
OPERATOR_ADULT: ILoadoutConfigClient[]; OPERATOR_ADULT: ILoadoutConfigClient[];
} }
export enum FocusSchool {
Attack = "AP_ATTACK",
Defense = "AP_DEFENSE",
Power = "AP_POWER",
Tactic = "AP_TACTIC",
Ward = "AP_WARD"
}
export interface ILoadoutConfigClient { export interface ILoadoutConfigClient {
FocusSchool?: FocusSchool; FocusSchool?: FocusSchool;
PresetIcon?: string; PresetIcon?: string;
@ -707,7 +721,7 @@ export interface IUpgradeFingerprint {
compat: string; compat: string;
lim: number; lim: number;
lvlReq: number; lvlReq: number;
pol: FocusSchool; pol: ArtifactPolarity;
buffs: IBuff[]; buffs: IBuff[];
curses: IBuff[]; curses: IBuff[];
} }

View File

@ -1,5 +1,5 @@
import { IOid } from "./commonTypes"; import { IOid } from "./commonTypes";
import { IPolarity, FocusSchool, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { ArtifactPolarity, IPolarity, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { import {
IBooster, IBooster,
IChallengeProgress, IChallengeProgress,
@ -98,6 +98,6 @@ export interface IUpgradeOperation {
OperationType: string; OperationType: string;
UpgradeRequirement: string; // uniqueName of item being consumed UpgradeRequirement: string; // uniqueName of item being consumed
PolarizeSlot: number; PolarizeSlot: number;
PolarizeValue: FocusSchool; PolarizeValue: ArtifactPolarity;
PolarityRemap: IPolarity[]; PolarityRemap: IPolarity[];
} }

View File

@ -231,9 +231,9 @@
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="infiniteResources" /> <input class="form-check-input" type="checkbox" id="infiniteResources" />
<label class="form-check-label" for="infiniteResources" <label class="form-check-label" for="infiniteResources">
>Infinite Credits and Platinum</label Infinite Credits and Platinum
> </label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" /> <input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" />
@ -241,22 +241,30 @@
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="unlockAllShipDecorations" /> <input class="form-check-input" type="checkbox" id="unlockAllShipDecorations" />
<label class="form-check-label" for="unlockAllShipDecorations" <label class="form-check-label" for="unlockAllShipDecorations">
>Unlock All Ship Decorations</label Unlock All Ship Decorations
> </label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="unlockAllFlavourItems" /> <input class="form-check-input" type="checkbox" id="unlockAllFlavourItems" />
<label class="form-check-label" for="unlockAllFlavourItems">Unlock All Accessories</label> <label class="form-check-label" for="unlockAllFlavourItems">
Unlock All Flavor Items (Glyphs & co.)
</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="unlockAllSkins" /> <input class="form-check-input" type="checkbox" id="unlockAllSkins" />
<label class="form-check-label" for="unlockAllSkins">Unlock All Skins</label> <label class="form-check-label" for="unlockAllSkins">Unlock All Skins</label>
</div> </div>
<div class="form-group"> <div class="form-check">
<label class="form-label" for="spoofMasteryRank" <input class="form-check-input" type="checkbox" id="universalPolarityEverywhere" />
>Spoofed Mastery Rank (-1 to disable)</label <label class="form-check-label" for="universalPolarityEverywhere">
> Universal Polarity Everywhere
</label>
</div>
<div class="form-group mt-2 mb-2">
<label class="form-label" for="spoofMasteryRank">
Spoofed Mastery Rank (-1 to disable)
</label>
<input class="form-control" id="spoofMasteryRank" type="number" min="-1" /> <input class="form-control" id="spoofMasteryRank" type="number" min="-1" />
</div> </div>
<button class="btn btn-primary mt-3" type="submit">Save Settings</button> <button class="btn btn-primary mt-3" type="submit">Save Settings</button>