This commit is contained in:
commit
fa645b6ef0
@ -4,6 +4,7 @@ import {
|
||||
createMessage,
|
||||
createNewEventMessages,
|
||||
deleteAllMessagesRead,
|
||||
deleteAllMessagesReadNonCin,
|
||||
deleteMessageRead,
|
||||
getAllMessagesSorted,
|
||||
getMessage
|
||||
@ -31,11 +32,11 @@ export const inboxController: RequestHandler = async (req, res) => {
|
||||
if (deleteId) {
|
||||
if (deleteId === "DeleteAllRead") {
|
||||
await deleteAllMessagesRead(accountId);
|
||||
res.status(200).end();
|
||||
return;
|
||||
} else if (deleteId === "DeleteAllReadNonCin") {
|
||||
await deleteAllMessagesReadNonCin(accountId);
|
||||
} else {
|
||||
await deleteMessageRead(parseOid(deleteId as string));
|
||||
}
|
||||
|
||||
await deleteMessageRead(parseOid(deleteId as string));
|
||||
res.status(200).end();
|
||||
} else if (messageId) {
|
||||
const message = await getMessage(parseOid(messageId as string));
|
||||
|
||||
@ -9,6 +9,9 @@ import type { IDatabaseAccountJson, ILoginRequest, ILoginResponse } from "../../
|
||||
import { logger } from "../../utils/logger.ts";
|
||||
import { version_compare } from "../../helpers/inventoryHelpers.ts";
|
||||
import { handleNonceInvalidation } from "../../services/wsService.ts";
|
||||
import { getInventory } from "../../services/inventoryService.ts";
|
||||
import { createMessage } from "../../services/inboxService.ts";
|
||||
import { fromStoreItem } from "../../services/itemDataService.ts";
|
||||
|
||||
export const loginController: RequestHandler = async (request, response) => {
|
||||
const loginRequest = JSON.parse(String(request.body)) as ILoginRequest; // parse octet stream of json data to json object
|
||||
@ -76,6 +79,24 @@ export const loginController: RequestHandler = async (request, response) => {
|
||||
|
||||
handleNonceInvalidation(account._id.toString());
|
||||
|
||||
// If the client crashed during an endless fissure mission, discharge rewards to an inbox message. (https://www.reddit.com/r/Warframe/comments/5uwwjm/til_if_you_crash_during_a_fissure_you_keep_any/)
|
||||
const inventory = await getInventory(account._id.toString(), "MissionRelicRewards");
|
||||
if (inventory.MissionRelicRewards) {
|
||||
await createMessage(account._id, [
|
||||
{
|
||||
sndr: "/Lotus/Language/Bosses/Ordis",
|
||||
msg: "/Lotus/Language/Menu/VoidProjectionItemsMessage",
|
||||
sub: "/Lotus/Language/Menu/VoidProjectionItemsSubject",
|
||||
icon: "/Lotus/Interface/Icons/Npcs/Ordis.png",
|
||||
countedAtt: inventory.MissionRelicRewards.map(x => ({ ...x, ItemType: fromStoreItem(x.ItemType) })),
|
||||
attVisualOnly: true,
|
||||
highPriority: true // TOVERIFY
|
||||
}
|
||||
]);
|
||||
inventory.MissionRelicRewards = undefined;
|
||||
await inventory.save();
|
||||
}
|
||||
|
||||
response.json(createLoginResponse(myAddress, myUrlBase, account.toJSON(), buildLabel));
|
||||
};
|
||||
|
||||
|
||||
@ -29,6 +29,10 @@ export const deleteAllMessagesRead = async (accountId: string): Promise<void> =>
|
||||
await Inbox.deleteMany({ ownerId: accountId, r: true });
|
||||
};
|
||||
|
||||
export const deleteAllMessagesReadNonCin = async (accountId: string): Promise<void> => {
|
||||
await Inbox.deleteMany({ ownerId: accountId, r: true, cinematic: null });
|
||||
};
|
||||
|
||||
export const createNewEventMessages = async (req: Request): Promise<void> => {
|
||||
const account = await getAccountForRequest(req);
|
||||
const newEventMessages: IMessageCreationTemplate[] = [];
|
||||
|
||||
@ -331,7 +331,7 @@ export const giveKeyChainMessage = async (
|
||||
): Promise<void> => {
|
||||
const keyChainMessage = getKeyChainMessage(keyChainInfo);
|
||||
|
||||
if (questKey.Progress![0].c > 0) {
|
||||
if ((questKey.Progress?.[0]?.c ?? 0) > 0) {
|
||||
keyChainMessage.att = [];
|
||||
keyChainMessage.countedAtt = [];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user