diff --git a/public/images/cloudflare-being-stupid.png b/public/images/cloudflare-being-stupid.png new file mode 100644 index 0000000..870c2cb Binary files /dev/null and b/public/images/cloudflare-being-stupid.png differ diff --git a/public/pages/test-loader.html b/public/pages/test-loader.html new file mode 100644 index 0000000..f472c63 --- /dev/null +++ b/public/pages/test-loader.html @@ -0,0 +1,270 @@ + + + + + + FP650 - Unfinished page + + + + + + + + + +

Page under construction.

+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ + + diff --git a/public/raw/bombs.tar.gz b/public/raw/bombs.tar.gz new file mode 100644 index 0000000..9ba4f81 Binary files /dev/null and b/public/raw/bombs.tar.gz differ diff --git a/public/raw/mc-parse.js b/public/raw/mc-parse.js new file mode 100644 index 0000000..397afa0 --- /dev/null +++ b/public/raw/mc-parse.js @@ -0,0 +1,52 @@ +function forExtraColor(part) { + let ret = ""; + const colorMap = {"black": "0", "dark_blue": "1", "dark_green": "2", "dark_aqua": "3", "dark_red": "4", "dark_purple": "5", "gold": "6", "gray": "7", "dark_gray": "8", "blue": "9", "green": "a", "aqua": "b", "red": "c", "light_purple": "e", "white": "f"} + for (let index in part) { + if (!!part[index]["extra"]) ret += forExtraColor(part[index]["extra"]); + else { + let data = part[index]; + let text = data["text"] != undefined? data["text"] : data[""]; + if (data["bold"] == 1) ret += "§l"; + if (!!data["color"]) ret += "§" + colorMap[data["color"]]; + if (data["obfuscated"] == 1) ret += "§k"; + if (data["strikethrough"] == 1) ret += "§m"; + if (data["underline"] == 1) ret += "§n"; + if (data["italic"] == 1) ret += "§o"; + ret += text; + if (data["bold"] == 1 || !!data["color"] || data["obfuscated"] == 1 || data["strikethrough"] == 1 || data["underline"] == 1 || data["italic"] == 1) ret += "§r"; + } + } + return ret; +} + +function forExtra(part) { + let ret = ""; + for (let index in part) { + if (!!part[index]["extra"]) ret += forExtra(part[index]["extra"]); + else { + let data = part[index]; + let text = data["text"] != undefined? data["text"] : data[""]; + ret += text; + } + } + return ret; +} + +function parseMessage(message, color = true) { + let ret = ""; + if (color) { + for (let label in message) { + if (label == "extra") ret += forExtraColor(message[label]); + } + } else { + for (let label in message) { + if (label == "extra") ret += forExtra(message[label]); + } + } + if (typeof message == "string") ret = message; + if (!ret) console.warn("Message parsing resulted in no output! Raw message follows.", message) + if (typeof message == "string") console.warn("Passing raw strings to this method is not recommended, and may result in ambigous behavior!") + return ret; +} + +module.exports = { parseMessage }