Merge branch 'main' into web-exalted
This commit is contained in:
		
						commit
						7f2901237d
					
				@ -1,16 +1,112 @@
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import worldState from "@/static/fixed_responses/worldState.json";
 | 
			
		||||
import staticWorldState from "@/static/fixed_responses/worldState.json";
 | 
			
		||||
import buildConfig from "@/static/data/buildConfig.json";
 | 
			
		||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
 | 
			
		||||
 | 
			
		||||
const worldStateController: RequestHandler = (req, res) => {
 | 
			
		||||
    const buildLabel: string =
 | 
			
		||||
        typeof req.query.buildLabel == "string" ? req.query.buildLabel.split(" ").join("+") : buildConfig.buildLabel;
 | 
			
		||||
 | 
			
		||||
    res.json({
 | 
			
		||||
        ...worldState,
 | 
			
		||||
        BuildLabel: buildLabel,
 | 
			
		||||
export const worldStateController: RequestHandler = (req, res) => {
 | 
			
		||||
    const worldState: IWorldState = {
 | 
			
		||||
        ...staticWorldState,
 | 
			
		||||
        BuildLabel:
 | 
			
		||||
            typeof req.query.buildLabel == "string"
 | 
			
		||||
                ? req.query.buildLabel.split(" ").join("+")
 | 
			
		||||
                : buildConfig.buildLabel,
 | 
			
		||||
        Time: Math.round(Date.now() / 1000)
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    const week = Math.trunc(new Date().getTime() / 604800000);
 | 
			
		||||
 | 
			
		||||
    // Elite Sanctuary Onslaught cycling every week
 | 
			
		||||
    worldState.NodeOverrides.push({
 | 
			
		||||
        _id: { $oid: "5ad9f9bb6df82a56eabf3d44" },
 | 
			
		||||
        Node: "SolNode802",
 | 
			
		||||
        Seed: week // unfaithful
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Holdfast & Hex bounties cycling every 2.5 hours; unfaithful implementation
 | 
			
		||||
    const bountyCycle = Math.trunc(new Date().getTime() / 9000000);
 | 
			
		||||
    const bountyCycleStart = bountyCycle * 9000000;
 | 
			
		||||
    const bountyCycleEnd = bountyCycleStart + 9000000;
 | 
			
		||||
    worldState.SyndicateMissions.push({
 | 
			
		||||
        _id: { $oid: bountyCycleStart.toString(16) + "0000000000000029" },
 | 
			
		||||
        Activation: { $date: { $numberLong: bountyCycleStart.toString() } },
 | 
			
		||||
        Expiry: { $date: { $numberLong: bountyCycleEnd.toString() } },
 | 
			
		||||
        Tag: "ZarimanSyndicate",
 | 
			
		||||
        Seed: bountyCycle,
 | 
			
		||||
        Nodes: []
 | 
			
		||||
    });
 | 
			
		||||
    worldState.SyndicateMissions.push({
 | 
			
		||||
        _id: { $oid: bountyCycleStart.toString(16) + "0000000000000006" },
 | 
			
		||||
        Activation: { $date: { $numberLong: bountyCycleStart.toString(10) } },
 | 
			
		||||
        Expiry: { $date: { $numberLong: bountyCycleEnd.toString(10) } },
 | 
			
		||||
        Tag: "HexSyndicate",
 | 
			
		||||
        Seed: bountyCycle,
 | 
			
		||||
        Nodes: []
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Circuit choices cycling every week
 | 
			
		||||
    worldState.EndlessXpChoices.push({
 | 
			
		||||
        Category: "EXC_NORMAL",
 | 
			
		||||
        Choices: [
 | 
			
		||||
            ["Nidus", "Octavia", "Harrow"],
 | 
			
		||||
            ["Gara", "Khora", "Revenant"],
 | 
			
		||||
            ["Garuda", "Baruuk", "Hildryn"],
 | 
			
		||||
            ["Excalibur", "Trinity", "Ember"],
 | 
			
		||||
            ["Loki", "Mag", "Rhino"],
 | 
			
		||||
            ["Ash", "Frost", "Nyx"],
 | 
			
		||||
            ["Saryn", "Vauban", "Nova"],
 | 
			
		||||
            ["Nekros", "Valkyr", "Oberon"],
 | 
			
		||||
            ["Hydroid", "Mirage", "Limbo"],
 | 
			
		||||
            ["Mesa", "Chroma", "Atlas"],
 | 
			
		||||
            ["Ivara", "Inaros", "Titania"]
 | 
			
		||||
        ][week % 12]
 | 
			
		||||
    });
 | 
			
		||||
    worldState.EndlessXpChoices.push({
 | 
			
		||||
        Category: "EXC_HARD",
 | 
			
		||||
        Choices: [
 | 
			
		||||
            ["Brunt", "Soma", "Vasto", "Solo", "Burston"],
 | 
			
		||||
            ["Zylok", "Sibear", "Dread", "Despair", "Hate"],
 | 
			
		||||
            ["Dera", "Sybaris", "Cestra", "Sicarus", "Okina"],
 | 
			
		||||
            ["Braton", "Lato", "Skana", "Paris", "Kunai"],
 | 
			
		||||
            ["Boar", "Gammacor", "Angstrum", "Gorgon", "Anku"],
 | 
			
		||||
            ["Bo", "Latron", "Furis", "Furax", "Strun"],
 | 
			
		||||
            ["Lex", "Magistar", "Boltor", "Bronco", "Dagger"],
 | 
			
		||||
            ["Torid", "Toxocyst", "Ichor", "Miter", "Atomos"]
 | 
			
		||||
        ][week % 8]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    res.json(worldState);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export { worldStateController };
 | 
			
		||||
interface IWorldState {
 | 
			
		||||
    BuildLabel: string;
 | 
			
		||||
    Time: number;
 | 
			
		||||
    SyndicateMissions: ISyndicateMission[];
 | 
			
		||||
    NodeOverrides: INodeOverride[];
 | 
			
		||||
    EndlessXpChoices: IEndlessXpChoice[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ISyndicateMission {
 | 
			
		||||
    _id: IOid;
 | 
			
		||||
    Activation: IMongoDate;
 | 
			
		||||
    Expiry: IMongoDate;
 | 
			
		||||
    Tag: string;
 | 
			
		||||
    Seed: number;
 | 
			
		||||
    Nodes: string[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface INodeOverride {
 | 
			
		||||
    _id: IOid;
 | 
			
		||||
    Activation?: IMongoDate;
 | 
			
		||||
    Expiry?: IMongoDate;
 | 
			
		||||
    Node: string;
 | 
			
		||||
    Hide?: boolean;
 | 
			
		||||
    Seed?: number;
 | 
			
		||||
    LevelOverride?: string;
 | 
			
		||||
    Faction?: string;
 | 
			
		||||
    CustomNpcEncounters?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface IEndlessXpChoice {
 | 
			
		||||
    Category: string;
 | 
			
		||||
    Choices: string[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { IStatsView } from "@/src/types/statTypes";
 | 
			
		||||
import { config } from "@/src/services/configService";
 | 
			
		||||
import allScans from "@/static/fixed_responses/allScans.json";
 | 
			
		||||
import { ExportEnemies } from "warframe-public-export-plus";
 | 
			
		||||
 | 
			
		||||
const viewController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
@ -23,6 +24,11 @@ const viewController: RequestHandler = async (req, res) => {
 | 
			
		||||
    }
 | 
			
		||||
    if (config.unlockAllScans) {
 | 
			
		||||
        responseJson.Scans = allScans;
 | 
			
		||||
        for (const type of Object.keys(ExportEnemies.avatars)) {
 | 
			
		||||
            if (!responseJson.Scans.find(x => x.type == type)) {
 | 
			
		||||
                responseJson.Scans.push({ type, scans: 9999 });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    res.json(responseJson);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -219,16 +219,16 @@ export const addItem = async (
 | 
			
		||||
        case "Powersuits":
 | 
			
		||||
            switch (typeName.substr(1).split("/")[2]) {
 | 
			
		||||
                default: {
 | 
			
		||||
                    const suit = await addPowerSuit(typeName, accountId);
 | 
			
		||||
                    const inventoryChanges = await addPowerSuit(typeName, accountId);
 | 
			
		||||
                    await updateSlots(accountId, InventorySlot.SUITS, 0, 1);
 | 
			
		||||
                    return {
 | 
			
		||||
                        InventoryChanges: {
 | 
			
		||||
                            ...inventoryChanges,
 | 
			
		||||
                            SuitBin: {
 | 
			
		||||
                                count: 1,
 | 
			
		||||
                                platinum: 0,
 | 
			
		||||
                                Slots: -1
 | 
			
		||||
                            },
 | 
			
		||||
                            Suits: [suit]
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
@ -247,16 +247,16 @@ export const addItem = async (
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
                case "EntratiMech": {
 | 
			
		||||
                    const mechSuit = await addMechSuit(typeName, accountId);
 | 
			
		||||
                    const inventoryChanges = await addMechSuit(typeName, accountId);
 | 
			
		||||
                    await updateSlots(accountId, InventorySlot.MECHSUITS, 0, 1);
 | 
			
		||||
                    return {
 | 
			
		||||
                        InventoryChanges: {
 | 
			
		||||
                            ...inventoryChanges,
 | 
			
		||||
                            MechBin: {
 | 
			
		||||
                                count: 1,
 | 
			
		||||
                                platinum: 0,
 | 
			
		||||
                                Slots: -1
 | 
			
		||||
                            },
 | 
			
		||||
                            MechSuits: [mechSuit]
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
@ -405,47 +405,55 @@ export const addSentinelWeapon = async (typeName: string, accountId: string) =>
 | 
			
		||||
    return changedInventory.SentinelWeapons[sentinelIndex - 1].toJSON();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<IEquipmentClient> => {
 | 
			
		||||
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<IInventoryChanges> => {
 | 
			
		||||
    const inventoryChanges: IInventoryChanges = {};
 | 
			
		||||
    const specialItems = getExalted(powersuitName);
 | 
			
		||||
    if (specialItems) {
 | 
			
		||||
        for await (const specialItem of specialItems) {
 | 
			
		||||
            await addSpecialItem(specialItem, accountId);
 | 
			
		||||
            await addSpecialItem(specialItem, accountId, inventoryChanges);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
    const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 });
 | 
			
		||||
    const changedInventory = await inventory.save();
 | 
			
		||||
    return changedInventory.Suits[suitIndex - 1].toJSON() as object as IEquipmentClient;
 | 
			
		||||
    inventoryChanges.Suits = [changedInventory.Suits[suitIndex - 1].toJSON()];
 | 
			
		||||
    return inventoryChanges;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addMechSuit = async (mechsuitName: string, accountId: string) => {
 | 
			
		||||
export const addMechSuit = async (mechsuitName: string, accountId: string): Promise<IInventoryChanges> => {
 | 
			
		||||
    const inventoryChanges: IInventoryChanges = {};
 | 
			
		||||
    const specialItems = getExalted(mechsuitName);
 | 
			
		||||
    if (specialItems) {
 | 
			
		||||
        for await (const specialItem of specialItems) {
 | 
			
		||||
            await addSpecialItem(specialItem, accountId);
 | 
			
		||||
            await addSpecialItem(specialItem, accountId, inventoryChanges);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
    const suitIndex = inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0 });
 | 
			
		||||
    const changedInventory = await inventory.save();
 | 
			
		||||
    return changedInventory.MechSuits[suitIndex - 1].toJSON();
 | 
			
		||||
    inventoryChanges.MechSuits = [changedInventory.MechSuits[suitIndex - 1].toJSON()];
 | 
			
		||||
    return inventoryChanges;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addSpecialItem = async (itemName: string, accountId: string) => {
 | 
			
		||||
export const addSpecialItem = async (
 | 
			
		||||
    itemName: string,
 | 
			
		||||
    accountId: string,
 | 
			
		||||
    inventoryChanges: IInventoryChanges
 | 
			
		||||
): Promise<void> => {
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
    // According to wiki exalted items unique for suit type, so we check if we don't already have that item
 | 
			
		||||
    if (!inventory.SpecialItems.some(obj => obj.ItemType === itemName)) {
 | 
			
		||||
        const specialItemIndex = inventory.SpecialItems.push({
 | 
			
		||||
            ItemType: itemName,
 | 
			
		||||
            Configs: [],
 | 
			
		||||
            Features: EquipmentFeatures.DOUBLE_CAPACITY,
 | 
			
		||||
            UpgradeVer: 101,
 | 
			
		||||
            XP: 0
 | 
			
		||||
        });
 | 
			
		||||
        const changedInventory = await inventory.save();
 | 
			
		||||
        return changedInventory.SpecialItems[specialItemIndex - 1].toJSON();
 | 
			
		||||
    if (inventory.SpecialItems.find(x => x.ItemType == itemName)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    return;
 | 
			
		||||
    const specialItemIndex = inventory.SpecialItems.push({
 | 
			
		||||
        ItemType: itemName,
 | 
			
		||||
        Configs: [],
 | 
			
		||||
        Features: 1,
 | 
			
		||||
        UpgradeVer: 101,
 | 
			
		||||
        XP: 0
 | 
			
		||||
    });
 | 
			
		||||
    const changedInventory = await inventory.save();
 | 
			
		||||
    inventoryChanges.SpecialItems ??= [];
 | 
			
		||||
    (inventoryChanges.SpecialItems as object[]).push(changedInventory.SpecialItems[specialItemIndex - 1].toJSON());
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addSpaceSuit = async (spacesuitName: string, accountId: string) => {
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -479,22 +479,6 @@
 | 
			
		||||
          "xpAmounts": [780, 780, 780, 780, 1540]
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "_id": { "$oid": "663a71c80000000000000029" },
 | 
			
		||||
      "Activation": { "$date": { "$numberLong": "1715106248403" } },
 | 
			
		||||
      "Expiry": { "$date": { "$numberLong": "2000000000000" } },
 | 
			
		||||
      "Tag": "ZarimanSyndicate",
 | 
			
		||||
      "Seed": 99562,
 | 
			
		||||
      "Nodes": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "_id": { "$oid": "676b8d340000000000000006" },
 | 
			
		||||
      "Activation": { "$date": { "$numberLong": "1735101748215" } },
 | 
			
		||||
      "Expiry": { "$date": { "$numberLong": "2000000000000" } },
 | 
			
		||||
      "Tag": "HexSyndicate",
 | 
			
		||||
      "Seed": 33872,
 | 
			
		||||
      "Nodes": []
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "ActiveMissions": [
 | 
			
		||||
@ -690,7 +674,6 @@
 | 
			
		||||
    { "_id": { "$oid": "549b18e9b029cef5991d6aec" }, "Node": "EuropaHUB", "Hide": true },
 | 
			
		||||
    { "_id": { "$oid": "54a1737aeb658f6cbccf70ff" }, "Node": "ErisHUB", "Hide": true },
 | 
			
		||||
    { "_id": { "$oid": "54a736ddec12f80bd6e9e326" }, "Node": "VenusHUB", "Hide": true },
 | 
			
		||||
    { "_id": { "$oid": "5ad9f9bb6df82a56eabf3d44" }, "Node": "SolNode802", "Seed": 9969639 },
 | 
			
		||||
    {
 | 
			
		||||
      "_id": { "$oid": "5b8817c2bd4f253264d6aa91" },
 | 
			
		||||
      "Node": "EarthHUB",
 | 
			
		||||
@ -1103,10 +1086,7 @@
 | 
			
		||||
  "ConstructionProjects": [],
 | 
			
		||||
  "TwitchPromos": [],
 | 
			
		||||
  "ExperimentRecommended": [],
 | 
			
		||||
  "EndlessXpChoices": [
 | 
			
		||||
    { "Category": "EXC_NORMAL", "Choices": ["Gara", "Khora", "Revenant"] },
 | 
			
		||||
    { "Category": "EXC_HARD", "Choices": ["Zylok", "Sibear", "Dread", "Despair", "Hate"] }
 | 
			
		||||
  ],
 | 
			
		||||
  "EndlessXpChoices": [],
 | 
			
		||||
  "ForceLogoutVersion": 0,
 | 
			
		||||
  "SeasonInfo": {
 | 
			
		||||
    "Activation": { "$date": { "$numberLong": "1715796000000" } },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user