Added eslintrc config and updated all files to it

This commit is contained in:
2023-11-22 23:50:21 +01:00
parent 10771fd04e
commit 3d4fc1fccb
70 changed files with 1276 additions and 1234 deletions

View File

@@ -18,39 +18,39 @@ function guildLevel(exp) {
2500000,
2500000,
3000000,
];
]
let level = 0;
let level = 0
// Increments by one from zero to the level cap
for (let i = 0; i <= 1000; i += 1) {
// need is the required exp to get to the next level
let need = 0;
let need = 0
if (i >= EXP_NEEDED.length) {
need = EXP_NEEDED[EXP_NEEDED.length - 1];
} else { need = EXP_NEEDED[i]; }
need = EXP_NEEDED[EXP_NEEDED.length - 1]
} else { need = EXP_NEEDED[i] }
// If the required exp to get to the next level isn't met returns
// the current level plus progress towards the next (unused exp/need)
// Otherwise increments the level and substracts the used exp from exp var
if ((exp - need) < 0) {
return Math.round((level + (exp / need)) * 100) / 100;
return Math.round((level + (exp / need)) * 100) / 100
}
level += 1;
exp -= need;
level += 1
exp -= need
}
// Returns the level cap - currently 1000
// If changed here, also change in for loop above
return 1000;
return 1000
}
/*
Code used from the hypixel-guild-bot project https://github.com/SimplyNo/hypixel-guild-bot
*/
function scaledGEXP(input) {
if (input <= 200000) return Number(input);
if (input <= 700000) return Number(Math.round(((input - 200000) / 10) + 200000));
if (input > 700000) return Number(Math.round(((input - 700000) / 33) + 250000));
if (input <= 200000) return Number(input)
if (input <= 700000) return Number(Math.round(((input - 200000) / 10) + 200000))
if (input > 700000) return Number(Math.round(((input - 700000) / 33) + 250000))
}
module.exports = { guildLevel, scaledGEXP }