fix some stuff
All checks were successful
Build / build (18) (push) Successful in 35s
Build / build (20) (push) Successful in 49s
Build / build (18) (pull_request) Successful in 36s
Build / build (20) (pull_request) Successful in 51s
Build / build (22) (pull_request) Successful in 26s
Build / build (22) (push) Successful in 27s
All checks were successful
Build / build (18) (push) Successful in 35s
Build / build (20) (push) Successful in 49s
Build / build (18) (pull_request) Successful in 36s
Build / build (20) (pull_request) Successful in 51s
Build / build (22) (pull_request) Successful in 26s
Build / build (22) (push) Successful in 27s
This commit is contained in:
parent
af6a466948
commit
49b702df2e
@ -5,6 +5,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||
import { updateQuestKey, IUpdateQuestRequest } from "@/src/services/questService";
|
||||
import { getQuestCompletionItems } from "@/src/services/itemDataService";
|
||||
import { addItems, getInventory } from "@/src/services/inventoryService";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const updateQuestController: RequestHandler = async (req, res) => {
|
||||
@ -18,6 +19,9 @@ export const updateQuestController: RequestHandler = async (req, res) => {
|
||||
|
||||
const inventory = await getInventory(accountId);
|
||||
|
||||
const updateQuestResponse: { CustomData?: string; InventoryChanges?: IInventoryChanges; MissionRewards: [] } = {
|
||||
MissionRewards: []
|
||||
};
|
||||
updateQuestKey(inventory, updateQuestRequest.QuestKeys);
|
||||
|
||||
if (updateQuestRequest.QuestKeys[0].Completed) {
|
||||
@ -28,12 +32,15 @@ export const updateQuestController: RequestHandler = async (req, res) => {
|
||||
|
||||
const inventoryChanges = await addItems(inventory, questCompletionItems);
|
||||
inventory.ActiveQuest = "";
|
||||
await inventory.save();
|
||||
|
||||
res.json({ MissionRewards: [], inventoryChanges });
|
||||
return;
|
||||
updateQuestResponse.InventoryChanges = inventoryChanges;
|
||||
}
|
||||
|
||||
//TODO: might need to parse the custom data and add the associated items to inventory
|
||||
if (updateQuestRequest.QuestKeys[0].CustomData) {
|
||||
updateQuestResponse.CustomData = updateQuestRequest.QuestKeys[0].CustomData;
|
||||
}
|
||||
|
||||
await inventory.save();
|
||||
res.send({ MissionRewards: [] });
|
||||
res.send(updateQuestResponse);
|
||||
};
|
||||
|
@ -494,7 +494,7 @@ const questKeysSchema = new Schema<IQuestKeyDatabase>(
|
||||
Progress: { type: [questProgressSchema], default: undefined },
|
||||
unlock: Boolean,
|
||||
Completed: Boolean,
|
||||
//CustomData: Schema.Types.Mixed,
|
||||
CustomData: String,
|
||||
CompletionDate: Date,
|
||||
ItemType: String
|
||||
},
|
||||
|
@ -28,6 +28,7 @@ export const updateQuestKey = (
|
||||
throw new Error(`quest key ${questKeyUpdate[0].ItemType} not found`);
|
||||
}
|
||||
|
||||
console.log(questKeyUpdate[0]);
|
||||
inventory.QuestKeys[questKeyIndex] = questKeyUpdate[0];
|
||||
|
||||
if (questKeyUpdate[0].Completed) {
|
||||
|
@ -86,7 +86,7 @@ export interface IQuestKeyDatabase {
|
||||
Progress?: IQuestStage[];
|
||||
unlock?: boolean;
|
||||
Completed?: boolean;
|
||||
CustomData?: string; //TODO: check whether this actually exists
|
||||
CustomData?: string;
|
||||
ItemType: string;
|
||||
CompletionDate?: Date;
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import {
|
||||
TSolarMapRegion,
|
||||
TEquipmentKey,
|
||||
IFusionTreasure,
|
||||
IQuestKeyClient,
|
||||
IPlayerSkills
|
||||
IPlayerSkills,
|
||||
IQuestKeyDatabase
|
||||
} from "./inventoryTypes/inventoryTypes";
|
||||
|
||||
export interface IThemeUpdateRequest {
|
||||
@ -46,7 +46,7 @@ export type IMissionInventoryUpdateRequest = {
|
||||
Consumables?: ITypeCount[];
|
||||
FusionTreasures?: IFusionTreasure[];
|
||||
Recipes?: ITypeCount[];
|
||||
QuestKeys?: IQuestKeyClient[];
|
||||
QuestKeys?: Omit<IQuestKeyDatabase, "CompletionDate">[];
|
||||
RegularCredits?: number;
|
||||
MissionFailed: boolean;
|
||||
MissionStatus: IMissionStatus;
|
||||
|
Loading…
x
Reference in New Issue
Block a user