notherbase-fs 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "main": "notherbase-fs.js",
6
6
  "scripts": {
@@ -4,7 +4,6 @@ module.exports = async function addToTimer(db, route, user, params) {
4
4
 
5
5
  let now = Date.now();
6
6
 
7
- console.log(poi.data);
8
7
  if (!poi.data) poi.data = {
9
8
  timer: 0,
10
9
  lastTime: now
@@ -13,13 +12,11 @@ module.exports = async function addToTimer(db, route, user, params) {
13
12
  if (!poi.data.lastTime) poi.data.lastTime = now;
14
13
  if (!poi.data.timer) poi.data.timer = 0;
15
14
  }
16
- console.log(poi.data);
17
15
 
18
16
  let difference = (now - poi.data.lastTime) / 1000;
19
17
  poi.data.timer -= difference;
20
18
  if (poi.data.timer < 0) poi.data.timer = 0;
21
19
 
22
- console.log(poi.data);
23
20
  poi.data.timer = poi.data.timer + 10;
24
21
  poi.data.lastTime = Date.now();
25
22
 
@@ -149,6 +149,16 @@
149
149
  });
150
150
  }
151
151
  }
152
+
153
+ hasItem(itemName, minAmount = 1) {
154
+ for (let i = 0; i < this.items.length; i++) {
155
+ if (this.items[i].item.name === itemName) {
156
+ if (this.items[i].amount >= minAmount) return true;
157
+ }
158
+ }
159
+
160
+ return false;
161
+ }
152
162
  }
153
163
 
154
164
  let playerInventory = new Inventory();