diff options
author | RaindropsSys <contact@minteck.org> | 2023-05-24 22:41:01 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-05-24 22:41:01 +0200 |
commit | 3f9157662323726c5aeafc4df1ce8347ec89c9e4 (patch) | |
tree | 7589b09f62811140f1192e98e7bb525ae9ac3e15 | |
parent | a58e83a4ad1e7686d94e26d06a582a47606efb2a (diff) | |
download | butterscotch-3f9157662323726c5aeafc4df1ce8347ec89c9e4.tar.gz butterscotch-3f9157662323726c5aeafc4df1ce8347ec89c9e4.tar.bz2 butterscotch-3f9157662323726c5aeafc4df1ce8347ec89c9e4.zip |
Updated 3 files (automated)
-rw-r--r-- | commands/score.js | 21 | ||||
-rw-r--r-- | index.js | 9 | ||||
-rw-r--r-- | matrix.js | 145 |
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 @@ -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) { @@ -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; |