dumdum
This commit is contained in:
parent
1750cac9d6
commit
6c9515a34d
@ -52,12 +52,10 @@ import { getInventory } from "@/src/services/inventoryService";
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
|
export const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
|
||||||
const missionReport = getJSONfromString<IMissionInventoryUpdateRequest>((req.body as string).toString());
|
const missionReport = getJSONfromString<IMissionInventoryUpdateRequest>((req.body as string).toString());
|
||||||
|
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
const inventoryUpdates = addMissionInventoryUpdates(inventory, missionReport);
|
||||||
const missionRewardsResults = await addMissionRewards(inventory, missionReport);
|
|
||||||
|
|
||||||
if (missionReport.MissionStatus !== "GS_SUCCESS") {
|
if (missionReport.MissionStatus !== "GS_SUCCESS") {
|
||||||
const InventoryJson = JSON.stringify((await inventory.save()).toJSON());
|
const InventoryJson = JSON.stringify((await inventory.save()).toJSON());
|
||||||
@ -65,15 +63,12 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
|||||||
res.json({ InventoryJson, MissionRewards: [] });
|
res.json({ InventoryJson, MissionRewards: [] });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const missionRewardsResults = await addMissionRewards(inventory, missionReport);
|
||||||
if (!missionRewardsResults) {
|
if (!missionRewardsResults) {
|
||||||
throw new Error("Failed to add mission rewards, should not happen");
|
throw new Error("Failed to add mission rewards, should not happen");
|
||||||
}
|
}
|
||||||
|
|
||||||
const { MissionRewards, inventoryChanges, missionCompletionCredits } = missionRewardsResults;
|
const { MissionRewards, inventoryChanges, missionCompletionCredits } = missionRewardsResults;
|
||||||
|
|
||||||
const inventoryUpdates = addMissionInventoryUpdates(inventory, missionReport);
|
|
||||||
|
|
||||||
//creditBonus is not correct for mirage mission 3
|
//creditBonus is not correct for mirage mission 3
|
||||||
const credits = calculateFinalCredits(inventory, {
|
const credits = calculateFinalCredits(inventory, {
|
||||||
missionCompletionCredits,
|
missionCompletionCredits,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user