mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 15:26:58 +01:00
inventory system now functional, TODO: add mbucks cmds, allow item usage
This commit is contained in:
9
src/items/lootbox.ts
Normal file
9
src/items/lootbox.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { getInventory, updateInventory } from "../lib/userHelper";
|
||||
|
||||
export async function changeLootboxCount(username: string, amount = -1): Promise<itemChangeResult> {
|
||||
let inv = await getInventory(username)
|
||||
if (amount < 0 && inv.lootbox+ amount < 0) return {result: false, count: inv.lootbox}
|
||||
inv.lootbox += amount
|
||||
await updateInventory(username, inv)
|
||||
return {result: true, count: inv.lootbox}
|
||||
}
|
||||
Reference in New Issue
Block a user