give the blueprint when creating a guild

This commit is contained in:
Sainan 2025-03-10 17:58:53 +01:00
parent d468078b2e
commit fd329f78f1

View File

@ -3,6 +3,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers";
import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
import { Guild, GuildMember } from "@/src/models/guildModel"; import { Guild, GuildMember } from "@/src/models/guildModel";
import { addRecipes } from "@/src/services/inventoryService";
export const createGuildController: RequestHandler = async (req, res) => { export const createGuildController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
@ -28,11 +29,13 @@ export const createGuildController: RequestHandler = async (req, res) => {
// Set GuildId // Set GuildId
inventory.GuildId = guild._id; inventory.GuildId = guild._id;
// Give clan key (TODO: This should only be a blueprint) // Give clan key blueprint
inventory.LevelKeys.push({ addRecipes(inventory, [
ItemType: "/Lotus/Types/Keys/DojoKey", {
ItemCount: 1 ItemType: "/Lotus/Types/Keys/DojoKeyBlueprint",
}); ItemCount: 1
}
]);
await inventory.save(); await inventory.save();
} }