Updated eslintrc and code

Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
2023-11-24 14:10:07 +01:00
parent 81cd6940b2
commit e6fc6296c4
7 changed files with 24 additions and 9 deletions

View File

@@ -31,7 +31,7 @@ module.exports = {
"windows" "windows"
], ],
"quotes": [ "quotes": [
"error", "warn",
"double" "double"
], ],
"semi": [ "semi": [
@@ -45,6 +45,20 @@ module.exports = {
"args": "after-used", "args": "after-used",
"ignoreRestSiblings": false "ignoreRestSiblings": false
} }
] ],
"prefer-const": "warn",
"no-var": "error",
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
"no-lonely-if": "error",
"no-empty-function": "error",
"no-inline-comments": "error",
"no-trailing-spaces": ["error"],
"arrow-spacing": ["warn", { "before": true, "after": true }],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"comma-spacing": "error",
} }
} }

View File

@@ -7,6 +7,7 @@ module.exports = {
name: "check", name: "check",
description: "Check a player's stats.", description: "Check a player's stats.",
type: "slash", type: "slash",
dev: true,
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("check") .setName("check")

View File

@@ -30,7 +30,7 @@ module.exports = {
} }
let fields = [] const fields = []
for (let i = 0; i < accepted.length; i++) { for (let i = 0; i < accepted.length; i++) {

View File

@@ -4,7 +4,7 @@
function getExpForLevel(level) { function getExpForLevel(level) {
if (level == 0) return 0 if (level == 0) return 0
let respectedLevel = getLevelRespectingPrestige(level) const respectedLevel = getLevelRespectingPrestige(level)
if (respectedLevel > EASY_LEVELS) { if (respectedLevel > EASY_LEVELS) {
return 5000 return 5000
} }
@@ -37,12 +37,12 @@ const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP
const LEVELS_PER_PRESTIGE = 100 const LEVELS_PER_PRESTIGE = 100
const HIGHEST_PRESTIGE = 50 const HIGHEST_PRESTIGE = 50
function bedwarsLevel(exp) { function bedwarsLevel(exp) {
let prestiges = Math.floor(exp / XP_PER_PRESTIGE) const prestiges = Math.floor(exp / XP_PER_PRESTIGE)
let level = prestiges * LEVELS_PER_PRESTIGE let level = prestiges * LEVELS_PER_PRESTIGE
let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE) let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE)
for (let i = 1; i <= EASY_LEVELS; ++i) { for (let i = 1; i <= EASY_LEVELS; ++i) {
let expForEasyLevel = getExpForLevel(i) const expForEasyLevel = getExpForLevel(i)
if (expWithoutPrestiges < expForEasyLevel) { if (expWithoutPrestiges < expForEasyLevel) {
break break
} }

View File

@@ -2,7 +2,7 @@
Code used from the slothpixel project https://github.com/slothpixel/core Code used from the slothpixel project https://github.com/slothpixel/core
*/ */
function skywarsLevel(xp) { function skywarsLevel(xp) {
let xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000] const xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000]
let exactLevel = 0 let exactLevel = 0
if (xp >= 15000) { if (xp >= 15000) {
exactLevel = (xp - 15000) / 10000 + 12 exactLevel = (xp - 15000) / 10000 + 12