forked from OpenWF/SpaceNinjaServer
Compare commits
2 Commits
main
...
deathmark-
Author | SHA1 | Date | |
---|---|---|---|
6155ccb416 | |||
31a9fd3620 |
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
@ -13,13 +13,4 @@ jobs:
|
|||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: cp config.json.example config.json
|
- run: cp config.json.example config.json
|
||||||
- run: npm run verify
|
- run: npm run verify
|
||||||
- run: npm run lint:ci
|
- run: npm run lint
|
||||||
- run: npm run prettier
|
|
||||||
- name: Fail if there are uncommitted changes
|
|
||||||
run: |
|
|
||||||
if [[ -n "$(git status --porcelain)" ]]; then
|
|
||||||
echo "Uncommitted changes detected:"
|
|
||||||
git status
|
|
||||||
git diff
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
"build": "tsc --incremental --sourceMap && ncp static/webui build/static/webui",
|
"build": "tsc --incremental --sourceMap && ncp static/webui build/static/webui",
|
||||||
"verify": "tsgo --noEmit",
|
"verify": "tsgo --noEmit",
|
||||||
"lint": "eslint --ext .ts .",
|
"lint": "eslint --ext .ts .",
|
||||||
"lint:ci": "eslint --ext .ts --rule \"prettier/prettier: off\" .",
|
|
||||||
"lint:fix": "eslint --fix --ext .ts .",
|
"lint:fix": "eslint --fix --ext .ts .",
|
||||||
"prettier": "prettier --write .",
|
"prettier": "prettier --write .",
|
||||||
"update-translations": "cd scripts && node update-translations.js"
|
"update-translations": "cd scripts && node update-translations.js"
|
||||||
|
@ -7,8 +7,6 @@ export const clearDialogueHistoryController: RequestHandler = async (req, res) =
|
|||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const request = JSON.parse(String(req.body)) as IClearDialogueRequest;
|
const request = JSON.parse(String(req.body)) as IClearDialogueRequest;
|
||||||
if (inventory.DialogueHistory && inventory.DialogueHistory.Dialogues) {
|
if (inventory.DialogueHistory && inventory.DialogueHistory.Dialogues) {
|
||||||
inventory.DialogueHistory.Resets ??= 0;
|
|
||||||
inventory.DialogueHistory.Resets += 1;
|
|
||||||
for (const dialogueName of request.Dialogues) {
|
for (const dialogueName of request.Dialogues) {
|
||||||
const index = inventory.DialogueHistory.Dialogues.findIndex(x => x.DialogueName == dialogueName);
|
const index = inventory.DialogueHistory.Dialogues.findIndex(x => x.DialogueName == dialogueName);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { addEmailItem, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { ICompletedDialogue } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { ICompletedDialogue } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
@ -22,10 +21,9 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
|
|||||||
if (!inventory.DialogueHistory) {
|
if (!inventory.DialogueHistory) {
|
||||||
throw new Error("bad inventory state");
|
throw new Error("bad inventory state");
|
||||||
}
|
}
|
||||||
if (request.OtherDialogueInfos.length != 0) {
|
if (request.QueuedDialogues.length != 0 || request.OtherDialogueInfos.length != 0) {
|
||||||
logger.error(`saveDialogue request not fully handled: ${String(req.body)}`);
|
logger.error(`saveDialogue request not fully handled: ${String(req.body)}`);
|
||||||
}
|
}
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
|
||||||
inventory.DialogueHistory.Dialogues ??= [];
|
inventory.DialogueHistory.Dialogues ??= [];
|
||||||
let dialogue = inventory.DialogueHistory.Dialogues.find(x => x.DialogueName == request.DialogueName);
|
let dialogue = inventory.DialogueHistory.Dialogues.find(x => x.DialogueName == request.DialogueName);
|
||||||
if (!dialogue) {
|
if (!dialogue) {
|
||||||
@ -38,7 +36,6 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
|
|||||||
AvailableGiftDate: new Date(0),
|
AvailableGiftDate: new Date(0),
|
||||||
RankUpExpiry: new Date(0),
|
RankUpExpiry: new Date(0),
|
||||||
BountyChemExpiry: new Date(0),
|
BountyChemExpiry: new Date(0),
|
||||||
QueuedDialogues: [],
|
|
||||||
Gifts: [],
|
Gifts: [],
|
||||||
Booleans: [],
|
Booleans: [],
|
||||||
Completed: [],
|
Completed: [],
|
||||||
@ -48,16 +45,9 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
dialogue.Rank = request.Rank;
|
dialogue.Rank = request.Rank;
|
||||||
dialogue.Chemistry = request.Chemistry;
|
dialogue.Chemistry = request.Chemistry;
|
||||||
dialogue.QueuedDialogues = request.QueuedDialogues;
|
//dialogue.QueuedDialogues = request.QueuedDialogues;
|
||||||
for (const bool of request.Booleans) {
|
for (const bool of request.Booleans) {
|
||||||
dialogue.Booleans.push(bool);
|
dialogue.Booleans.push(bool);
|
||||||
if (bool == "LizzieShawzin") {
|
|
||||||
await addEmailItem(
|
|
||||||
inventory,
|
|
||||||
"/Lotus/Types/Items/EmailItems/LizzieShawzinSkinEmailItem",
|
|
||||||
inventoryChanges
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (const bool of request.ResetBooleans) {
|
for (const bool of request.ResetBooleans) {
|
||||||
const index = dialogue.Booleans.findIndex(x => x == bool);
|
const index = dialogue.Booleans.findIndex(x => x == bool);
|
||||||
@ -70,7 +60,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
|
|||||||
dialogue.AvailableDate = new Date(tomorrowAt0Utc);
|
dialogue.AvailableDate = new Date(tomorrowAt0Utc);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({
|
res.json({
|
||||||
InventoryChanges: inventoryChanges,
|
InventoryChanges: [],
|
||||||
AvailableDate: { $date: { $numberLong: tomorrowAt0Utc.toString() } }
|
AvailableDate: { $date: { $numberLong: tomorrowAt0Utc.toString() } }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -87,7 +77,7 @@ interface SaveCompletedDialogueRequest {
|
|||||||
Rank: number;
|
Rank: number;
|
||||||
Chemistry: number;
|
Chemistry: number;
|
||||||
CompletionType: number;
|
CompletionType: number;
|
||||||
QueuedDialogues: string[];
|
QueuedDialogues: string[]; // unsure
|
||||||
Booleans: string[];
|
Booleans: string[];
|
||||||
ResetBooleans: string[];
|
ResetBooleans: string[];
|
||||||
Data: ICompletedDialogue;
|
Data: ICompletedDialogue;
|
||||||
|
@ -5,7 +5,7 @@ import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
|||||||
import { ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
export interface IMessageClient
|
export interface IMessageClient
|
||||||
extends Omit<IMessageDatabase, "_id" | "date" | "startDate" | "endDate" | "ownerId" | "attVisualOnly"> {
|
extends Omit<IMessageDatabase, "_id" | "date" | "startDate" | "endDate" | "ownerId" | "attVisualOnly" | "expiry"> {
|
||||||
_id?: IOid;
|
_id?: IOid;
|
||||||
date: IMongoDate;
|
date: IMongoDate;
|
||||||
startDate?: IMongoDate;
|
startDate?: IMongoDate;
|
||||||
@ -16,6 +16,8 @@ export interface IMessageClient
|
|||||||
export interface IMessageDatabase extends IMessage {
|
export interface IMessageDatabase extends IMessage {
|
||||||
ownerId: Types.ObjectId;
|
ownerId: Types.ObjectId;
|
||||||
date: Date; //created at
|
date: Date; //created at
|
||||||
|
attVisualOnly?: boolean;
|
||||||
|
expiry?: Date;
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +32,6 @@ export interface IMessage {
|
|||||||
endDate?: Date;
|
endDate?: Date;
|
||||||
att?: string[];
|
att?: string[];
|
||||||
countedAtt?: ITypeCount[];
|
countedAtt?: ITypeCount[];
|
||||||
attVisualOnly?: boolean;
|
|
||||||
transmission?: string;
|
transmission?: string;
|
||||||
arg?: Arg[];
|
arg?: Arg[];
|
||||||
gifts?: IGift[];
|
gifts?: IGift[];
|
||||||
@ -137,14 +138,14 @@ messageSchema.virtual("messageId").get(function (this: IMessageDatabase) {
|
|||||||
messageSchema.set("toJSON", {
|
messageSchema.set("toJSON", {
|
||||||
virtuals: true,
|
virtuals: true,
|
||||||
transform(_document, returnedObject) {
|
transform(_document, returnedObject) {
|
||||||
delete returnedObject.ownerId;
|
|
||||||
|
|
||||||
const messageDatabase = returnedObject as IMessageDatabase;
|
const messageDatabase = returnedObject as IMessageDatabase;
|
||||||
const messageClient = returnedObject as IMessageClient;
|
const messageClient = returnedObject as IMessageClient;
|
||||||
|
|
||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
delete returnedObject.__v;
|
delete returnedObject.__v;
|
||||||
|
delete returnedObject.ownerId;
|
||||||
delete returnedObject.attVisualOnly;
|
delete returnedObject.attVisualOnly;
|
||||||
|
delete returnedObject.expiry;
|
||||||
|
|
||||||
messageClient.date = toMongoDate(messageDatabase.date);
|
messageClient.date = toMongoDate(messageDatabase.date);
|
||||||
|
|
||||||
@ -157,5 +158,6 @@ messageSchema.set("toJSON", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
messageSchema.index({ ownerId: 1 });
|
messageSchema.index({ ownerId: 1 });
|
||||||
|
messageSchema.index({ expiry: 1 }, { expireAfterSeconds: 0 });
|
||||||
|
|
||||||
export const Inbox = model<IMessageDatabase>("Inbox", messageSchema, "inbox");
|
export const Inbox = model<IMessageDatabase>("Inbox", messageSchema, "inbox");
|
||||||
|
@ -773,7 +773,7 @@ const dialogueSchema = new Schema<IDialogueDatabase>(
|
|||||||
AvailableGiftDate: Date,
|
AvailableGiftDate: Date,
|
||||||
RankUpExpiry: Date,
|
RankUpExpiry: Date,
|
||||||
BountyChemExpiry: Date,
|
BountyChemExpiry: Date,
|
||||||
QueuedDialogues: { type: [String], default: [] },
|
//QueuedDialogues: ???
|
||||||
Gifts: { type: [dialogueGiftSchema], default: [] },
|
Gifts: { type: [dialogueGiftSchema], default: [] },
|
||||||
Booleans: { type: [String], default: [] },
|
Booleans: { type: [String], default: [] },
|
||||||
Completed: { type: [completedDialogueSchema], default: [] },
|
Completed: { type: [completedDialogueSchema], default: [] },
|
||||||
@ -797,7 +797,6 @@ dialogueSchema.set("toJSON", {
|
|||||||
const dialogueHistorySchema = new Schema<IDialogueHistoryDatabase>(
|
const dialogueHistorySchema = new Schema<IDialogueHistoryDatabase>(
|
||||||
{
|
{
|
||||||
YearIteration: { type: Number, required: true },
|
YearIteration: { type: Number, required: true },
|
||||||
Resets: Number,
|
|
||||||
Dialogues: { type: [dialogueSchema], required: false }
|
Dialogues: { type: [dialogueSchema], required: false }
|
||||||
},
|
},
|
||||||
{ _id: false }
|
{ _id: false }
|
||||||
|
@ -1014,14 +1014,12 @@ export const addCustomization = (
|
|||||||
customizationName: string,
|
customizationName: string,
|
||||||
inventoryChanges: IInventoryChanges = {}
|
inventoryChanges: IInventoryChanges = {}
|
||||||
): IInventoryChanges => {
|
): IInventoryChanges => {
|
||||||
if (!inventory.FlavourItems.find(x => x.ItemType == customizationName)) {
|
const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizationName }) - 1;
|
||||||
const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizationName }) - 1;
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
inventoryChanges.FlavourItems ??= [];
|
||||||
inventoryChanges.FlavourItems ??= [];
|
(inventoryChanges.FlavourItems as IFlavourItem[]).push(
|
||||||
(inventoryChanges.FlavourItems as IFlavourItem[]).push(
|
inventory.FlavourItems[flavourItemIndex].toJSON<IFlavourItem>()
|
||||||
inventory.FlavourItems[flavourItemIndex].toJSON<IFlavourItem>()
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -372,10 +372,10 @@ export const addMissionInventoryUpdates = async (
|
|||||||
sndr: "/Lotus/Language/G1Quests/DeathMarkSender",
|
sndr: "/Lotus/Language/G1Quests/DeathMarkSender",
|
||||||
msg: "/Lotus/Language/G1Quests/DeathMarkMessage",
|
msg: "/Lotus/Language/G1Quests/DeathMarkMessage",
|
||||||
icon: "/Lotus/Interface/Icons/Npcs/Stalker_d.png",
|
icon: "/Lotus/Interface/Icons/Npcs/Stalker_d.png",
|
||||||
highPriority: true
|
highPriority: true,
|
||||||
|
expiry: new Date(Date.now() + 86400_000) // TOVERIFY: This type of inbox message seems to automatically delete itself. We'll just delete it after 24 hours, but it's clear if this is correct.
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
// TODO: This type of inbox message seems to automatically delete itself. Figure out under which conditions.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inventory.DeathMarks = value;
|
inventory.DeathMarks = value;
|
||||||
|
@ -1074,13 +1074,11 @@ export interface IEndlessXpProgress {
|
|||||||
|
|
||||||
export interface IDialogueHistoryClient {
|
export interface IDialogueHistoryClient {
|
||||||
YearIteration: number;
|
YearIteration: number;
|
||||||
Resets?: number; // added in 38.5.0
|
|
||||||
Dialogues?: IDialogueClient[];
|
Dialogues?: IDialogueClient[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDialogueHistoryDatabase {
|
export interface IDialogueHistoryDatabase {
|
||||||
YearIteration: number;
|
YearIteration: number;
|
||||||
Resets?: number;
|
|
||||||
Dialogues?: IDialogueDatabase[];
|
Dialogues?: IDialogueDatabase[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1091,7 +1089,7 @@ export interface IDialogueClient {
|
|||||||
AvailableGiftDate: IMongoDate;
|
AvailableGiftDate: IMongoDate;
|
||||||
RankUpExpiry: IMongoDate;
|
RankUpExpiry: IMongoDate;
|
||||||
BountyChemExpiry: IMongoDate;
|
BountyChemExpiry: IMongoDate;
|
||||||
QueuedDialogues: string[];
|
//QueuedDialogues: any[];
|
||||||
Gifts: IDialogueGift[];
|
Gifts: IDialogueGift[];
|
||||||
Booleans: string[];
|
Booleans: string[];
|
||||||
Completed: ICompletedDialogue[];
|
Completed: ICompletedDialogue[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user