notherbase-fs 1.2.12 → 1.2.15
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/controllers/inventory.js +58 -55
- package/controllers/item.js +24 -14
- package/controllers/pages.js +0 -1
- package/controllers/the-front.js +1 -1
- package/package.json +1 -1
- package/test/coast/tall-beach/nono-cove/local-scripts/items.js +162 -0
- package/test/coast/tall-beach/nono-cove/styles/items-floor.css +92 -0
- package/test/coast/tall-beach/nono-cove/views/index.ejs +44 -0
- package/test/test-index.js +5 -2
- package/test/views/index.ejs +6 -0
- package/views/head.ejs +0 -1
- package/views/inventory.ejs +8 -3
- package/public/styles/portfolio.css +0 -468
package/controllers/inventory.js
CHANGED
|
@@ -29,73 +29,76 @@ router.get("/", async function(req, res) {
|
|
|
29
29
|
router.post("/", async function(req, res) {
|
|
30
30
|
if (connectionSuccess) {
|
|
31
31
|
try {
|
|
32
|
-
if (req.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let holding = false;
|
|
36
|
-
|
|
37
|
-
for (let j = 0; j < foundInventory.items.length; j++) {
|
|
38
|
-
if (foundInventory.items[j].item._id.equals(req.body.change.item)) {
|
|
39
|
-
holding = true;
|
|
40
|
-
|
|
41
|
-
if (foundInventory.items[j].amount >= -Math.floor(req.body.change.amount)) {
|
|
42
|
-
foundInventory.items[j].amount += Math.floor(req.body.change.amount);
|
|
43
|
-
|
|
44
|
-
if (foundInventory.items[j].amount === 0) {
|
|
45
|
-
let itemToEmpty = foundInventory.items[j].item._id;
|
|
46
|
-
|
|
47
|
-
foundInventory.items.splice(j, 1);
|
|
48
|
-
await foundInventory.save();
|
|
32
|
+
if (req.body.item && req.body.amount) {
|
|
33
|
+
if (req.session.currentUser) {
|
|
34
|
+
let foundInventory = await inventory.findOne({user: req.session.currentUser}).populate("items.item");
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
let holding = false;
|
|
37
|
+
|
|
38
|
+
for (let j = 0; j < foundInventory.items.length; j++) {
|
|
39
|
+
if (foundInventory.items[j].item._id.equals(req.body.item)) {
|
|
40
|
+
holding = true;
|
|
41
|
+
|
|
42
|
+
if (foundInventory.items[j].amount >= -Math.floor(req.body.amount)) {
|
|
43
|
+
foundInventory.items[j].amount += Math.floor(req.body.amount);
|
|
44
|
+
|
|
45
|
+
if (foundInventory.items[j].amount === 0) {
|
|
46
|
+
let itemToEmpty = foundInventory.items[j].item._id;
|
|
47
|
+
|
|
48
|
+
foundInventory.items.splice(j, 1);
|
|
49
|
+
await foundInventory.save();
|
|
50
|
+
|
|
51
|
+
res.status(200).send({
|
|
52
|
+
item: itemToEmpty,
|
|
53
|
+
amount: 0
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
await foundInventory.save();
|
|
58
|
+
|
|
59
|
+
res.status(200).send(foundInventory.items[j]);
|
|
60
|
+
}
|
|
56
61
|
}
|
|
57
62
|
else {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
console.log("subtract from too few", req.change);
|
|
64
|
+
res.status(304).send(
|
|
65
|
+
`Unable to remove ${req.body.amount} ${req.body.item}
|
|
66
|
+
from inventory because the inventory has only ${foundInventory.items[j].amount}.`
|
|
67
|
+
);
|
|
61
68
|
}
|
|
69
|
+
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!holding) {
|
|
75
|
+
if (req.body.amount > 0) {
|
|
76
|
+
foundInventory.items.push({
|
|
77
|
+
item: req.body.item,
|
|
78
|
+
amount: req.body.amount
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await foundInventory.save();
|
|
82
|
+
|
|
83
|
+
await inventory.populate(foundInventory, "items.item");
|
|
84
|
+
|
|
85
|
+
res.status(200).send(foundInventory.items[foundInventory.items.length - 1]);
|
|
62
86
|
}
|
|
63
87
|
else {
|
|
64
|
-
console.log("subtract from
|
|
88
|
+
console.log("subtract from none", req.body);
|
|
65
89
|
res.status(304).send(
|
|
66
|
-
`Unable to remove ${req.body.
|
|
67
|
-
from inventory because the inventory has
|
|
90
|
+
`Unable to remove ${req.body.amount} ${req.body.item}
|
|
91
|
+
from inventory because the inventory has none.`
|
|
68
92
|
);
|
|
69
93
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
res.status(401).send("User not logged in!");
|
|
73
98
|
}
|
|
74
|
-
|
|
75
|
-
if (!holding) {
|
|
76
|
-
if (req.body.change.amount > 0) {
|
|
77
|
-
foundInventory.items.push({
|
|
78
|
-
item: req.body.change.item,
|
|
79
|
-
amount: req.body.change.amount
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
await foundInventory.save();
|
|
83
|
-
|
|
84
|
-
await inventory.populate(foundInventory, "items.item");
|
|
85
|
-
|
|
86
|
-
res.status(200).send(foundInventory.items[foundInventory.items.length - 1]);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
console.log("subtract from none", req.body.change);
|
|
90
|
-
res.status(304).send(
|
|
91
|
-
`Unable to remove ${req.body.change.amount} ${req.body.change.item}
|
|
92
|
-
from inventory because the inventory has none.`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
99
|
}
|
|
97
100
|
else {
|
|
98
|
-
res.status(
|
|
101
|
+
res.status(400).send("Check input!");
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
catch(err) {
|
package/controllers/item.js
CHANGED
|
@@ -16,12 +16,11 @@ router.get("/all", async function(req, res) {
|
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
router.get("/
|
|
19
|
+
router.get("/", async function(req, res) {
|
|
20
20
|
try {
|
|
21
|
-
let foundItem = await items.findOne({name: req.query.name});
|
|
21
|
+
let foundItem = await items.findOne({ name: req.query.name });
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
else res.status(200).send({ foundItem: foundItem });
|
|
23
|
+
res.status(200).send({ foundItem: foundItem });
|
|
25
24
|
}
|
|
26
25
|
catch(err) {
|
|
27
26
|
res.status(500).end();
|
|
@@ -29,11 +28,27 @@ router.get("/findOne", async function(req, res) {
|
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
30
|
|
|
32
|
-
router.
|
|
31
|
+
router.post("/", async function(req, res) {
|
|
33
32
|
try {
|
|
34
|
-
|
|
33
|
+
if (!req.body.id) {
|
|
34
|
+
await items.create({
|
|
35
|
+
name: req.body.name,
|
|
36
|
+
shortDescription: req.body.shortDescription,
|
|
37
|
+
fullDescription: req.body.fullDescription
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
let foundItem = await items.findById(req.body.id);
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
if (foundItem) {
|
|
44
|
+
foundItem.name = req.body.name;
|
|
45
|
+
foundItem.shortDescription = req.body.shortDescription;
|
|
46
|
+
foundItem.fullDescription = req.body.fullDescription;
|
|
47
|
+
await foundItem.save();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
res.status(200).end();
|
|
37
52
|
}
|
|
38
53
|
catch(err) {
|
|
39
54
|
res.status(500).end();
|
|
@@ -41,13 +56,9 @@ router.get("/", async function(req, res) {
|
|
|
41
56
|
}
|
|
42
57
|
});
|
|
43
58
|
|
|
44
|
-
router.post("/", async function(req, res) {
|
|
59
|
+
router.post("/delete", async function(req, res) {
|
|
45
60
|
try {
|
|
46
|
-
await items.
|
|
47
|
-
name: req.body.name,
|
|
48
|
-
shortDescription: req.body.shortDescription,
|
|
49
|
-
fullDescription: req.body.fullDescription
|
|
50
|
-
});
|
|
61
|
+
await items.findByIdAndDelete(req.body.id);
|
|
51
62
|
|
|
52
63
|
res.status(200).end();
|
|
53
64
|
}
|
|
@@ -57,5 +68,4 @@ router.post("/", async function(req, res) {
|
|
|
57
68
|
}
|
|
58
69
|
});
|
|
59
70
|
|
|
60
|
-
|
|
61
71
|
module.exports = router;
|
package/controllers/pages.js
CHANGED
package/controllers/the-front.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
class ItemFloor {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.items = [];
|
|
4
|
+
this.$itemList = $(".floor#items ul.items");
|
|
5
|
+
this.$items = $(".floor#items ul.items li");
|
|
6
|
+
|
|
7
|
+
this.$read = $(".floor#items .editor .read");
|
|
8
|
+
this.$readName = $(".floor#items .editor .read #name");
|
|
9
|
+
this.$readShort = $(".floor#items .editor .read #short");
|
|
10
|
+
this.$readFull = $(".floor#items .editor .read #full");
|
|
11
|
+
|
|
12
|
+
this.$edit = $(".floor#items .editor .edit");
|
|
13
|
+
this.$editName = $(".floor#items .editor .edit #name");
|
|
14
|
+
this.$editShort = $(".floor#items .editor .edit #short");
|
|
15
|
+
this.$editFull = $(".floor#items .editor .edit #full");
|
|
16
|
+
|
|
17
|
+
this.selected = -1;
|
|
18
|
+
this.state = "reading";
|
|
19
|
+
|
|
20
|
+
this.updateItems();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
hasValidSelection() {
|
|
24
|
+
return (this.selected > -1 && this.selected < this.items.length);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async updateItems() {
|
|
28
|
+
try {
|
|
29
|
+
await $.get(`/item/all`, (data) => {
|
|
30
|
+
this.items = data.foundItems;
|
|
31
|
+
this.renderItemList();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch(err) {
|
|
35
|
+
console.log(err);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
renderItemList() {
|
|
40
|
+
this.$itemList.empty();
|
|
41
|
+
|
|
42
|
+
for (let i = 0; i < this.items.length; i++) {
|
|
43
|
+
$(".floor#items ul.items").append(`<li onClick="itemFloor.selectItem(${i})">${this.items[i].name}</li>`);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
this.$items = $(".floor#items ul.items li");
|
|
47
|
+
this.selectItem(this.selected);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
createNewItem() {
|
|
51
|
+
if (this.state === "reading") {
|
|
52
|
+
this.items.push({
|
|
53
|
+
_id: null,
|
|
54
|
+
name: "New Item",
|
|
55
|
+
shortDescription: "Short Description",
|
|
56
|
+
fullDescription: "Full Description"
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
this.renderItemList();
|
|
60
|
+
this.selectItem(this.items.length - 1);
|
|
61
|
+
this.editSelectedItem();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
selectItem(index) {
|
|
66
|
+
this.$items.removeClass("selected");
|
|
67
|
+
this.selected = index;
|
|
68
|
+
|
|
69
|
+
if (index > -1) {
|
|
70
|
+
$(this.$items[index]).addClass("selected");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.readSelectedItem();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
readSelectedItem() {
|
|
77
|
+
this.cancelEdit();
|
|
78
|
+
|
|
79
|
+
if (this.hasValidSelection()) {
|
|
80
|
+
this.$readName.text(this.items[this.selected].name);
|
|
81
|
+
this.$readShort.text(this.items[this.selected].shortDescription);
|
|
82
|
+
this.$readFull.text(this.items[this.selected].fullDescription);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.$readName.text("Please select an item from the list.");
|
|
86
|
+
this.$readShort.text("");
|
|
87
|
+
this.$readFull.text("");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
editSelectedItem() {
|
|
92
|
+
if (this.hasValidSelection()) {
|
|
93
|
+
if (this.state != "editing") {
|
|
94
|
+
this.$read.addClass("invisible");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.state = "editing";
|
|
98
|
+
this.$edit.removeClass("invisible");
|
|
99
|
+
|
|
100
|
+
this.$editName.val(this.items[this.selected].name);
|
|
101
|
+
this.$editShort.val(this.items[this.selected].shortDescription);
|
|
102
|
+
this.$editFull.val(this.items[this.selected].fullDescription);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async saveSelectedItem() {
|
|
107
|
+
if (this.state === "editing") {
|
|
108
|
+
try {
|
|
109
|
+
await $.post("/item", {
|
|
110
|
+
id: this.items[this.selected]._id,
|
|
111
|
+
name: this.$editName.val(),
|
|
112
|
+
shortDescription: this.$editShort.val(),
|
|
113
|
+
fullDescription: this.$editFull.val(),
|
|
114
|
+
}, () => {
|
|
115
|
+
this.items[this.selected].name = this.$editName.val();
|
|
116
|
+
this.items[this.selected].shortDescription = this.$editShort.val();
|
|
117
|
+
this.items[this.selected].fullDescription = this.$editFull.val();
|
|
118
|
+
this.cancelEdit();
|
|
119
|
+
this.updateItems();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch(err) {
|
|
123
|
+
console.log(err);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
cancelEdit() {
|
|
129
|
+
if (this.state === "editing") {
|
|
130
|
+
this.$edit.addClass("invisible");
|
|
131
|
+
this.$read.removeClass("invisible");
|
|
132
|
+
this.state = "reading";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async deleteSelectedItem() {
|
|
137
|
+
if (this.state === "reading" && this.hasValidSelection()) {
|
|
138
|
+
try {
|
|
139
|
+
await $.post("/item/delete", {
|
|
140
|
+
id: this.items[this.selected]._id
|
|
141
|
+
}, () => {
|
|
142
|
+
this.selectItem(-1);
|
|
143
|
+
this.updateItems();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
catch(err) {
|
|
147
|
+
console.log(err);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
let itemFloor = new ItemFloor();
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
$(".floor button#toggle").on("click", function (e) {
|
|
161
|
+
$(e.target.parentElement).find(".content").toggleClass("invisible");
|
|
162
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--bgColor: rgb(37, 37, 37);
|
|
3
|
+
--bgColorBright: rgb(66, 66, 66);
|
|
4
|
+
--shadowColor: rgb(26, 26, 26);
|
|
5
|
+
--textColor: rgb(185, 135, 69);
|
|
6
|
+
--textColorBright: rgb(221, 181, 130);
|
|
7
|
+
--standardBorder: 1px solid var(--textColor);
|
|
8
|
+
--standardRadius: 5px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.floor#items ul.items {
|
|
12
|
+
width: 40%;
|
|
13
|
+
height: 800px;
|
|
14
|
+
border: var(--standardBorder);
|
|
15
|
+
padding: 5px;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.floor#items ul.items li {
|
|
20
|
+
list-style: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.floor#items ul.items li:hover {
|
|
25
|
+
background-color: var(--bgColorBright);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.floor#items ul.items li.selected {
|
|
29
|
+
background-color: var(--shadowColor);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.floor#items .editor {
|
|
33
|
+
width: 55%;
|
|
34
|
+
height: 800px;
|
|
35
|
+
border: var(--standardBorder);
|
|
36
|
+
padding: 10px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.floor#items .read h5 {
|
|
40
|
+
margin: 10px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.floor#items .read #name {
|
|
44
|
+
margin: 20px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.floor#items .read #short {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100px;
|
|
50
|
+
border: var(--standardBorder);
|
|
51
|
+
padding: 2px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.floor#items .read #full {
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 250px;
|
|
57
|
+
border: var(--standardBorder);
|
|
58
|
+
padding: 2px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.floor#items .edit h5 {
|
|
62
|
+
margin: 10px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
.floor {
|
|
67
|
+
width: 100%;
|
|
68
|
+
min-height: 50px;
|
|
69
|
+
border: 1px solid var(--shadowColor);
|
|
70
|
+
background-color: var(--bgColor);
|
|
71
|
+
padding: 10px;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: flex-start;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.floor h2 {
|
|
79
|
+
width: 90%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.floor button {
|
|
83
|
+
margin: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.floor .content {
|
|
87
|
+
width: 100%;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: flex-start;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
flex-wrap: wrap;
|
|
92
|
+
}
|
|
@@ -11,6 +11,50 @@
|
|
|
11
11
|
|
|
12
12
|
<hr>
|
|
13
13
|
|
|
14
|
+
<section class="floor" id="items">
|
|
15
|
+
<h2>Items</h2>
|
|
16
|
+
<button id="toggle">Toggle</button>
|
|
17
|
+
|
|
18
|
+
<div class="content invisible">
|
|
19
|
+
<ul class="items">
|
|
20
|
+
|
|
21
|
+
</ul>
|
|
22
|
+
|
|
23
|
+
<div class="editor">
|
|
24
|
+
<div class="edit invisible">
|
|
25
|
+
<h5>Item Name:</h5>
|
|
26
|
+
<input type="text" id="name">
|
|
27
|
+
|
|
28
|
+
<h5>Short Item Description:</h5>
|
|
29
|
+
<textarea id="short" name="short" cols="30" rows="3"></textarea>
|
|
30
|
+
|
|
31
|
+
<h5>Full Item Description:</h5>
|
|
32
|
+
<textarea id="full" name="full" cols="30" rows="10"></textarea>
|
|
33
|
+
|
|
34
|
+
<button id="cancel" onclick="itemFloor.cancelEdit()">Cancel</button>
|
|
35
|
+
<button id="save" onclick="itemFloor.saveSelectedItem()">Save</button>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div class="read">
|
|
39
|
+
<h5 id="name">Item Name</h5>
|
|
40
|
+
|
|
41
|
+
<h5>Short Item Description:</h5>
|
|
42
|
+
<p id="short"></p>
|
|
43
|
+
|
|
44
|
+
<h5>Full Item Description:</h5>
|
|
45
|
+
<p id="full"></p>
|
|
46
|
+
|
|
47
|
+
<button id="new" onclick="itemFloor.createNewItem()">Create New</button>
|
|
48
|
+
<button id="edit" onclick="itemFloor.editSelectedItem()">Edit</button>
|
|
49
|
+
<button id="delete" onclick="itemFloor.deleteSelectedItem()">Delete</button>
|
|
50
|
+
<button id="refresh" onclick="itemFloor.updateItems()">Refresh List</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
|
|
56
|
+
<hr>
|
|
57
|
+
|
|
14
58
|
<a href="/the-front" class="to">
|
|
15
59
|
Go to The Front
|
|
16
60
|
</a>
|
package/test/test-index.js
CHANGED
|
@@ -26,7 +26,8 @@ const world = {
|
|
|
26
26
|
{
|
|
27
27
|
name: "",
|
|
28
28
|
options: {
|
|
29
|
-
localScripts: ["game"],
|
|
29
|
+
localScripts: ["game", "items"],
|
|
30
|
+
styles: ["items-floor"],
|
|
30
31
|
serverScripts: ["game"]
|
|
31
32
|
}
|
|
32
33
|
},
|
|
@@ -55,7 +56,9 @@ const world = {
|
|
|
55
56
|
details: [
|
|
56
57
|
{
|
|
57
58
|
name: "",
|
|
58
|
-
options: {
|
|
59
|
+
options: {
|
|
60
|
+
requiredItems: ["Gold Coin"]
|
|
61
|
+
}
|
|
59
62
|
}
|
|
60
63
|
]
|
|
61
64
|
}
|
package/test/views/index.ejs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Welcome to The Front.
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
<button onclick="addGold()">Gold</button>
|
|
6
|
+
|
|
5
7
|
<hr>
|
|
6
8
|
|
|
7
9
|
<h3>Register Account</h3>
|
|
@@ -144,4 +146,8 @@
|
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
});
|
|
149
|
+
|
|
150
|
+
let addGold = function addGold(params) {
|
|
151
|
+
playerInventory.change(itemIDs[0], 2);
|
|
152
|
+
}
|
|
147
153
|
</script>
|
package/views/head.ejs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
<title><%= siteTitle %></title>
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
7
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
8
|
-
|
|
9
8
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
11
10
|
<!-- 'Roboto Condensed', sans-serif; -->
|
package/views/inventory.ejs
CHANGED
|
@@ -38,8 +38,13 @@
|
|
|
38
38
|
setInterval(this.update, this.updateCooldown);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
async change(
|
|
42
|
-
|
|
41
|
+
async change(itemID, amount) {
|
|
42
|
+
let change = {
|
|
43
|
+
item: itemID,
|
|
44
|
+
amount: amount
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await $.post("/inventory", change, (data, status) => {
|
|
43
48
|
if (status === "success") {
|
|
44
49
|
let holding = false;
|
|
45
50
|
|
|
@@ -52,7 +57,7 @@
|
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
if (!holding && data.amount > 0) {
|
|
60
|
+
if (!holding && data.amount > 0 && data.item) {
|
|
56
61
|
this.items.push(data);
|
|
57
62
|
}
|
|
58
63
|
|
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--textColor: rgb(247, 247, 247);
|
|
3
|
-
--altTextColor: rgb(20, 20, 20);
|
|
4
|
-
--bgColor: rgb(31, 31, 31);
|
|
5
|
-
--bgColorLight: rgb(79, 79, 79);
|
|
6
|
-
--focusColor: rgb(222, 139, 37);
|
|
7
|
-
--shadowColor: rgb(0, 0, 0);
|
|
8
|
-
--extreme-dark: #2e2e2e;
|
|
9
|
-
--very-dark: #3e3e3e;
|
|
10
|
-
--dark: #505050;
|
|
11
|
-
--light: #F7FFE0;
|
|
12
|
-
--yellow: #D59C00;
|
|
13
|
-
--brown: #704E2E;
|
|
14
|
-
--green: #709176;
|
|
15
|
-
--blue: #00487C;
|
|
16
|
-
--game-size: 500px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
* {
|
|
20
|
-
color: var(--textColor);
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
margin: 0;
|
|
23
|
-
padding: 0;
|
|
24
|
-
font-family: 'Chakra Petch', sans-serif;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.invisible {
|
|
28
|
-
display: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
a {
|
|
32
|
-
font-weight: bold;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
h4 a {
|
|
36
|
-
margin-right: 20px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
hr {
|
|
40
|
-
border: none;
|
|
41
|
-
border-bottom: 2px solid var(--shadowColor);
|
|
42
|
-
margin: 5px 20px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
hr.light {
|
|
46
|
-
border-bottom: 2px solid var(--textColor);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
body {
|
|
50
|
-
background-color: var(--bgColorLight);
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
header {
|
|
55
|
-
height: 100vh;
|
|
56
|
-
width: 100%;
|
|
57
|
-
position: relative;
|
|
58
|
-
box-shadow: 0 10px 25px var(--shadowColor);
|
|
59
|
-
background-color: var(--bgColor);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.portrait {
|
|
63
|
-
height: 100%;
|
|
64
|
-
width: 70%;
|
|
65
|
-
position: absolute;
|
|
66
|
-
right: 0;
|
|
67
|
-
background-image: url("/img/fancy-me.jpg");
|
|
68
|
-
background-size: cover;
|
|
69
|
-
background-position-x: center;
|
|
70
|
-
background-repeat: no-repeat;
|
|
71
|
-
z-index: 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.portrait-fade {
|
|
75
|
-
width: 100%;
|
|
76
|
-
height: 100%;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
header h2 {
|
|
80
|
-
position: absolute;
|
|
81
|
-
left: 100px;
|
|
82
|
-
top: 35%;
|
|
83
|
-
font-size: 50px;
|
|
84
|
-
background-color: var(--bgColor);
|
|
85
|
-
padding: 10px;
|
|
86
|
-
border-radius: 5px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
header h3 {
|
|
90
|
-
position: absolute;
|
|
91
|
-
left: 100px;
|
|
92
|
-
top: calc(35% + 75px);
|
|
93
|
-
font-size: 30px;
|
|
94
|
-
background-color: var(--bgColor);
|
|
95
|
-
padding: 10px;
|
|
96
|
-
border-radius: 5px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.external-links {
|
|
100
|
-
position: absolute;
|
|
101
|
-
left: 100px;
|
|
102
|
-
top: calc(35% + 125px);
|
|
103
|
-
font-size: 50px;
|
|
104
|
-
background-color: var(--bgColor);
|
|
105
|
-
width: 110px;
|
|
106
|
-
height: 65px;
|
|
107
|
-
display: flex;
|
|
108
|
-
justify-content: space-evenly;
|
|
109
|
-
align-items: center;
|
|
110
|
-
padding: 5px;
|
|
111
|
-
border-radius: 5px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
header a {
|
|
115
|
-
width: 50px;
|
|
116
|
-
height: 100%;
|
|
117
|
-
margin: 5px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
header i:hover {
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
color: var(--focusColor);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
nav {
|
|
126
|
-
height: 50px;
|
|
127
|
-
width: 100%;
|
|
128
|
-
background-color: var(--focusColor);
|
|
129
|
-
padding: 10px;
|
|
130
|
-
display: flex;
|
|
131
|
-
justify-content: space-between;
|
|
132
|
-
align-items: center;
|
|
133
|
-
position: fixed;
|
|
134
|
-
left: 0;
|
|
135
|
-
top: 0;
|
|
136
|
-
transition: all .2s ease;
|
|
137
|
-
z-index: 99;
|
|
138
|
-
border-bottom: 1px solid var(--bgColorLight);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
nav * {
|
|
142
|
-
color: var(--altTextColor);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
nav i {
|
|
146
|
-
font-size: 30px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.nav-closed {
|
|
150
|
-
top: -50px;
|
|
151
|
-
transition: all .2s ease;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
main {
|
|
155
|
-
width: 100%;
|
|
156
|
-
overflow: hidden;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
main img {
|
|
160
|
-
width: 100%;
|
|
161
|
-
height: auto;
|
|
162
|
-
border-radius: 5px;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
section {
|
|
166
|
-
width: 100%;
|
|
167
|
-
padding: 100px 10px;
|
|
168
|
-
display: flex;
|
|
169
|
-
justify-content: center;
|
|
170
|
-
align-items: center;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
section h3 {
|
|
174
|
-
margin: 20px;
|
|
175
|
-
font-size: 25px;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
section h4 {
|
|
179
|
-
margin: 5px 20px;
|
|
180
|
-
font-size: 18px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
section h4 i {
|
|
184
|
-
margin: 5px 5px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
section p {
|
|
188
|
-
margin: 20px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
section img {
|
|
192
|
-
width: 50%;
|
|
193
|
-
height: auto;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
section iframe {
|
|
197
|
-
width: 50%;
|
|
198
|
-
height: 700px;
|
|
199
|
-
border: none;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.text {
|
|
203
|
-
width: 600px;
|
|
204
|
-
height: 100%;
|
|
205
|
-
padding: 5px;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
#notherbase-fs {
|
|
209
|
-
background-color: var(--extreme-dark);
|
|
210
|
-
padding: 10px;
|
|
211
|
-
border: 5% solid var(--bgColor);
|
|
212
|
-
border-radius: 0% 0% 50px 50px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
#notherbase-fs img {
|
|
216
|
-
width: 20%;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
#cpd {
|
|
220
|
-
background-color: var(--focusColor);
|
|
221
|
-
flex-direction: row-reverse;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
#cpd * {
|
|
225
|
-
color: var(--altTextColor);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
#tamago-watch {
|
|
229
|
-
background-color: var(--bgColor);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
#won-ventures {
|
|
233
|
-
background-color: var(--focusColor);
|
|
234
|
-
flex-direction: row-reverse;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
#won-ventures * {
|
|
238
|
-
color: var(--altTextColor);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
#wayfarer {
|
|
242
|
-
background-color: var(--bgColor);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/* tamago watch styles */
|
|
246
|
-
.watch {
|
|
247
|
-
width: var(--game-size);
|
|
248
|
-
min-height: 100;
|
|
249
|
-
image-rendering: pixelated;
|
|
250
|
-
position: relative;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.watch * {
|
|
254
|
-
image-rendering: pixelated;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.cartridge {
|
|
258
|
-
position: absolute;
|
|
259
|
-
left: 5%;
|
|
260
|
-
top: 30%;
|
|
261
|
-
background-image: url("/img/cartridge.png");
|
|
262
|
-
background-size: cover;
|
|
263
|
-
transition: ease-out .15s;
|
|
264
|
-
z-index: 0;
|
|
265
|
-
width: 90%;
|
|
266
|
-
height: 90%;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.cartridge:hover {
|
|
270
|
-
top: 40%;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.name {
|
|
274
|
-
background-color: #70917600;
|
|
275
|
-
position: absolute;
|
|
276
|
-
top: 73%;
|
|
277
|
-
left: 32%;
|
|
278
|
-
width: 280px;
|
|
279
|
-
height: 80px;
|
|
280
|
-
transform: rotate(29deg);
|
|
281
|
-
text-align: center;
|
|
282
|
-
font-size: 50px;
|
|
283
|
-
border: none;
|
|
284
|
-
cursor: pointer;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.console {
|
|
288
|
-
width: 100%;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.screen {
|
|
292
|
-
position: absolute;
|
|
293
|
-
top: 6%;
|
|
294
|
-
left: 6.25%;
|
|
295
|
-
width: 87.5%;
|
|
296
|
-
height: 55%;
|
|
297
|
-
display: initial;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.bloom {
|
|
301
|
-
box-shadow: 0px 0px 10px #fff6d759, inset 0px 0px 10px #fff6d759;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.pet {
|
|
305
|
-
position: absolute;
|
|
306
|
-
top: 0%;
|
|
307
|
-
left: 10%;
|
|
308
|
-
width: 25%;
|
|
309
|
-
display: none;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
#p1 {
|
|
313
|
-
top: auto;
|
|
314
|
-
bottom: 10%;
|
|
315
|
-
left: 40%;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
#p2 {
|
|
319
|
-
top: 0%;
|
|
320
|
-
left: auto;
|
|
321
|
-
right: 10%;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.food {
|
|
325
|
-
position: absolute;
|
|
326
|
-
right: 0;
|
|
327
|
-
bottom: 20%;
|
|
328
|
-
width: 25%;
|
|
329
|
-
display: none;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.music {
|
|
333
|
-
position: absolute;
|
|
334
|
-
bottom: 20%;
|
|
335
|
-
left: 2%;
|
|
336
|
-
width: 25%;
|
|
337
|
-
display: none;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.detached-right {
|
|
341
|
-
float: right;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.dark {
|
|
345
|
-
filter: brightness(.5);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.hud {
|
|
349
|
-
position: absolute;
|
|
350
|
-
bottom: 5%;
|
|
351
|
-
left: 5%;
|
|
352
|
-
width: 90%;
|
|
353
|
-
height: 32%;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.clock-hand {
|
|
357
|
-
position: absolute;
|
|
358
|
-
top: 12.5%;
|
|
359
|
-
left: 4.10%;
|
|
360
|
-
height: 80%;
|
|
361
|
-
width: 25%;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.status {
|
|
365
|
-
position: absolute;
|
|
366
|
-
top: 10%;
|
|
367
|
-
right: 27.75%;
|
|
368
|
-
height: 16%;
|
|
369
|
-
width: 29%;
|
|
370
|
-
display: grid;
|
|
371
|
-
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
|
|
372
|
-
grid-template-rows: 1fr;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
#s1 {
|
|
376
|
-
top: 45%;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
#s2 {
|
|
380
|
-
top: 78%;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.point {
|
|
384
|
-
border: 1px solid var(--dark);
|
|
385
|
-
background-color: var(--yellow);
|
|
386
|
-
display: none;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.button {
|
|
390
|
-
background-color: rgba(0, 0, 0, 0);
|
|
391
|
-
background-image: url("/img/button_brown.png");
|
|
392
|
-
background-size: 100%;
|
|
393
|
-
background-repeat: no-repeat;
|
|
394
|
-
cursor: pointer;
|
|
395
|
-
border: none;
|
|
396
|
-
position: absolute;
|
|
397
|
-
top: 6%;
|
|
398
|
-
right: 5%;
|
|
399
|
-
height: 25%;
|
|
400
|
-
width: 20%;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
.button:active {
|
|
404
|
-
background-image: url("/img/button_brown_down.png");
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
#b1 {
|
|
408
|
-
background-image: url("/img/button_blue.png");
|
|
409
|
-
top: 40%;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
#b1:active {
|
|
413
|
-
background-image: url("/img/button_blue_down.png");
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
#b2 {
|
|
417
|
-
background-image: url("/img/button_green.png");
|
|
418
|
-
top: 75%;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
#b2:active {
|
|
422
|
-
background-image: url("/img/button_green_down.png");
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
@media only screen and (max-width: 900px) {
|
|
426
|
-
.portrait {
|
|
427
|
-
width: 100%;
|
|
428
|
-
height: 100vh;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
header h2 {
|
|
432
|
-
left: 35px;
|
|
433
|
-
font-size: 30px;
|
|
434
|
-
top: 65%;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
header h3 {
|
|
438
|
-
left: 35px;
|
|
439
|
-
font-size: 25px;
|
|
440
|
-
top: calc(65% + 50px);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
.external-links {
|
|
444
|
-
left: 35px;
|
|
445
|
-
font-size: 30px;
|
|
446
|
-
top: calc(65% + 95px);
|
|
447
|
-
height: 45px;
|
|
448
|
-
width: 75px;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
section {
|
|
452
|
-
flex-wrap: wrap;
|
|
453
|
-
padding: 40px 10px;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
#cpd, #won-ventures {
|
|
457
|
-
flex-direction: row;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.text, section img, section iframe {
|
|
461
|
-
width: 100%;
|
|
462
|
-
padding: 5px;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
.watch {
|
|
466
|
-
width: 100%;
|
|
467
|
-
}
|
|
468
|
-
}
|