feat: nightcap syndicate #2934

Merged
Sainan merged 6 commits from AMelonInsideLemon/SpaceNinjaServer:nightcap-syndicate into main 2025-10-25 00:26:37 -07:00
Showing only changes of commit 6fd7967b4f - Show all commits

View File

@ -6,24 +6,40 @@ import { logger } from "../../utils/logger.ts";
export const feedPrinceController: RequestHandler = async (req, res) => { export const feedPrinceController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "MiscItems NokkoColony"); const inventory = await getInventory(accountId, "MiscItems NokkoColony NodeIntrosCompleted");
const payload = getJSONfromString<IFeedPrinceRequest>(String(req.body)); const payload = getJSONfromString<IFeedPrinceRequest>(String(req.body));
switch (payload.Mode) { switch (payload.Mode) {
case "r": { case "r": {
const InventoryChanges = {};
addMiscItem(inventory, "/Lotus/Types/Items/MiscItems/MushroomFood", payload.Amount * -1, InventoryChanges);
inventory.NokkoColony ??= { inventory.NokkoColony ??= {
FeedLevel: 0, FeedLevel: 0,
JournalEntries: [] JournalEntries: []
}; };
const InventoryChanges = {};
inventory.NokkoColony.FeedLevel += payload.Amount; inventory.NokkoColony.FeedLevel += payload.Amount;
await inventory.save(); if (
res.json({ (!inventory.NodeIntrosCompleted.includes("CompletedVision1") && inventory.NokkoColony.FeedLevel > 20) ||
FeedSucceeded: true, (!inventory.NodeIntrosCompleted.includes("CompletedVision2") && inventory.NokkoColony.FeedLevel > 60)
FeedLevel: inventory.NokkoColony.FeedLevel, ) {
InventoryChanges res.json({
}); FeedSucceeded: false,
FeedLevel: inventory.NokkoColony.FeedLevel - payload.Amount,
InventoryChanges
});
} else {
addMiscItem(
inventory,
"/Lotus/Types/Items/MiscItems/MushroomFood",
payload.Amount * -1,
InventoryChanges
);
await inventory.save();
res.json({
FeedSucceeded: true,
FeedLevel: inventory.NokkoColony.FeedLevel,
InventoryChanges
});
}
break; break;
} }