notherbase-fs 1.1.40 → 1.2.0
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/explorer.js +11 -1
- package/controllers/game.js +1 -1
- package/controllers/index.js +2 -1
- package/controllers/inventory.js +1 -3
- package/controllers/the-front.js +1 -0
- package/package.json +1 -1
- package/public/styles/inventory.css +10 -21
- package/public/styles/main.css +4 -33
- package/public/styles/menu.css +41 -7
- package/server.js +2 -0
- package/test/coast/tall-beach/nono-cove/local-scripts/nono.js +211 -0
- package/test/coast/tall-beach/nono-cove/styles/index.css +18 -0
- package/test/coast/tall-beach/nono-cove/styles/nono.css +89 -0
- package/test/coast/tall-beach/nono-cove/views/index.ejs +5 -1
- package/test/coast/tall-beach/nono-cove/views/nono-og.ejs +37 -0
- package/test/test-index.js +10 -0
- package/test/views/index.ejs +5 -1
- package/views/contact.ejs +1 -1
- package/views/debug.ejs +15 -0
- package/views/explorer.ejs +7 -1
- package/views/inventory.ejs +58 -59
- package/views/menu.ejs +26 -12
- package/views/player.ejs +1 -0
package/controllers/explorer.js
CHANGED
|
@@ -31,6 +31,7 @@ let complete = function complete(explorerBuild) {
|
|
|
31
31
|
externalStyles: [],
|
|
32
32
|
localScripts: [],
|
|
33
33
|
serverScripts: [],
|
|
34
|
+
requiredItems: [],
|
|
34
35
|
needsKey: "",
|
|
35
36
|
dropOff: "",
|
|
36
37
|
...detail.options
|
|
@@ -74,6 +75,13 @@ let complete = function complete(explorerBuild) {
|
|
|
74
75
|
}));
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
let foundItemIDs = [];
|
|
79
|
+
for (let m = 0; m < detail.options.requiredItems.length; m++) {
|
|
80
|
+
let foundItem = await item.findOne({name: detail.options.requiredItems[m]});
|
|
81
|
+
|
|
82
|
+
foundItemIDs.push(foundItem._id);
|
|
83
|
+
}
|
|
84
|
+
|
|
77
85
|
let context = {
|
|
78
86
|
siteTitle: "NotherBase",
|
|
79
87
|
user: req.session.currentUserFull,
|
|
@@ -82,6 +90,7 @@ let complete = function complete(explorerBuild) {
|
|
|
82
90
|
main: detail.options.main,
|
|
83
91
|
localScripts: detail.options.localScripts,
|
|
84
92
|
serverScriptReturns: serverScriptReturns,
|
|
93
|
+
itemIDs: foundItemIDs,
|
|
85
94
|
pov: req.query.pov,
|
|
86
95
|
inventory: foundInventory,
|
|
87
96
|
query: req.query
|
|
@@ -121,8 +130,9 @@ let complete = function complete(explorerBuild) {
|
|
|
121
130
|
user: null,
|
|
122
131
|
styles: [`${dir}/${explorerBuild.void}/styles/void`],
|
|
123
132
|
externalStyles: [],
|
|
124
|
-
|
|
133
|
+
localScripts: [],
|
|
125
134
|
inventory: null,
|
|
135
|
+
itemIDs: [],
|
|
126
136
|
main: `${dir}/${explorerBuild.void}/index`
|
|
127
137
|
});
|
|
128
138
|
});
|
package/controllers/game.js
CHANGED
|
@@ -6,7 +6,7 @@ const { game } = require("../models");
|
|
|
6
6
|
|
|
7
7
|
router.get("/all", async function(req, res) {
|
|
8
8
|
try {
|
|
9
|
-
let foundGames = await game.find({
|
|
9
|
+
let foundGames = await game.find({name: req.query.name});
|
|
10
10
|
|
|
11
11
|
res.status(200).send({ foundGames: foundGames });
|
|
12
12
|
}
|
package/controllers/index.js
CHANGED
package/controllers/inventory.js
CHANGED
|
@@ -74,10 +74,8 @@ router.post("/", async function(req, res) {
|
|
|
74
74
|
|
|
75
75
|
if (!holding) {
|
|
76
76
|
if (req.body.change.amount > 0) {
|
|
77
|
-
let foundItem = await item.findById(req.body.change.item);
|
|
78
|
-
|
|
79
77
|
foundInventory.items.push({
|
|
80
|
-
item:
|
|
78
|
+
item: req.body.change.item,
|
|
81
79
|
amount: req.body.change.amount
|
|
82
80
|
});
|
|
83
81
|
|
package/controllers/the-front.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
.inventory {
|
|
2
2
|
border: 1px solid var(--textColor);
|
|
3
3
|
color: var(--textColor);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
height: 30%;
|
|
7
|
-
left: 5%;
|
|
8
|
-
bottom: 105px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
9
6
|
background-color: var(--bgColor);
|
|
10
7
|
padding: 5px;
|
|
11
|
-
border-radius: 5px;
|
|
12
8
|
z-index: 500;
|
|
13
9
|
display: flex;
|
|
14
10
|
flex-wrap: wrap;
|
|
@@ -21,6 +17,7 @@
|
|
|
21
17
|
flex-wrap: wrap;
|
|
22
18
|
overflow: auto;
|
|
23
19
|
border: 1px solid var(--textColor);
|
|
20
|
+
align-content: flex-start;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
.inventory .item-spawner {
|
|
@@ -43,21 +40,13 @@
|
|
|
43
40
|
background-color: var(--woodColor);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
button#inventory {
|
|
47
|
-
position: fixed;
|
|
48
|
-
bottom: 30px;
|
|
49
|
-
right: 75px;
|
|
50
|
-
width: 64px;
|
|
51
|
-
height: 64px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
43
|
.item-card {
|
|
55
|
-
width:
|
|
56
|
-
height:
|
|
57
|
-
border-radius:
|
|
44
|
+
width: 150px;
|
|
45
|
+
height: 45px;
|
|
46
|
+
border-radius: 3px;
|
|
58
47
|
border: 1px solid var(--textColor);
|
|
59
|
-
padding:
|
|
60
|
-
margin: 5px;
|
|
48
|
+
padding: 5px;
|
|
49
|
+
margin: 2.5px;
|
|
61
50
|
position: relative;
|
|
62
51
|
}
|
|
63
52
|
|
|
@@ -70,6 +59,6 @@ button#inventory {
|
|
|
70
59
|
}
|
|
71
60
|
|
|
72
61
|
.item-card hr {
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
width: 100%;
|
|
63
|
+
margin: 0;
|
|
75
64
|
}
|
package/public/styles/main.css
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
--textColorBright: rgb(221, 181, 130);
|
|
9
9
|
--woodColor: rgb(95, 68, 43);
|
|
10
10
|
--darkWoodColor: rgb(70, 50, 32);
|
|
11
|
+
--standardBorder: 1px solid var(--textColor);
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
* {
|
|
@@ -85,7 +86,7 @@ p {
|
|
|
85
86
|
width: 80%;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
input, textarea {
|
|
89
|
+
main input, main textarea {
|
|
89
90
|
padding: 10px;
|
|
90
91
|
width: calc(100% - 10px);
|
|
91
92
|
background-color: var(--bgColor);
|
|
@@ -95,7 +96,7 @@ input, textarea {
|
|
|
95
96
|
font-size: 15px;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
input[type=submit], button, a {
|
|
99
|
+
main input[type=submit], main button, main a {
|
|
99
100
|
background-color: var(--bgColor);
|
|
100
101
|
padding: 10px;
|
|
101
102
|
border-radius: 5px;
|
|
@@ -107,7 +108,7 @@ input[type=submit], button, a {
|
|
|
107
108
|
text-align: center;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
input[type=submit]:hover, button:hover, a:hover {
|
|
111
|
+
main input[type=submit]:hover, main button:hover, main a:hover {
|
|
111
112
|
border: 1px solid var(--textColorBright);
|
|
112
113
|
color: var(--textColorBright);
|
|
113
114
|
cursor: pointer;
|
|
@@ -163,32 +164,6 @@ ul {
|
|
|
163
164
|
margin: 10px;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
#contact {
|
|
167
|
-
position: fixed;
|
|
168
|
-
bottom: 30px;
|
|
169
|
-
left: 5px;
|
|
170
|
-
width: 64px;
|
|
171
|
-
height: 64px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
#contact-form {
|
|
175
|
-
width: 100%;
|
|
176
|
-
border: 1px solid var(--textColor);
|
|
177
|
-
color: var(--textColor);
|
|
178
|
-
position: fixed;
|
|
179
|
-
width: 90%;
|
|
180
|
-
height: 30%;
|
|
181
|
-
left: 5%;
|
|
182
|
-
bottom: 105px;
|
|
183
|
-
background-color: var(--bgColor);
|
|
184
|
-
padding: 5px;
|
|
185
|
-
border-radius: 5px;
|
|
186
|
-
z-index: 500;
|
|
187
|
-
display: flex;
|
|
188
|
-
flex-wrap: wrap;
|
|
189
|
-
overflow: auto;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
167
|
.door {
|
|
193
168
|
border: 1px solid var(--darkWoodColor);
|
|
194
169
|
width: 100px;
|
|
@@ -242,10 +217,6 @@ iframe {
|
|
|
242
217
|
font-size: 12px;
|
|
243
218
|
}
|
|
244
219
|
|
|
245
|
-
.ui {
|
|
246
|
-
position: relative;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
220
|
@media only screen and (max-width: 500px) {
|
|
250
221
|
main {
|
|
251
222
|
width: 100%;
|
package/public/styles/menu.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.menu {
|
|
2
2
|
width: 75%;
|
|
3
|
-
height:
|
|
3
|
+
height: 75%;
|
|
4
4
|
margin: 5% 12.5%;
|
|
5
5
|
border: 1px solid var(--textColor);
|
|
6
6
|
color: var(--textColor);
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
z-index: 500;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.ui button {
|
|
16
|
+
background-color: var(--bgColor);
|
|
17
|
+
border: 1px solid var(--textColor);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ui button:hover {
|
|
21
|
+
border: 1px solid var(--textColorBright);
|
|
22
|
+
color: var(--textColorBright);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
15
26
|
.ui button#menu {
|
|
16
27
|
position: fixed;
|
|
17
28
|
bottom: 30px;
|
|
@@ -21,8 +32,8 @@
|
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
.menu button#close {
|
|
24
|
-
top:
|
|
25
|
-
right:
|
|
35
|
+
top: 0;
|
|
36
|
+
right: 0;
|
|
26
37
|
width: 32px;
|
|
27
38
|
height: 32px;
|
|
28
39
|
position: absolute;
|
|
@@ -30,18 +41,41 @@
|
|
|
30
41
|
|
|
31
42
|
.menu .tabs {
|
|
32
43
|
width: 100%;
|
|
33
|
-
height:
|
|
44
|
+
height: 30px;
|
|
34
45
|
border: 1px solid var(--textColor);
|
|
35
46
|
}
|
|
36
47
|
|
|
37
|
-
.menu .
|
|
48
|
+
.menu .tabs button {
|
|
49
|
+
height: 30px;
|
|
50
|
+
border-radius: 0;
|
|
51
|
+
padding: 0 10px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.menu .tabs .selected {
|
|
55
|
+
border: 2px solid var(--textColorBright);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.menu #content-window {
|
|
38
59
|
width: 100%;
|
|
39
|
-
height:
|
|
60
|
+
height: calc(100% - 30px);
|
|
40
61
|
border: 1px solid var(--textColor);
|
|
41
62
|
}
|
|
42
63
|
|
|
43
64
|
.menu a {
|
|
44
65
|
margin: 0;
|
|
45
66
|
padding: 5px;
|
|
46
|
-
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.menu #logout {
|
|
70
|
+
position: absolute;
|
|
71
|
+
width: 50%;
|
|
72
|
+
height: 40px;
|
|
73
|
+
bottom: -40px;
|
|
74
|
+
left: calc(25%);
|
|
75
|
+
background-color: var(--bgColor);
|
|
76
|
+
border: var(--standardBorder);
|
|
77
|
+
border-top: none;
|
|
78
|
+
border-radius: 0 0 5px 5px;
|
|
79
|
+
text-align: center;
|
|
80
|
+
z-index: 499;
|
|
47
81
|
}
|
package/server.js
CHANGED
|
@@ -62,6 +62,8 @@ module.exports = function start(frontRouter, exploreRouter, dbConnected) {
|
|
|
62
62
|
app.use("/chat", controllers.chat(io));
|
|
63
63
|
|
|
64
64
|
app.use("/contact", controllers.contact);
|
|
65
|
+
|
|
66
|
+
app.use("/game", controllers.game);
|
|
65
67
|
|
|
66
68
|
app.use("/inventory", controllers.inventory);
|
|
67
69
|
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
let tileSize = 30;
|
|
2
|
+
|
|
3
|
+
class NonoTile {
|
|
4
|
+
constructor (game, $field, position, modifier) {
|
|
5
|
+
this.$div = $field.append(`<div class="nono-tile" id="${position[0]},${position[1]}"></div>`).children().last();
|
|
6
|
+
this.$div.css("width", tileSize);
|
|
7
|
+
this.$div.css("height", tileSize);
|
|
8
|
+
this.position = position;
|
|
9
|
+
this.state = "blank";
|
|
10
|
+
this.$div.addClass(this.state);
|
|
11
|
+
this.correctState = this.getRandomState(modifier);
|
|
12
|
+
this.solved = this.checkIfSolved();
|
|
13
|
+
this.game = game;
|
|
14
|
+
|
|
15
|
+
this.$div.on("click", this.clicked);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getRandomState(modifier) {
|
|
19
|
+
let roll = Math.floor(Math.random() * (2 + modifier));
|
|
20
|
+
if (roll < 1) return "blank";
|
|
21
|
+
else return "punched";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
checkIfSolved() {
|
|
25
|
+
if ((this.state === "blank" || this.state === "marked") && this.correctState === "blank") return true;
|
|
26
|
+
else if (this.state === "punched" && this.correctState === "punched") return true;
|
|
27
|
+
else return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
clicked = () => {
|
|
31
|
+
this.$div.removeClass(this.state);
|
|
32
|
+
|
|
33
|
+
if (this.state === "blank") this.state = "marked";
|
|
34
|
+
else if (this.state === "marked") this.state = "punched";
|
|
35
|
+
else if (this.state === "punched") this.state = "blank";
|
|
36
|
+
|
|
37
|
+
this.$div.addClass(this.state);
|
|
38
|
+
|
|
39
|
+
this.solved = this.checkIfSolved();
|
|
40
|
+
this.game.tryFinishGame();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class NonoGame {
|
|
45
|
+
constructor () {
|
|
46
|
+
this.difficulty = 0;
|
|
47
|
+
this.level = 2;
|
|
48
|
+
this.$board = $("#nono-board");
|
|
49
|
+
this.$field = null;
|
|
50
|
+
this.dimensions = [this.level, this.level];
|
|
51
|
+
this.hints = [[], []];
|
|
52
|
+
this.tiles = [];
|
|
53
|
+
this.nonoSize = 100;
|
|
54
|
+
this.maxNonoId = 4;
|
|
55
|
+
this.goldItem = itemIDs[0];
|
|
56
|
+
|
|
57
|
+
this.startNew();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
startNew() {
|
|
61
|
+
this.dimensions = [this.level, this.level];
|
|
62
|
+
|
|
63
|
+
this.$board.empty();
|
|
64
|
+
this.$board.css("width", this.dimensions[0] * (tileSize) + this.nonoSize + 5);
|
|
65
|
+
this.$board.css("height", this.dimensions[1] * (tileSize) + this.nonoSize + 5);
|
|
66
|
+
|
|
67
|
+
let $nono = this.$board.append(`<img class="nono" src="/img/logo.png">`).children().last();
|
|
68
|
+
$nono.css("width", this.nonoSize);
|
|
69
|
+
$nono.css("height", this.nonoSize);
|
|
70
|
+
|
|
71
|
+
let $topHints = this.$board.append(`<div class="top hints"></div>`).children().last();
|
|
72
|
+
$topHints.css("width", this.dimensions[0] * tileSize);
|
|
73
|
+
$topHints.css("height", this.nonoSize);
|
|
74
|
+
|
|
75
|
+
let $columns = [];
|
|
76
|
+
for (let i = 0; i < this.dimensions[0]; i++) {
|
|
77
|
+
let $newColumn = $topHints.append(`<div class="column"></div>`).children().last();
|
|
78
|
+
$newColumn.css("width", tileSize);
|
|
79
|
+
$columns.push($newColumn);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let $sideHints = this.$board.append(`<div class="side hints"></div>`).children().last();
|
|
83
|
+
$sideHints.css("width", this.nonoSize);
|
|
84
|
+
$sideHints.css("height", this.dimensions[1] * tileSize);
|
|
85
|
+
|
|
86
|
+
let $rows = [];
|
|
87
|
+
for (let i = 0; i < this.dimensions[1]; i++) {
|
|
88
|
+
let $newRow = $sideHints.append(`<div class="row"></div>`).children().last();
|
|
89
|
+
$newRow.css("height", tileSize);
|
|
90
|
+
$rows.push($newRow);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.$field = this.$board.append(`<div class="nono-field"></div>`).children().last();
|
|
94
|
+
this.$field.css("width", this.dimensions[0] * tileSize);
|
|
95
|
+
this.$field.css("height", this.dimensions[1] * tileSize);
|
|
96
|
+
|
|
97
|
+
this.tiles = this.generateTiles();
|
|
98
|
+
this.hints = this.generateHints();
|
|
99
|
+
|
|
100
|
+
for (let i = 0; i < this.dimensions[0]; i++) {
|
|
101
|
+
for (let j = 0; j < this.hints[0][i].length; j++) {
|
|
102
|
+
$columns[i].append(`<p class="hint">${this.hints[0][i][j]}</p>`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
for (let i = 0; i < this.dimensions[1]; i++) {
|
|
107
|
+
for (let j = 0; j < this.hints[1][i].length; j++) {
|
|
108
|
+
$rows[i].append(`<p class="hint">${this.hints[1][i][j]}</p>`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (this.checkForSolve()) {
|
|
113
|
+
console.log("Randomly generated nothing!");
|
|
114
|
+
this.startNew();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
generateTiles() {
|
|
119
|
+
let tiles = [];
|
|
120
|
+
|
|
121
|
+
for (let i = 0; i < this.dimensions[0]; i++) {
|
|
122
|
+
for (let j = 0; j < this.dimensions[1]; j++) {
|
|
123
|
+
tiles.push(new NonoTile(
|
|
124
|
+
this,
|
|
125
|
+
this.$field,
|
|
126
|
+
[i, j],
|
|
127
|
+
1 - (this.difficulty / 10)
|
|
128
|
+
));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return tiles;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
generateHints() {
|
|
136
|
+
let hints = [[], []];
|
|
137
|
+
|
|
138
|
+
for (let i = 0; i < this.dimensions[0]; i++) {
|
|
139
|
+
let current = 0;
|
|
140
|
+
hints[0].push([]);
|
|
141
|
+
|
|
142
|
+
for (let j = 0; j < this.dimensions[1]; j++) {
|
|
143
|
+
if (this.tiles[j * this.dimensions[0] + i].correctState === "punched") current++;
|
|
144
|
+
else if (current > 0) {
|
|
145
|
+
hints[0][i].push(current);
|
|
146
|
+
current = 0;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (current > 0 || hints[0][i].length < 1) {
|
|
151
|
+
hints[0][i].push(current);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
for (let i = 0; i < this.dimensions[1]; i++) {
|
|
156
|
+
let current = 0;
|
|
157
|
+
hints[1].push([]);
|
|
158
|
+
|
|
159
|
+
for (let j = 0; j < this.dimensions[0]; j++) {
|
|
160
|
+
if (this.tiles[i * this.dimensions[0] + j].correctState === "punched") current++;
|
|
161
|
+
else if (current > 0) {
|
|
162
|
+
hints[1][i].push(current);
|
|
163
|
+
current = 0;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (current > 0 || hints[1][i].length < 1) hints[1][i].push(current);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return hints;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
checkForSolve() {
|
|
174
|
+
let solved = true;
|
|
175
|
+
|
|
176
|
+
for (let i = 0; i < this.tiles.length; i++) {
|
|
177
|
+
if (!this.tiles[i].solved) {
|
|
178
|
+
solved = false;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return solved;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
tryFinishGame() {
|
|
187
|
+
if (this.checkForSolve()) {
|
|
188
|
+
playerInventory.change({
|
|
189
|
+
item: this.goldItem,
|
|
190
|
+
amount: this.level + this.difficulty
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
let $tiles = $(".nono-tile");
|
|
194
|
+
$tiles.off("click");
|
|
195
|
+
$tiles.addClass("borderless");
|
|
196
|
+
$tiles = $(".nono-tile.marked");
|
|
197
|
+
$tiles.addClass("blank");
|
|
198
|
+
$tiles.removeClass("marked");
|
|
199
|
+
|
|
200
|
+
this.level++;
|
|
201
|
+
if (this.level > 10) {
|
|
202
|
+
this.difficulty += this.level - 10;
|
|
203
|
+
if (this.difficulty > 10) this.difficulty = 10;
|
|
204
|
+
this.level -= 10;
|
|
205
|
+
}
|
|
206
|
+
setTimeout(() => {this.startNew();}, 2000);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let nonoGame = new NonoGame();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
}
|
|
3
|
+
|
|
4
|
+
.nono-spirit {
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 200px;
|
|
7
|
+
margin: 10px;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.nono-spirit img {
|
|
12
|
+
width: 100px;
|
|
13
|
+
height: 100px;
|
|
14
|
+
top: 50%;
|
|
15
|
+
left: 50%;
|
|
16
|
+
position: absolute;
|
|
17
|
+
image-rendering: pixelated;
|
|
18
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--nonoColor: rgb(87, 61, 53);
|
|
3
|
+
--nonoColorBright: rgb(187, 130, 113);
|
|
4
|
+
--nonoBG: rgb(61, 61, 61);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
#nono-board {
|
|
8
|
+
border: 2px solid black;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.nono {
|
|
15
|
+
background-color: var(--nonoBG);
|
|
16
|
+
user-select: none;
|
|
17
|
+
image-rendering: pixelated;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.hints {
|
|
21
|
+
background-color: var(--nonoBG);
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.column {
|
|
29
|
+
border: 1px solid var(--nonoColor);
|
|
30
|
+
height: 100%;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
justify-content: flex-end;
|
|
34
|
+
user-select: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.row {
|
|
38
|
+
border: 1px solid var(--nonoColor);
|
|
39
|
+
width: 100%;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
justify-content: flex-end;
|
|
43
|
+
user-select: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.hint {
|
|
47
|
+
width: 25px;
|
|
48
|
+
height: 25px;
|
|
49
|
+
margin: 0;
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
user-select: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nono-field {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.nono-tile {
|
|
63
|
+
border: 1px solid var(--nonoColor);
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.borderless {
|
|
68
|
+
border: none !important;
|
|
69
|
+
cursor: initial !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nono-tile:hover {
|
|
73
|
+
border: 1px solid var(--nonoColorBright);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.blank {
|
|
77
|
+
background-color: white;
|
|
78
|
+
transition: all .1s ease;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.marked {
|
|
82
|
+
background-color: rgb(73, 80, 182);
|
|
83
|
+
transition: all .1s ease;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.punched {
|
|
87
|
+
background-color: rgb(0, 0, 0);
|
|
88
|
+
transition: all .1s ease;
|
|
89
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
A random nono washes up on shore. Will you solve it?
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
<div class="nono-spirit">
|
|
8
|
+
<img id="move-nono-spirit" src="/img/logo.png" alt="Nono Spirit">
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div id="nono-board"></div>
|
|
12
|
+
|
|
13
|
+
<hr>
|
|
14
|
+
|
|
15
|
+
<a href="/the-front">
|
|
16
|
+
Go to The Front
|
|
17
|
+
</a>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
let lastPos = [0, 0];
|
|
21
|
+
|
|
22
|
+
let moveNono = function moveNono() {
|
|
23
|
+
let focus = $("#move-nono-spirit");
|
|
24
|
+
let newPos = [Math.floor(Math.random() * 200), Math.floor(Math.random() * 100)];
|
|
25
|
+
|
|
26
|
+
focus.animate({
|
|
27
|
+
left: newPos[0],
|
|
28
|
+
top: newPos[1],
|
|
29
|
+
}, 2000);
|
|
30
|
+
|
|
31
|
+
lastPos = newPos;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
moveNono();
|
|
35
|
+
|
|
36
|
+
setInterval(moveNono, 2000);
|
|
37
|
+
</script>
|
package/test/test-index.js
CHANGED
package/test/views/index.ejs
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
22
|
<a href="/coast/tall-beach/nono-cove" class="invisible to nother-base">
|
|
23
|
-
Go
|
|
23
|
+
Go inside
|
|
24
24
|
</a>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
$loginInfo.text("To your right you hear the sound of a bang against a chain-link fence. You've logged in.");
|
|
44
44
|
$toNonoButton.addClass("invisible");
|
|
45
45
|
$toNonoLink.removeClass("invisible");
|
|
46
|
+
|
|
47
|
+
if (playerInventory) {
|
|
48
|
+
playerInventory.refresh();
|
|
49
|
+
}
|
|
46
50
|
});
|
|
47
51
|
} catch (error) {
|
|
48
52
|
//console.log(error);
|
package/views/contact.ejs
CHANGED
package/views/debug.ejs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="content invisible" id="debug">
|
|
2
|
+
<h3>user</h3>
|
|
3
|
+
<% if (user) { %>
|
|
4
|
+
<p><%= user._id %></p>
|
|
5
|
+
<% } else { %>
|
|
6
|
+
<p>Please login to view user.</p>
|
|
7
|
+
<% } %>
|
|
8
|
+
|
|
9
|
+
<h3>inv</h3>
|
|
10
|
+
<% if (user) { %>
|
|
11
|
+
<p><%= inventory.items.length %> items</p>
|
|
12
|
+
<% } else { %>
|
|
13
|
+
<p>Please login to view inventory.</p>
|
|
14
|
+
<% } %>
|
|
15
|
+
</div>
|
package/views/explorer.ejs
CHANGED
|
@@ -9,12 +9,18 @@
|
|
|
9
9
|
<% } %>
|
|
10
10
|
</style>
|
|
11
11
|
|
|
12
|
+
<script>
|
|
13
|
+
let itemIDs = [];
|
|
14
|
+
<% for (let i = 0; i < itemIDs.length; i++) { %>
|
|
15
|
+
itemIDs.push("<%= itemIDs[i] %>");
|
|
16
|
+
<% } %>
|
|
17
|
+
</script>
|
|
18
|
+
|
|
12
19
|
<main class="override">
|
|
13
20
|
<%- include(`${main}.ejs`); %>
|
|
14
21
|
</main>
|
|
15
22
|
|
|
16
23
|
<div class="ui">
|
|
17
|
-
<%- include("./inventory.ejs", {inventory: inventory}); %>
|
|
18
24
|
<%- include("./menu.ejs", {user: user}); %>
|
|
19
25
|
</div>
|
|
20
26
|
|
package/views/inventory.ejs
CHANGED
|
@@ -1,51 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<div class="search-results">
|
|
11
|
-
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<% break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
} %>
|
|
19
|
-
|
|
20
|
-
<div class="item-list">
|
|
21
|
-
</div>
|
|
1
|
+
<div class="inventory content invisible" id="inventory">
|
|
2
|
+
<div id="error">
|
|
3
|
+
Please login to view your inventory.
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<div class="item-spawner invisible">
|
|
7
|
+
<input type="text" class="search">
|
|
8
|
+
<div class="search-results">
|
|
9
|
+
|
|
22
10
|
</div>
|
|
11
|
+
</div>
|
|
23
12
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<% } else { %>
|
|
28
|
-
<button id="inventory">
|
|
29
|
-
ERR
|
|
30
|
-
</button>
|
|
31
|
-
<% } %>
|
|
32
|
-
<% } %>
|
|
13
|
+
<div class="item-list">
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
33
16
|
|
|
34
17
|
<script>
|
|
35
18
|
class Inventory {
|
|
36
19
|
constructor() {
|
|
37
20
|
this.$div = $(".inventory");
|
|
38
|
-
this.$list = $(".item-list");
|
|
21
|
+
this.$list = $(".inventory .item-list");
|
|
39
22
|
this.$search = $(".search");
|
|
40
23
|
this.$searchResults = $(".search-results");
|
|
41
24
|
this.searchResults = [];
|
|
42
|
-
this.$
|
|
25
|
+
this.$error = $("#inventory #error");
|
|
43
26
|
this.items = [];
|
|
44
27
|
|
|
45
|
-
this.$button.on("click", () => {
|
|
46
|
-
this.$div.toggleClass("invisible");
|
|
47
|
-
});
|
|
48
|
-
|
|
49
28
|
this.$search.on("keyup", () => {
|
|
50
29
|
let searchString = this.$search.val();
|
|
51
30
|
|
|
@@ -54,17 +33,13 @@
|
|
|
54
33
|
});
|
|
55
34
|
});
|
|
56
35
|
|
|
57
|
-
|
|
58
|
-
this.items = data.foundInventory.items;
|
|
59
|
-
|
|
60
|
-
this.render();
|
|
61
|
-
});
|
|
36
|
+
this.refresh();
|
|
62
37
|
|
|
63
38
|
setInterval(this.update, this.updateCooldown);
|
|
64
39
|
}
|
|
65
40
|
|
|
66
|
-
change(change) {
|
|
67
|
-
$.post("/inventory", { change: change }, (data, status) => {
|
|
41
|
+
async change(change) {
|
|
42
|
+
await $.post("/inventory", { change: change }, (data, status) => {
|
|
68
43
|
if (status === "success") {
|
|
69
44
|
let holding = false;
|
|
70
45
|
|
|
@@ -87,28 +62,52 @@
|
|
|
87
62
|
});
|
|
88
63
|
}
|
|
89
64
|
|
|
65
|
+
async getData() {
|
|
66
|
+
await $.get("/inventory", (data) => {
|
|
67
|
+
if (data.foundInventory) this.items = data.foundInventory.items;
|
|
68
|
+
|
|
69
|
+
this.clearError();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
90
73
|
render() {
|
|
91
74
|
this.$list.empty();
|
|
92
|
-
|
|
75
|
+
|
|
93
76
|
for (let i = 0; i < this.items.length; i++) {
|
|
94
77
|
let $new = this.$list.append(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
78
|
+
`<div class="item-card">
|
|
79
|
+
<h5>${this.items[i].item.name}</h5>
|
|
80
|
+
<button id="${i}">X</button>
|
|
81
|
+
<hr>
|
|
82
|
+
<p>${this.items[i].amount}</p>
|
|
83
|
+
</div>`
|
|
84
|
+
).children().last();
|
|
85
|
+
|
|
86
|
+
$new.find("button").on("click", (e) => {
|
|
87
|
+
let which = parseInt(e.currentTarget.id);
|
|
88
|
+
|
|
89
|
+
this.change({
|
|
90
|
+
item: this.items[which].item._id,
|
|
91
|
+
amount: -1
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
this.clearError();
|
|
109
95
|
});
|
|
110
|
-
}
|
|
96
|
+
}
|
|
111
97
|
}
|
|
98
|
+
|
|
99
|
+
async refresh() {
|
|
100
|
+
await this.getData();
|
|
101
|
+
this.render();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
clearError() {
|
|
105
|
+
this.$error.addClass("invisible");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
setError(text) {
|
|
109
|
+
this.$error.text(text);
|
|
110
|
+
this.$error.removeClass("invisible");
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
renderSearchResults(results) {
|
package/views/menu.ejs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<div class="menu invisible">
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
<div class="tabs">
|
|
5
3
|
<button id="inventory">
|
|
6
4
|
Inventory
|
|
@@ -8,23 +6,26 @@
|
|
|
8
6
|
<button id="player">
|
|
9
7
|
Player
|
|
10
8
|
</button>
|
|
11
|
-
<button id="contact">
|
|
9
|
+
<button id="contact-form">
|
|
12
10
|
Contact
|
|
13
11
|
</button>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
X
|
|
12
|
+
<button id="debug">
|
|
13
|
+
Debug
|
|
17
14
|
</button>
|
|
18
15
|
</div>
|
|
19
16
|
|
|
20
|
-
<
|
|
21
|
-
|
|
17
|
+
<button id="close">
|
|
18
|
+
X
|
|
19
|
+
</button>
|
|
22
20
|
|
|
21
|
+
<div id="content-window">
|
|
22
|
+
<%- include("./inventory.ejs"); %>
|
|
23
|
+
<%- include("./player.ejs"); %>
|
|
24
|
+
<%- include("./contact.ejs"); %>
|
|
25
|
+
<%- include("./debug.ejs"); %>
|
|
23
26
|
</div>
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
<a href="/user/logout">Logout</a>
|
|
27
|
-
<% } %>
|
|
28
|
+
<a href="/user/logout" id="logout">Logout</a>
|
|
28
29
|
</div>
|
|
29
30
|
|
|
30
31
|
<button id="menu"><i class="fas fa-cog"></i></button>
|
|
@@ -36,7 +37,20 @@
|
|
|
36
37
|
$menu.toggleClass("invisible");
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
$("button#close").on("click", function () {
|
|
40
|
+
$(".menu button#close").on("click", function () {
|
|
40
41
|
$menu.toggleClass("invisible");
|
|
41
42
|
});
|
|
43
|
+
|
|
44
|
+
$(".menu .tabs button").on("click", function (e) {
|
|
45
|
+
switchTab(e.currentTarget.id);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
let switchTab = function switchTab(id) {
|
|
49
|
+
$("#content-window .content").addClass("invisible");
|
|
50
|
+
$(".menu .tabs button").removeClass("selected");
|
|
51
|
+
$(`#content-window #${id}`).removeClass("invisible");
|
|
52
|
+
$(`.menu .tabs #${id}`).addClass("selected");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
switchTab("inventory");
|
|
42
56
|
</script>
|
package/views/player.ejs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="content invisible" id="player"></div>
|