From e97e0017da6433a0b13f09f740788e4cf721b7ef Mon Sep 17 00:00:00 2001 From: holly Date: Sun, 17 Oct 2021 00:52:21 +0100 Subject: [PATCH] Inventory base --- server/Inventories/Inventory.js | 23 +++++++++++++++++++++++ server/ItemStack.js | 10 ++++++++++ 2 files changed, 33 insertions(+) create mode 100644 server/Inventories/Inventory.js create mode 100644 server/ItemStack.js diff --git a/server/Inventories/Inventory.js b/server/Inventories/Inventory.js new file mode 100644 index 0000000..893d3f9 --- /dev/null +++ b/server/Inventories/Inventory.js @@ -0,0 +1,23 @@ +const ItemStack = require("../ItemStack.js"); + +module.exports = class { + constructor() { + this.Slots = {}; + } + + saveData() { + + } + + loadData() { + + } + + getSlot(slot = 0) { + return this.Slots[slot]; // If the slot doesn't exist well sucks to be you I guess! Haha :Þ + } + + setSlot(slot = 0, itemStack = new ItemStack) { + this.Slots[slot] = itemStack; + } +} \ No newline at end of file diff --git a/server/ItemStack.js b/server/ItemStack.js new file mode 100644 index 0000000..de90af0 --- /dev/null +++ b/server/ItemStack.js @@ -0,0 +1,10 @@ +module.exports = class { + constructor(id, count) { + this.id = id; + this.count = count; + } + + updateCount(count) { + this.count += count; + } +} \ No newline at end of file