forked from OpenWF/SpaceNinjaServer
		
	feat: add universalPolarityEverywhere (#368)
This commit is contained in:
		
							parent
							
								
									b4fedb7fff
								
							
						
					
					
						commit
						fda7b5f816
					
				@ -20,5 +20,6 @@
 | 
			
		||||
  "unlockAllShipDecorations": true,
 | 
			
		||||
  "unlockAllFlavourItems": true,
 | 
			
		||||
  "unlockAllSkins": true,
 | 
			
		||||
  "universalPolarityEverywhere": true,
 | 
			
		||||
  "spoofMasteryRank": -1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,8 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { config } from "@/src/services/configService";
 | 
			
		||||
import allMissions from "@/static/fixed_responses/allMissions.json";
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
// 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);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,10 @@
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
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 { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
 | 
			
		||||
@ -133,7 +137,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
 | 
			
		||||
    res.json({ InventoryChanges });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: FocusSchool): void => {
 | 
			
		||||
const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: ArtifactPolarity): void => {
 | 
			
		||||
    item.Polarity ??= [];
 | 
			
		||||
    const entry = item.Polarity.find(entry => entry.Slot == slot);
 | 
			
		||||
    if (entry) {
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ interface IConfig {
 | 
			
		||||
    unlockAllShipDecorations?: boolean;
 | 
			
		||||
    unlockAllFlavourItems?: boolean;
 | 
			
		||||
    unlockAllSkins?: boolean;
 | 
			
		||||
    universalPolarityEverywhere?: boolean;
 | 
			
		||||
    spoofMasteryRank?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,19 +3,19 @@ import { Types } from "mongoose";
 | 
			
		||||
 | 
			
		||||
export interface IPolarity {
 | 
			
		||||
    Slot: number;
 | 
			
		||||
    Value: FocusSchool;
 | 
			
		||||
    Value: ArtifactPolarity;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export enum FocusSchool {
 | 
			
		||||
    ApAny = "AP_ANY",
 | 
			
		||||
    ApAttack = "AP_ATTACK",
 | 
			
		||||
    ApDefense = "AP_DEFENSE",
 | 
			
		||||
    ApPower = "AP_POWER",
 | 
			
		||||
    ApPrecept = "AP_PRECEPT",
 | 
			
		||||
    ApTactic = "AP_TACTIC",
 | 
			
		||||
    ApUmbra = "AP_UMBRA",
 | 
			
		||||
    ApUniversal = "AP_UNIVERSAL",
 | 
			
		||||
    ApWard = "AP_WARD"
 | 
			
		||||
export enum ArtifactPolarity {
 | 
			
		||||
    Any = "AP_ANY",
 | 
			
		||||
    Attack = "AP_ATTACK",
 | 
			
		||||
    Defense = "AP_DEFENSE",
 | 
			
		||||
    Power = "AP_POWER",
 | 
			
		||||
    Precept = "AP_PRECEPT",
 | 
			
		||||
    Tactic = "AP_TACTIC",
 | 
			
		||||
    Umbra = "AP_UMBRA",
 | 
			
		||||
    Universal = "AP_UNIVERSAL",
 | 
			
		||||
    Ward = "AP_WARD"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IColor {
 | 
			
		||||
 | 
			
		||||
@ -2,8 +2,8 @@
 | 
			
		||||
import { Document, Types } from "mongoose";
 | 
			
		||||
import { IOid, IMongoDate } from "../commonTypes";
 | 
			
		||||
import {
 | 
			
		||||
    ArtifactPolarity,
 | 
			
		||||
    IColor,
 | 
			
		||||
    FocusSchool,
 | 
			
		||||
    IItemConfig,
 | 
			
		||||
    IOperatorConfigClient,
 | 
			
		||||
    IEquipmentSelection,
 | 
			
		||||
@ -61,15 +61,21 @@ export interface ITypeCount {
 | 
			
		||||
    ItemCount: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type TEquipmentKey =
 | 
			
		||||
    | "Suits"
 | 
			
		||||
    | "LongGuns"
 | 
			
		||||
    | "Pistols"
 | 
			
		||||
    | "Melee"
 | 
			
		||||
    | "SpecialItems"
 | 
			
		||||
    | "Sentinels"
 | 
			
		||||
    | "SentinelWeapons"
 | 
			
		||||
    | "SpaceGuns";
 | 
			
		||||
export const equipmentKeys = [
 | 
			
		||||
    "Suits",
 | 
			
		||||
    "LongGuns",
 | 
			
		||||
    "Pistols",
 | 
			
		||||
    "Melee",
 | 
			
		||||
    "SpecialItems",
 | 
			
		||||
    "Sentinels",
 | 
			
		||||
    "SentinelWeapons",
 | 
			
		||||
    "SpaceSuits",
 | 
			
		||||
    "SpaceGuns",
 | 
			
		||||
    "SpaceMelee",
 | 
			
		||||
    "Hoverboards"
 | 
			
		||||
] as const;
 | 
			
		||||
 | 
			
		||||
export type TEquipmentKey = (typeof equipmentKeys)[number];
 | 
			
		||||
 | 
			
		||||
export interface IDuviriInfo {
 | 
			
		||||
    Seed: number;
 | 
			
		||||
@ -599,6 +605,14 @@ export interface ILoadOutPresets {
 | 
			
		||||
    OPERATOR_ADULT: ILoadoutConfigClient[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export enum FocusSchool {
 | 
			
		||||
    Attack = "AP_ATTACK",
 | 
			
		||||
    Defense = "AP_DEFENSE",
 | 
			
		||||
    Power = "AP_POWER",
 | 
			
		||||
    Tactic = "AP_TACTIC",
 | 
			
		||||
    Ward = "AP_WARD"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ILoadoutConfigClient {
 | 
			
		||||
    FocusSchool?: FocusSchool;
 | 
			
		||||
    PresetIcon?: string;
 | 
			
		||||
@ -707,7 +721,7 @@ export interface IUpgradeFingerprint {
 | 
			
		||||
    compat: string;
 | 
			
		||||
    lim: number;
 | 
			
		||||
    lvlReq: number;
 | 
			
		||||
    pol: FocusSchool;
 | 
			
		||||
    pol: ArtifactPolarity;
 | 
			
		||||
    buffs: IBuff[];
 | 
			
		||||
    curses: IBuff[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
import { IOid } from "./commonTypes";
 | 
			
		||||
import { IPolarity, FocusSchool, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import { ArtifactPolarity, IPolarity, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import {
 | 
			
		||||
    IBooster,
 | 
			
		||||
    IChallengeProgress,
 | 
			
		||||
@ -98,6 +98,6 @@ export interface IUpgradeOperation {
 | 
			
		||||
    OperationType: string;
 | 
			
		||||
    UpgradeRequirement: string; // uniqueName of item being consumed
 | 
			
		||||
    PolarizeSlot: number;
 | 
			
		||||
    PolarizeValue: FocusSchool;
 | 
			
		||||
    PolarizeValue: ArtifactPolarity;
 | 
			
		||||
    PolarityRemap: IPolarity[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -231,9 +231,9 @@
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="infiniteResources" />
 | 
			
		||||
                            <label class="form-check-label" for="infiniteResources"
 | 
			
		||||
                                >Infinite Credits and Platinum</label
 | 
			
		||||
                            >
 | 
			
		||||
                            <label class="form-check-label" for="infiniteResources">
 | 
			
		||||
                                Infinite Credits and Platinum
 | 
			
		||||
                            </label>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" />
 | 
			
		||||
@ -241,22 +241,30 @@
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="unlockAllShipDecorations" />
 | 
			
		||||
                            <label class="form-check-label" for="unlockAllShipDecorations"
 | 
			
		||||
                                >Unlock All Ship Decorations</label
 | 
			
		||||
                            >
 | 
			
		||||
                            <label class="form-check-label" for="unlockAllShipDecorations">
 | 
			
		||||
                                Unlock All Ship Decorations
 | 
			
		||||
                            </label>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <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 class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="unlockAllSkins" />
 | 
			
		||||
                            <label class="form-check-label" for="unlockAllSkins">Unlock All Skins</label>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-group">
 | 
			
		||||
                            <label class="form-label" for="spoofMasteryRank"
 | 
			
		||||
                                >Spoofed Mastery Rank (-1 to disable)</label
 | 
			
		||||
                            >
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="universalPolarityEverywhere" />
 | 
			
		||||
                            <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" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <button class="btn btn-primary mt-3" type="submit">Save Settings</button>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user