notherbase-fs 2.0.3 → 3.0.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/controllers/creation.js +57 -59
- package/controllers/spirit-world.js +55 -74
- package/controllers/spirits/contact.js +17 -10
- package/controllers/spirits/user.js +144 -112
- package/controllers/spirits/util.js +23 -31
- package/models/index.js +54 -117
- package/models/item.js +80 -0
- package/models/send-mail.js +2 -0
- package/models/spirit.js +77 -115
- package/models/user.js +189 -0
- package/notherbase-fs.js +1 -0
- package/package.json +1 -1
- package/public/styles/main.css +12 -3
- package/test/{explorer/coast/tall-beach/nono-cove/styles → coast/tall-beach/nono-cove}/index.css +0 -0
- package/test/coast/tall-beach/nono-cove/index.ejs +29 -0
- package/test/{explorer/coast/tall-beach/nono-cove/views/nono-og.ejs → coast/tall-beach/nono-cove/nono-og/index.ejs} +2 -2
- package/test/{explorer/coast/tall-beach/nono-cove/styles → coast/tall-beach/nono-cove/nono-og}/nono.css +0 -0
- package/test/{explorer/coast/tall-beach/nono-cove/local-scripts → coast/tall-beach/nono-cove/nono-og}/nono.js +1 -1
- package/test/{explorer/coast/tall-beach/nono-cove/server-scripts → test-page}/emailTime.js +0 -0
- package/test/{pages/test.ejs → test-page/index.ejs} +0 -0
- package/test/the-front/add-gold.js +35 -0
- package/test/the-front/check/add-more-gold.js +3 -0
- package/test/the-front/check/emailTime.js +11 -0
- package/test/the-front/check/index.ejs +13 -0
- package/test/the-front/check/subtract-gold.js +3 -0
- package/test/the-front/checks.js +11 -0
- package/test/the-front/incTranslation.js +9 -0
- package/test/the-front/index.ejs +107 -0
- package/test/void/index.ejs +4 -0
- package/test/void/void.css +3 -0
- package/views/explorer.ejs +32 -41
- package/views/menu/account.ejs +39 -0
- package/views/menu/inventory.ejs +8 -0
- package/views/menu/more.ejs +5 -0
- package/views/menu/player.ejs +3 -0
- package/views/menu.ejs +20 -62
- package/views/scripts/base.js +314 -0
- package/controllers/spirits/attribute.js +0 -47
- package/controllers/spirits/inventory.js +0 -71
- package/controllers/spirits/item.js +0 -41
- package/controllers/spirits/serve.js +0 -33
- package/public/js/commune.js +0 -22
- package/public/js/establishment.js +0 -44
- package/public/js/memories.js +0 -44
- package/test/explorer/coast/tall-beach/nono-cove/local-scripts/game.js +0 -7
- package/test/explorer/coast/tall-beach/nono-cove/local-scripts/items.js +0 -162
- package/test/explorer/coast/tall-beach/nono-cove/server-scripts/getTimer.js +0 -31
- package/test/explorer/coast/tall-beach/nono-cove/styles/items-floor.css +0 -92
- package/test/explorer/coast/tall-beach/nono-cove/views/index.ejs +0 -130
- package/test/pages/server-scripts/emailTime.js +0 -15
- package/test/the-front/server-scripts/emailTime.js +0 -15
- package/test/the-front/server-scripts/getTimer.js +0 -31
- package/test/the-front/views/check.ejs +0 -93
- package/test/the-front/views/index.ejs +0 -113
- package/test/void/styles/void.css +0 -0
- package/views/account.ejs +0 -122
- package/views/inventory.ejs +0 -117
- package/views/more.ejs +0 -16
- package/views/player.ejs +0 -60
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<p>
|
|
2
|
-
Welcome to The Front.
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<button onclick="addGold()">Gold</button>
|
|
6
|
-
|
|
7
|
-
<button onclick="emailTime()">email</button>
|
|
8
|
-
|
|
9
|
-
<input type="text" id="general">
|
|
10
|
-
|
|
11
|
-
<button onclick="newItem()">newItem</button>
|
|
12
|
-
<button onclick="deleteItem()">deleteItem</button>
|
|
13
|
-
<button onclick="playerInventory.change($('#general').val(), 3)">add Item to inv</button>
|
|
14
|
-
<button onclick="emailTime()">email time</button>
|
|
15
|
-
|
|
16
|
-
<hr>
|
|
17
|
-
|
|
18
|
-
<h3>Register Account</h3>
|
|
19
|
-
<input type="email" placeholder="email" id="register-email">
|
|
20
|
-
<input type="text" placeholder="username" id="register-user">
|
|
21
|
-
<input type="password" placeholder="password" id="register-pass">
|
|
22
|
-
<button id="register-button">register</button>
|
|
23
|
-
<p id="register-info"></p>
|
|
24
|
-
|
|
25
|
-
<hr>
|
|
26
|
-
|
|
27
|
-
<div class="auth-form" id="reset-form">
|
|
28
|
-
<h1>NotherBase</h1>
|
|
29
|
-
<h3>Reset your Password</h3>
|
|
30
|
-
<input type="number" name="token" placeholder="Your Reset Code" id="token">
|
|
31
|
-
<input type="password" name="password" placeholder="Type Your New Password Here" minlength="8" required id="password">
|
|
32
|
-
<input type="password" name="confirmation" placeholder="Type Your New Password Here Again" minlength="8" required id="confirmation">
|
|
33
|
-
<button id="change-password">Change Password</button>
|
|
34
|
-
<p id="change-info"></p>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<hr>
|
|
38
|
-
|
|
39
|
-
<a href="/coast/tall-beach/nono-cove" class="to nother-base">
|
|
40
|
-
Go inside
|
|
41
|
-
</a>
|
|
42
|
-
|
|
43
|
-
<a href="/the-front/check">
|
|
44
|
-
Go to The Check
|
|
45
|
-
</a>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
let $resetPassword = $("#reset-password");
|
|
49
|
-
let $registerButton = $("#register-button");
|
|
50
|
-
let $registerInfo = $("#register-info");
|
|
51
|
-
let $changePasswordButton = $("button#change-password");
|
|
52
|
-
let $changeInfo = $("#change-info");
|
|
53
|
-
let $toNonoButton = $(".locked.to.nother-base");
|
|
54
|
-
let $toNonoLink = $(".invisible.to.nother-base");
|
|
55
|
-
|
|
56
|
-
$registerButton.on("click", async function () {
|
|
57
|
-
await $.post("/s", JSON.stringify({
|
|
58
|
-
action: "register",
|
|
59
|
-
data: {
|
|
60
|
-
username: $("#register-user").val(),
|
|
61
|
-
password: $("#register-pass").val(),
|
|
62
|
-
email: $("#register-email").val()
|
|
63
|
-
}
|
|
64
|
-
}), (data) => {
|
|
65
|
-
if (data.status === "success") $registerInfo.text("Account registered.");
|
|
66
|
-
else console.log(data);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
$changePasswordButton.on("click", async function () {
|
|
71
|
-
let token = $("#reset-form #token").val();
|
|
72
|
-
|
|
73
|
-
await $.post("/s", JSON.stringify({
|
|
74
|
-
action: "changePassword",
|
|
75
|
-
data: {
|
|
76
|
-
token: token,
|
|
77
|
-
password: $("#reset-form #password").val(),
|
|
78
|
-
confirmation: $("#reset-form #confirmation").val()
|
|
79
|
-
}
|
|
80
|
-
}), (data) => {
|
|
81
|
-
if (data.status === "success") $changeInfo.text("Password changed.");
|
|
82
|
-
else console.log(data);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
let addGold = function addGold(params) {
|
|
87
|
-
playerInventory.change("Gold Coin", 23);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let newItem = async () => {
|
|
91
|
-
await commune("newItem", {
|
|
92
|
-
name: $("#general").val()
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
let items = await commune("getAllItems");
|
|
96
|
-
console.log(items);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
let deleteItem = async () => {
|
|
100
|
-
await commune("deleteItem", {
|
|
101
|
-
name: $("#general").val()
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let emailTime = async () => {
|
|
106
|
-
await commune("serveFront", {
|
|
107
|
-
script: "emailTime",
|
|
108
|
-
toEmail: "wyattsushi@gmail.com",
|
|
109
|
-
subject: "New Time Update!",
|
|
110
|
-
html: `New Time: 3 0976`
|
|
111
|
-
}, { route: currentRoute });
|
|
112
|
-
}
|
|
113
|
-
</script>
|
|
File without changes
|
package/views/account.ejs
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
<div id="account" class="invisible content">
|
|
2
|
-
<p id="please-login">Please login to view your account settings.</p>
|
|
3
|
-
|
|
4
|
-
<div class="invisible settings">
|
|
5
|
-
<h3>Email:</h3>
|
|
6
|
-
<div class="setting" id="email">
|
|
7
|
-
<p></p>
|
|
8
|
-
<button onclick="accountServices.editEmail()">Change Email</button>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="edit invisible" id="email">
|
|
11
|
-
<input type="email" name="email">
|
|
12
|
-
<button onclick="accountServices.updateEmail()">Update</button>
|
|
13
|
-
<button onclick="accountServices.cancelEmail()">Cancel</button>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<hr>
|
|
17
|
-
|
|
18
|
-
<h3>Username:</h3>
|
|
19
|
-
<div class="setting" id="username">
|
|
20
|
-
<p></p>
|
|
21
|
-
<button onclick="accountServices.editUsername()">Change Username</button>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="edit invisible" id="username">
|
|
24
|
-
<input type="text" name="username">
|
|
25
|
-
<button onclick="accountServices.updateUsername()">Update</button>
|
|
26
|
-
<button onclick="accountServices.cancelUsername()">Cancel</button>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<hr>
|
|
30
|
-
|
|
31
|
-
<h3>Password:</h3>
|
|
32
|
-
<div class="setting" id="password">
|
|
33
|
-
<p>*********</p>
|
|
34
|
-
<p>Visit the Keeper to Change Your Password</p>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<p id="info"></p>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<script>
|
|
42
|
-
class AccountServices {
|
|
43
|
-
constructor() {
|
|
44
|
-
this.$emailSetting = $(".content#account .setting#email");
|
|
45
|
-
this.$email = this.$emailSetting.find("p");
|
|
46
|
-
this.$emailEdit = $(".content#account .edit#email");
|
|
47
|
-
this.$emailInput = this.$emailEdit.find("input");
|
|
48
|
-
|
|
49
|
-
this.$usernameSetting = $(".content#account .setting#username");
|
|
50
|
-
this.$username = this.$usernameSetting.find("p");
|
|
51
|
-
this.$usernameEdit = $(".content#account .edit#username");
|
|
52
|
-
this.$usernameInput = this.$usernameEdit.find("input");
|
|
53
|
-
|
|
54
|
-
this.$passwordSetting = $(".content#account .setting#password");
|
|
55
|
-
this.$passwordEdit = $(".content#account .edit#password");
|
|
56
|
-
this.$passwordInput = this.$passwordEdit.find("input");
|
|
57
|
-
|
|
58
|
-
this.$info = $(".content#account #info");
|
|
59
|
-
|
|
60
|
-
<% if (user) { %>
|
|
61
|
-
this.username = "<%= user.username %>";
|
|
62
|
-
this.email = "<%= user.email %>";
|
|
63
|
-
|
|
64
|
-
this.refresh();
|
|
65
|
-
<% } %>
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async refresh() {
|
|
69
|
-
this.$email.text(this.email);
|
|
70
|
-
this.$emailInput.val(this.email);
|
|
71
|
-
this.$username.text(this.username);
|
|
72
|
-
this.$usernameInput.val(this.username);
|
|
73
|
-
|
|
74
|
-
$(".content#account .settings").removeClass("invisible");
|
|
75
|
-
$(".content#account #please-login").addClass("invisible");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
editEmail() {
|
|
79
|
-
this.$emailSetting.addClass("invisible");
|
|
80
|
-
this.$emailEdit.removeClass("invisible");
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
cancelEmail() {
|
|
84
|
-
this.$emailSetting.removeClass("invisible");
|
|
85
|
-
this.$emailEdit.addClass("invisible");
|
|
86
|
-
this.$emailInput.val(this.$email.text());
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async updateEmail() {
|
|
90
|
-
let response = await commune("changeUserEmail", { email: this.$emailInput.val() });
|
|
91
|
-
|
|
92
|
-
this.$email.text(this.$emailInput.val());
|
|
93
|
-
this.cancelEmail();
|
|
94
|
-
this.$info.text("Email Updated!");
|
|
95
|
-
|
|
96
|
-
location.reload();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
editUsername() {
|
|
100
|
-
this.$usernameSetting.addClass("invisible");
|
|
101
|
-
this.$usernameEdit.removeClass("invisible");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
cancelUsername() {
|
|
105
|
-
this.$usernameSetting.removeClass("invisible");
|
|
106
|
-
this.$usernameEdit.addClass("invisible");
|
|
107
|
-
this.$usernameInput.val(this.$username.text());
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async updateUsername() {
|
|
111
|
-
let response = await commune("changeUsername", { username: this.$usernameInput.val() });
|
|
112
|
-
|
|
113
|
-
this.$username.text(this.$usernameInput.val());
|
|
114
|
-
this.cancelUsername();
|
|
115
|
-
this.$info.text("Username Updated!");
|
|
116
|
-
|
|
117
|
-
location.reload();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let accountServices = new AccountServices();
|
|
122
|
-
</script>
|
package/views/inventory.ejs
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
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-list">
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
class Inventory {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.$div = $(".inventory");
|
|
14
|
-
this.$list = $(".inventory .item-list");
|
|
15
|
-
this.$search = $(".inventory .search");
|
|
16
|
-
this.$searchResults = $(".search-results");
|
|
17
|
-
this.searchResults = [];
|
|
18
|
-
this.$error = $("#inventory #error");
|
|
19
|
-
this.items = [];
|
|
20
|
-
|
|
21
|
-
this.refresh();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async change(itemName, amount) {
|
|
25
|
-
let change = {
|
|
26
|
-
name: itemName,
|
|
27
|
-
amount: amount
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let response = await commune("updateItemInInventory", change);
|
|
31
|
-
|
|
32
|
-
if (response.status === "success") {
|
|
33
|
-
let holding = false;
|
|
34
|
-
|
|
35
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
36
|
-
if (this.items[i].name === response.data.name) {
|
|
37
|
-
this.items[i].amount = response.data.amount;
|
|
38
|
-
holding = true;
|
|
39
|
-
|
|
40
|
-
if (response.data.amount <= 0) this.items.splice(i, 1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!holding && response.data.amount > 0 && response.data.name) {
|
|
45
|
-
this.items.push(response.data);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
this.render();
|
|
49
|
-
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
else return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async getData() {
|
|
56
|
-
await $.post("/s", JSON.stringify({ action: "getUserInventory" }), (res) => {
|
|
57
|
-
if (res.status === "success") {
|
|
58
|
-
this.items = res.data;
|
|
59
|
-
|
|
60
|
-
this.clearError();
|
|
61
|
-
}
|
|
62
|
-
else console.log(res);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
render() {
|
|
67
|
-
this.$list.empty();
|
|
68
|
-
|
|
69
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
70
|
-
let $new = this.$list.append(
|
|
71
|
-
`<div class="item-card">
|
|
72
|
-
<h5>${this.items[i].name}</h5>
|
|
73
|
-
<button id="${i}">X</button>
|
|
74
|
-
<hr>
|
|
75
|
-
<p>${this.items[i].amount}</p>
|
|
76
|
-
</div>`
|
|
77
|
-
).children().last();
|
|
78
|
-
|
|
79
|
-
$new.find("button").on("click", this.reduceItem);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
reduceItem = (e) => {
|
|
84
|
-
let which = parseInt(e.currentTarget.id);
|
|
85
|
-
|
|
86
|
-
this.change(this.items[which].name, -1);
|
|
87
|
-
|
|
88
|
-
this.clearError();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async refresh() {
|
|
92
|
-
await this.getData();
|
|
93
|
-
this.render();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
clearError() {
|
|
97
|
-
this.$error.addClass("invisible");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
setError(text) {
|
|
101
|
-
this.$error.text(text);
|
|
102
|
-
this.$error.removeClass("invisible");
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
hasItem(itemName, minAmount = 1) {
|
|
106
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
107
|
-
if (this.items[i].item.name === itemName) {
|
|
108
|
-
if (this.items[i].amount >= minAmount) return true;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let playerInventory = new Inventory();
|
|
117
|
-
</script>
|
package/views/more.ejs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<div class="content invisible" id="more">
|
|
2
|
-
<h4>Message Nother</h4>
|
|
3
|
-
<textarea id="content"></textarea>
|
|
4
|
-
<button id="send" onclick="sendMessageToNother()">Send Message</button>
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
let sendMessageToNother = async () => {
|
|
9
|
-
await commune("contactNother", {
|
|
10
|
-
content: $(".menu .content#more #content").val(),
|
|
11
|
-
route: currentRoute
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
$(".menu .content#more #content").val("");
|
|
15
|
-
}
|
|
16
|
-
</script>
|
package/views/player.ejs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<div class="content invisible" id="player">
|
|
2
|
-
<p id="please-login">Please login to view your player stats.</p>
|
|
3
|
-
</div>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
class PlayerAttributes {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.$content = $(".content#player");
|
|
9
|
-
this.attributes = [];
|
|
10
|
-
|
|
11
|
-
<% if (user) { %>
|
|
12
|
-
this.refresh();
|
|
13
|
-
<% } %>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async set(change, to) {
|
|
17
|
-
let response = await commune("setAttribute", { change: change, to: to });
|
|
18
|
-
this.attributes = response.data;
|
|
19
|
-
await this.render();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async increment(which) {
|
|
23
|
-
let response = await commune("incrementAttribute", { change: which, max: 20 });
|
|
24
|
-
this.attributes[which] = response.data;
|
|
25
|
-
await this.render();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async check(which, against) {
|
|
29
|
-
let response = await commune("checkAttribute", { check: which, against: against });
|
|
30
|
-
await this.render();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async refresh() {
|
|
34
|
-
let response = await commune("attributes");
|
|
35
|
-
this.attributes = response.data;
|
|
36
|
-
|
|
37
|
-
this.render();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
render() {
|
|
41
|
-
this.$content.empty();
|
|
42
|
-
|
|
43
|
-
for (const [key, value] of Object.entries(this.attributes)) {
|
|
44
|
-
<% if (user && user.authLevels.includes("Creator")) { %>
|
|
45
|
-
this.$content.append(`<h3 id="${key}">
|
|
46
|
-
${key}: ${value}
|
|
47
|
-
<input type="number"></input>
|
|
48
|
-
<button onclick="playerAttributes.set('${key}', $('.content#player h3#${key} input').val())">Set</button>
|
|
49
|
-
<button onclick="playerAttributes.increment('${key}')">+</button>
|
|
50
|
-
<button onclick="playerAttributes.check('${key}', $('.content#player h3#${key} input').val())">Check</button>
|
|
51
|
-
</h3>`);
|
|
52
|
-
<% } else { %>
|
|
53
|
-
this.$content.append(`<h3 id="${key}">${key}: ${value}</h3>`);
|
|
54
|
-
<% } %>
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let playerAttributes = new PlayerAttributes();
|
|
60
|
-
</script>
|