feat: Give user a clan key when creating a clan
This commit is contained in:
parent
e2c378b6a9
commit
2c0f69abbb
@ -18,10 +18,19 @@ const createGuildController: RequestHandler = async (req, res) => {
|
|||||||
} satisfies IGuild);
|
} satisfies IGuild);
|
||||||
await guild.save();
|
await guild.save();
|
||||||
|
|
||||||
// Update account's guild
|
// Update inventory
|
||||||
let inventory = await Inventory.findOne({ accountOwnerId: req.query.accountId });
|
let inventory = await Inventory.findOne({ accountOwnerId: req.query.accountId });
|
||||||
if (inventory) {
|
if (inventory) {
|
||||||
|
// Set GuildId
|
||||||
inventory.GuildId = guild._id;
|
inventory.GuildId = guild._id;
|
||||||
|
|
||||||
|
// Give clan key
|
||||||
|
inventory.LevelKeys ??= [];
|
||||||
|
inventory.LevelKeys.push({
|
||||||
|
ItemType: "/Lotus/Types/Keys/DojoKey",
|
||||||
|
ItemCount: 1
|
||||||
|
});
|
||||||
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user