feat: nemesis mode t / LastNemesisAllySpawnTime (#2869)
Also some import stuff. Closes #2867 Reviewed-on: #2869 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
f5c1b83598
commit
af6f422fec
@ -1,4 +1,4 @@
|
||||
import { fromDbOid, version_compare } from "../../helpers/inventoryHelpers.ts";
|
||||
import { fromDbOid, toMongoDate, version_compare } from "../../helpers/inventoryHelpers.ts";
|
||||
import type { IKnifeResponse } from "../../helpers/nemesisHelpers.ts";
|
||||
import {
|
||||
antivirusMods,
|
||||
@ -310,6 +310,15 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
||||
res.json({
|
||||
target: inventory.toJSON().Nemesis
|
||||
});
|
||||
} else if ((req.query.mode as string) == "t") {
|
||||
const inventory = await getInventory(account._id.toString(), "LastNemesisAllySpawnTime");
|
||||
//const body = getJSONfromString<IUpdateAllySpawnTimeRequest>(String(req.body));
|
||||
const now = new Date(Math.trunc(Date.now() / 1000) * 1000);
|
||||
inventory.LastNemesisAllySpawnTime = now;
|
||||
await inventory.save();
|
||||
res.json({
|
||||
NewTime: toMongoDate(now)
|
||||
} satisfies IUpdateAllySpawnTimeResponse);
|
||||
} else if ((req.query.mode as string) == "d") {
|
||||
const inventory = await getInventory(account._id.toString(), "NemesisHistory");
|
||||
const body = getJSONfromString<IRelinquishAdversariesRequest>(String(req.body));
|
||||
@ -462,3 +471,11 @@ const consumeModCharge = (
|
||||
interface IRelinquishAdversariesRequest {
|
||||
nemesisFingerprints: (bigint | number)[];
|
||||
}
|
||||
|
||||
// interface IUpdateAllySpawnTimeRequest {
|
||||
// LastSpawnTime: IMongoDate;
|
||||
// }
|
||||
|
||||
interface IUpdateAllySpawnTimeResponse {
|
||||
NewTime: IMongoDate;
|
||||
}
|
||||
|
||||
@ -1743,7 +1743,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
NemesisAbandonedRewards: { type: [String], default: [] },
|
||||
Nemesis: nemesisSchema,
|
||||
NemesisHistory: { type: [nemesisSchema], default: undefined },
|
||||
//LastNemesisAllySpawnTime: Schema.Types.Mixed,
|
||||
LastNemesisAllySpawnTime: { type: Date, default: undefined },
|
||||
|
||||
//TradingRulesConfirmed,ShowFriendInvNotifications(Option->Social)
|
||||
Settings: settingsSchema,
|
||||
@ -1864,6 +1864,9 @@ inventorySchema.set("toJSON", {
|
||||
if (inventoryDatabase.BlessingCooldown) {
|
||||
inventoryResponse.BlessingCooldown = toMongoDate(inventoryDatabase.BlessingCooldown);
|
||||
}
|
||||
if (inventoryDatabase.LastNemesisAllySpawnTime) {
|
||||
inventoryResponse.LastNemesisAllySpawnTime = toMongoDate(inventoryDatabase.LastNemesisAllySpawnTime);
|
||||
}
|
||||
if (inventoryDatabase.NextRefill) {
|
||||
inventoryResponse.NextRefill = toMongoDate(inventoryDatabase.NextRefill);
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ import type {
|
||||
ITailorShop,
|
||||
ITailorShopDatabase
|
||||
} from "../types/personalRoomsTypes.ts";
|
||||
import { fromMongoDate } from "../helpers/inventoryHelpers.ts";
|
||||
|
||||
const convertDate = (value: IMongoDate): Date => {
|
||||
return new Date(parseInt(value.$date.$numberLong));
|
||||
@ -326,7 +327,14 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
||||
"GiftsRemaining",
|
||||
"ChallengesFixVersion",
|
||||
"Founder",
|
||||
"Guide"
|
||||
"Guide",
|
||||
"EntratiVaultCountLastPeriod",
|
||||
"EntratiLabConquestUnlocked",
|
||||
"EntratiLabConquestHardModeStatus",
|
||||
"EntratiLabConquestCacheScoreMission",
|
||||
"EchoesHexConquestUnlocked",
|
||||
"EchoesHexConquestHardModeStatus",
|
||||
"EchoesHexConquestCacheScoreMission"
|
||||
] as const) {
|
||||
if (client[key] !== undefined) {
|
||||
db[key] = client[key];
|
||||
@ -354,12 +362,28 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
||||
"NodeIntrosCompleted",
|
||||
"DeathMarks",
|
||||
"Wishlist",
|
||||
"NemesisAbandonedRewards"
|
||||
"NemesisAbandonedRewards",
|
||||
"EntratiLabConquestActiveFrameVariants",
|
||||
"EchoesHexConquestActiveFrameVariants",
|
||||
"EchoesHexConquestActiveStickers"
|
||||
] as const) {
|
||||
if (client[key] !== undefined) {
|
||||
db[key] = client[key];
|
||||
}
|
||||
}
|
||||
// IMongoDate
|
||||
for (const key of [
|
||||
"Created",
|
||||
"TrainingDate",
|
||||
"BlessingCooldown",
|
||||
"LastNemesisAllySpawnTime",
|
||||
"NextRefill",
|
||||
"EntratiVaultCountResetDate"
|
||||
] as const) {
|
||||
if (client[key] !== undefined) {
|
||||
db[key] = fromMongoDate(client[key]);
|
||||
}
|
||||
}
|
||||
// IRewardAtten[]
|
||||
for (const key of ["SortieRewardAttenuation", "SpecialItemRewardAttenuation"] as const) {
|
||||
if (client[key] !== undefined) {
|
||||
|
||||
@ -92,6 +92,7 @@ export interface IInventoryDatabase
|
||||
| "NextRefill"
|
||||
| "Nemesis"
|
||||
| "NemesisHistory"
|
||||
| "LastNemesisAllySpawnTime"
|
||||
| "EntratiVaultCountResetDate"
|
||||
| "BrandedSuits"
|
||||
| "LockedWeaponGroup"
|
||||
@ -136,6 +137,7 @@ export interface IInventoryDatabase
|
||||
NextRefill?: Date;
|
||||
Nemesis?: INemesisDatabase;
|
||||
NemesisHistory?: INemesisBaseDatabase[];
|
||||
LastNemesisAllySpawnTime?: Date;
|
||||
EntratiVaultCountResetDate?: Date;
|
||||
BrandedSuits?: Types.ObjectId[];
|
||||
LockedWeaponGroup?: ILockedWeaponGroupDatabase;
|
||||
@ -372,7 +374,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
|
||||
//InvasionChainProgress: IInvasionChainProgress[];
|
||||
Nemesis?: INemesisClient;
|
||||
NemesisHistory?: INemesisBaseClient[];
|
||||
//LastNemesisAllySpawnTime?: IMongoDate;
|
||||
LastNemesisAllySpawnTime?: IMongoDate;
|
||||
Settings?: ISettings;
|
||||
PersonalTechProjects: IPersonalTechProjectClient[];
|
||||
PlayerSkills: IPlayerSkills;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user