From c3b756f987ffd8ca981c1e6f23435c74aad36aea Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Sat, 10 Jul 2021 16:03:26 +0200 Subject: Fixes --- views/script/global_levelsapi.js | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 views/script/global_levelsapi.js (limited to 'views/script/global_levelsapi.js') diff --git a/views/script/global_levelsapi.js b/views/script/global_levelsapi.js new file mode 100644 index 0000000..ebd969d --- /dev/null +++ b/views/script/global_levelsapi.js @@ -0,0 +1,47 @@ +module.exports = class LevelsAPI { + + associates; + + constructor() { + + let assocs_raw; + let assocs_lines; + let assocs_base; + let assocs; + let score; + let cline; + let line; + let clvl; + + assocs_raw = require('fs').readFileSync("./online/levels.txt"); + assocs_lines = assocs_raw.toString().split("\n"); + assocs_base = {}; + + for (line of assocs_lines) { + cline = line.split(":"); + assocs_base[cline[1].trim()] = cline[0].trim() - 1 + 1; + } + + assocs = {}; + + clvl = 0; + for (let c = 0; c <= 5051; c++) { + if (assocs_base[c.toString()] !== undefined) { + clvl = assocs_base[c.toString()]; + } + assocs[c.toString()] = clvl.toString() + } + + this.associates = assocs; + + } + + correspond(score, god) { + if (score <= 5051) { + return this.associates[score].toString(); + } else { + return god; + } + } + +} \ No newline at end of file -- cgit From d5a620cf09b835db2bccd99556525c90b458719f Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 5 Aug 2021 17:21:23 +0200 Subject: i18n for 21.08 --- views/script/global_levelsapi.js | 92 ++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'views/script/global_levelsapi.js') diff --git a/views/script/global_levelsapi.js b/views/script/global_levelsapi.js index ebd969d..45a74d2 100644 --- a/views/script/global_levelsapi.js +++ b/views/script/global_levelsapi.js @@ -1,47 +1,47 @@ -module.exports = class LevelsAPI { - - associates; - - constructor() { - - let assocs_raw; - let assocs_lines; - let assocs_base; - let assocs; - let score; - let cline; - let line; - let clvl; - - assocs_raw = require('fs').readFileSync("./online/levels.txt"); - assocs_lines = assocs_raw.toString().split("\n"); - assocs_base = {}; - - for (line of assocs_lines) { - cline = line.split(":"); - assocs_base[cline[1].trim()] = cline[0].trim() - 1 + 1; - } - - assocs = {}; - - clvl = 0; - for (let c = 0; c <= 5051; c++) { - if (assocs_base[c.toString()] !== undefined) { - clvl = assocs_base[c.toString()]; - } - assocs[c.toString()] = clvl.toString() - } - - this.associates = assocs; - - } - - correspond(score, god) { - if (score <= 5051) { - return this.associates[score].toString(); - } else { - return god; - } - } - +module.exports = class LevelsAPI { + + associates; + + constructor() { + + let assocs_raw; + let assocs_lines; + let assocs_base; + let assocs; + let score; + let cline; + let line; + let clvl; + + assocs_raw = require('fs').readFileSync("./online/levels.txt"); + assocs_lines = assocs_raw.toString().split("\n"); + assocs_base = {}; + + for (line of assocs_lines) { + cline = line.split(":"); + assocs_base[cline[1].trim()] = cline[0].trim() - 1 + 1; + } + + assocs = {}; + + clvl = 0; + for (let c = 0; c <= 5051; c++) { + if (assocs_base[c.toString()] !== undefined) { + clvl = assocs_base[c.toString()]; + } + assocs[c.toString()] = clvl.toString() + } + + this.associates = assocs; + + } + + correspond(score, god) { + if (score <= 5051) { + return this.associates[score].toString(); + } else { + return god; + } + } + } \ No newline at end of file -- cgit