notherbase-fs 3.0.3 → 3.0.5

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.
@@ -43,10 +43,6 @@ export default class Creation {
43
43
  main += `/${req.params.region}/${req.params.area}/${req.params.poi}/index`;
44
44
  siteTitle += req.params.poi;
45
45
  }
46
- else if (req.params.page) {
47
- main += `/${req.params.page}/index`;
48
- siteTitle = req.params.page;
49
- }
50
46
  else {
51
47
  main += `/the-front/index`;
52
48
  siteTitle += "the-front";
package/models/user.js CHANGED
@@ -99,18 +99,14 @@ export default class User extends Spirit {
99
99
  }
100
100
 
101
101
  offsetItem = async (name, offset) => {
102
- let item = Item.recallOne(name);
102
+ let item = await Item.recallOne(name);
103
103
 
104
- if (!item) return "Item not found in database.";
104
+ if (!item) return false;
105
105
 
106
106
  let inv = this.memory.data.inventory;
107
-
108
- let holding = false;
109
-
107
+
110
108
  for (let j = 0; j < inv.length; j++) {
111
109
  if (inv[j].name === name) {
112
- holding = true;
113
-
114
110
  if (inv[j].amount >= -Math.floor(offset)) {
115
111
  inv[j].amount += Math.floor(offset);
116
112
 
@@ -118,44 +114,29 @@ export default class User extends Spirit {
118
114
  let empty = inv[j];
119
115
 
120
116
  inv.splice(j, 1);
121
-
122
- this.memory._lastUpdate = Date.now();
123
- await this.commit();
124
-
125
- return "Item emptied.";
126
- }
127
- else {
128
- this.memory._lastUpdate = Date.now();
129
- await this.commit();
130
-
131
- return inv[j];
132
117
  }
118
+
119
+ this.memory._lastUpdate = Date.now();
120
+ await this.commit();
121
+ return true;
133
122
  }
134
- else {
135
- return `Unable to remove ${-offset} ${name}
136
- from inventory because the inventory has only ${inv[j].amount}.`;
137
- }
123
+ else return false;
138
124
  }
139
125
  }
140
126
 
141
- if (!holding) {
142
- if (offset > 0) {
143
- inv.push({
144
- name: name,
145
- amount: offset
146
- });
147
-
148
- this.memory._lastUpdate = Date.now();
149
-
150
- await this.commit();
151
-
152
- return inv[inv.length - 1];
153
- }
154
- else {
155
- return `Unable to remove ${-offset} ${name}
156
- from inventory because the inventory has none.`;
157
- }
158
- };
127
+ if (offset > 0) {
128
+ inv.push({
129
+ name: name,
130
+ amount: offset
131
+ });
132
+
133
+ this.memory._lastUpdate = Date.now();
134
+
135
+ await this.commit();
136
+
137
+ return true;
138
+ }
139
+ else return false;
159
140
  }
160
141
 
161
142
  checkAttribute = async (check, against) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "exports": "./notherbase-fs.js",
6
6
  "scripts": {