2025-08-25 13:37:14 -07:00
|
|
|
import { toMongoDate } from "../../helpers/inventoryHelpers.ts";
|
|
|
|
|
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
|
|
|
|
|
import { getInventory, updateEntratiVault } from "../../services/inventoryService.ts";
|
|
|
|
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
2025-08-24 21:41:20 -07:00
|
|
|
import type { RequestHandler } from "express";
|
2025-03-23 05:06:31 -07:00
|
|
|
|
|
|
|
|
export const entratiLabConquestModeController: RequestHandler = async (req, res) => {
|
|
|
|
|
const accountId = await getAccountIdForRequest(req);
|
|
|
|
|
const inventory = await getInventory(
|
|
|
|
|
accountId,
|
|
|
|
|
"EntratiVaultCountResetDate EntratiVaultCountLastPeriod EntratiLabConquestUnlocked EchoesHexConquestUnlocked EchoesHexConquestActiveFrameVariants EchoesHexConquestActiveStickers EntratiLabConquestActiveFrameVariants EntratiLabConquestCacheScoreMission EchoesHexConquestCacheScoreMission"
|
|
|
|
|
);
|
|
|
|
|
const body = getJSONfromString<IEntratiLabConquestModeRequest>(String(req.body));
|
2025-08-22 11:45:39 -07:00
|
|
|
updateEntratiVault(inventory);
|
2025-03-23 05:06:31 -07:00
|
|
|
if (body.BuyMode) {
|
|
|
|
|
inventory.EntratiVaultCountLastPeriod! += 2;
|
|
|
|
|
if (body.IsEchoesDeepArchemedea) {
|
|
|
|
|
inventory.EchoesHexConquestUnlocked = 1;
|
|
|
|
|
} else {
|
|
|
|
|
inventory.EntratiLabConquestUnlocked = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (body.IsEchoesDeepArchemedea) {
|
|
|
|
|
if (inventory.EchoesHexConquestUnlocked) {
|
|
|
|
|
inventory.EchoesHexConquestActiveFrameVariants = body.EchoesHexConquestActiveFrameVariants!;
|
|
|
|
|
inventory.EchoesHexConquestActiveStickers = body.EchoesHexConquestActiveStickers!;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (inventory.EntratiLabConquestUnlocked) {
|
|
|
|
|
inventory.EntratiLabConquestActiveFrameVariants = body.EntratiLabConquestActiveFrameVariants!;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
await inventory.save();
|
|
|
|
|
res.json({
|
2025-08-22 11:45:39 -07:00
|
|
|
EntratiVaultCountResetDate: toMongoDate(inventory.EntratiVaultCountResetDate!),
|
2025-03-23 05:06:31 -07:00
|
|
|
EntratiVaultCountLastPeriod: inventory.EntratiVaultCountLastPeriod,
|
|
|
|
|
EntratiLabConquestUnlocked: inventory.EntratiLabConquestUnlocked,
|
|
|
|
|
EntratiLabConquestCacheScoreMission: inventory.EntratiLabConquestCacheScoreMission,
|
|
|
|
|
EchoesHexConquestUnlocked: inventory.EchoesHexConquestUnlocked,
|
|
|
|
|
EchoesHexConquestCacheScoreMission: inventory.EchoesHexConquestCacheScoreMission
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
interface IEntratiLabConquestModeRequest {
|
|
|
|
|
BuyMode?: number;
|
|
|
|
|
IsEchoesDeepArchemedea?: number;
|
|
|
|
|
EntratiLabConquestUnlocked?: number;
|
|
|
|
|
EntratiLabConquestActiveFrameVariants?: string[];
|
|
|
|
|
EchoesHexConquestUnlocked?: number;
|
|
|
|
|
EchoesHexConquestActiveFrameVariants?: string[];
|
|
|
|
|
EchoesHexConquestActiveStickers?: string[];
|
|
|
|
|
}
|