summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/score.js21
-rw-r--r--index.js9
-rw-r--r--matrix.js145
3 files changed, 137 insertions, 38 deletions
diff --git a/commands/score.js b/commands/score.js
index e69a136..05fdbff 100644
--- a/commands/score.js
+++ b/commands/score.js
@@ -6,5 +6,24 @@ module.exports = (parameter, wrapper) => {
return;
}
- wrapper.send("💘 The current love score is **" + score['percentage'].toFixed(2) + "%**.");
+ let worth = 1 / (score['score'] / 100);
+ if (worth < 0.1) worth = 0.1;
+
+ let difficulty = "neither easy or hard";
+
+ if (worth > 3) {
+ difficulty = "extremely easy";
+ } else if (worth > 2) {
+ difficulty = "very easy";
+ } else if (worth > 1.25) {
+ difficulty = "easy";
+ } else if (worth < 0.75) {
+ difficulty = "hard";
+ } else if (worth < 0.5) {
+ difficulty = "very hard";
+ } else if (worth < 0.25) {
+ difficulty = "extremely hard";
+ }
+
+ wrapper.send("💘 The current love score is **" + score['percentage'].toFixed(2) + "%** (" + Math.floor(score['score']) + " points), your score multiplier is ×" + worth.toFixed(2) + ", it is **" + difficulty + "** to get points.");
} \ No newline at end of file
diff --git a/index.js b/index.js
index 72d7f63..d4fdcd2 100644
--- a/index.js
+++ b/index.js
@@ -34,7 +34,14 @@ let lastSavedScore = JSON.stringify(score);
global.maxCredits = {
month: 400
-};
+}
+
+setInterval(() => {
+ let worth = 1 / (score['score'] / 100);
+ if (worth < 0.1) worth = 0.1;
+
+ if (score['score'] > 0) score['score'] -= worth;
+}, 1800000);
setInterval(() => {
if (JSON.stringify(ratelimits) !== lastSavedRateLimits) {
diff --git a/matrix.js b/matrix.js
index 1d78faa..cd73de4 100644
--- a/matrix.js
+++ b/matrix.js
@@ -86,42 +86,115 @@ function startMatrix() {
let text = event.event.content.body.toLowerCase();
if (event.event.sender === "@cloudburst:equestria.dev" || event.event.sender === "@raindrops:equestria.dev") {
- if (text.includes("...")) {
- score['score'] -= text.replace(/[^.]/gm, "").length;
- } else if (text.includes("bye")) {
- score['score'] -= 50;
- } else if (text.endsWith(".")) {
- score['score'] -= 10;
- } else if (text.match(/^\*(.*)\*$/gm)) {
- score['score'] += 2;
- } else if (text.includes("❤")) {
- score['score'] += text.replace(/[^❤]/gm, "").length;
- } else if (text.includes("hehe")) {
- score['score'] += 2;
- } else if (text.includes("pff")) {
- score['score'] += 2;
- } else if (text.includes("cutie")) {
- score['score'] += 2;
- } else if (text.includes("sweetie")) {
- score['score'] += 2;
- } else if (text.includes("sis")) {
- score['score'] += 2;
- } else if (text.includes("hehehehe")) {
- score['score'] += 4;
- } else if (text.includes("hehehe")) {
- score['score'] += 3;
- } else if (text.includes("/s")) {
- score['score'] += 3;
- } else if (text.includes("love you")) {
- score['score'] += 5;
- } else if (text.includes("love u")) {
- score['score'] += 5;
- } else if (text.includes("^c^")) {
- score['score'] += 3;
- }
-
- if (Math.floor(score['percentage']) > Math.floor(score['score'] / 20)) {
- matrixSend(room.roomId, "🎉 Congrats! Your love score is now at " + Math.floor(score['score'] / 20) + ", keep it up!");
+ let worth = 1 / (score['score'] / 100);
+ if (worth < 0.1) worth = 0.1;
+
+ if (score['score'] === 0) {
+ score['score'] = 0.01;
+ }
+
+ if (text.includes("....")) {
+ score['score'] -= text.replace(/[^.]/gm, "").length * worth;
+ }
+
+ if (text.replace(/[^.]/gm, "").length === text.length) {
+ score['score'] -= text.replace(/[^.]/gm, "").length * 5 * worth;
+ }
+
+ if (text.includes(".c.")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("-c-")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("bye")) {
+ score['score'] -= 50 * worth;
+ }
+
+ if (text.endsWith(".")) {
+ score['score'] -= 10 * worth;
+ }
+
+ if (text.match(/^\*(.*)\*$/gm)) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("❤")) {
+ score['score'] += text.replace(/[^❤]/gm, "").length * 3 * worth;
+ }
+
+ if (text.includes("hehe")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("pff")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("mhm!")) {
+ score['score'] += 1 * worth;
+ }
+
+ if (text.includes("cutie")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("silly")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("sweetie")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("sis")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("nini")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("good night")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("hehehehe")) {
+ score['score'] += 4 * worth;
+ }
+
+ if (text.includes("hehehe")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("woo!")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("yay!")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("/s")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("love you")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("love u")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("^c^")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (Math.floor(score['percentage']) < Math.floor(score['score'] / 20)) {
+ matrixSend(room.roomId, "🎉 Congrats! Your love score is now at " + Math.floor(score['score'] / 20) + "%, keep it up!");
}
score['percentage'] = score['score'] / 20;