From 88fb0fbfc9f58dc93420b31ee5a5201d1a37ca85 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 15 Mar 2022 19:16:19 +0100 Subject: Fix: fixes issue #21 --- update/ponies/parse.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'update/ponies') diff --git a/update/ponies/parse.js b/update/ponies/parse.js index c4cc1d4..28ba1d8 100755 --- a/update/ponies/parse.js +++ b/update/ponies/parse.js @@ -93,27 +93,39 @@ global.ponies = {}; if (typeof box.coat !== "undefined") data.color = box.coat.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { return i.replace(//g, "").trim().replace(/\[([a-z.\/ \nA-Z0-9:]*)\/(.{6})\/ (.*)\]/gm, "$2").replace(/{{perbang\|([0-9A-Fa-f].{5})(.*)/g, "$1").replace(/\[(.*)\/(.*)\/ (.*)\]/g, "$2"); })[0]; try { - if (typeof box.coat !== "undefined") data.search.coat = box.coat.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { + index = 0; + cdata = box.coat.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { try { + console.log("eyes", index); return colorlib("#" + i.replace(//g, "").trim().replace(/\[([a-z.\/ \nA-Z0-9:]*)\/(.{6})\/ (.*)\]/gm, "$2").replace(/{{perbang\|([0-9A-Fa-f].{5})(.*)/g, "$1").replace(/\[(.*)\/(.*)\/ (.*)\]/g, "$2")); } catch (e) {} - }).filter(i => typeof i !== "number"); + index++; + }).filter(i => typeof i === "number"); + if (typeof box.coat !== "undefined") data.search.coat = [...new Set(cdata)]; } catch (e) {} try { - if (typeof box.eyes !== "undefined") data.search.eyes = box.eyes.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { + index = 0; + cdata = box.eyes.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { try { + console.log("eyes", index); return colorlib("#" + i.replace(//g, "").trim().replace(/\[([a-z.\/ \nA-Z0-9:]*)\/(.{6})\/ (.*)\]/gm, "$2").replace(/{{perbang\|([0-9A-Fa-f].{5})(.*)/g, "$1").replace(/\[(.*)\/(.*)\/ (.*)\]/g, "$2")); } catch (e) {} - }).filter(i => typeof i !== "number"); + index++; + }).filter(i => typeof i === "number") + if (typeof box.eyes !== "undefined") data.search.eyes = [...new Set(cdata)]; } catch (e) {} try { - if (typeof box.mane !== "undefined") data.search.mane = box.mane.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { + index = 0; + cdata = box.mane.trim().replace(/<( ||(|| )\/)( ||(|| )\/)(b|B)(r|R)( ||(|| )\/)( ||(|| )\/)>/gm, "|").split("|").map((i) => { try { + console.log("eyes", index); return colorlib("#" + i.replace(//g, "").trim().replace(/\[([a-z.\/ \nA-Z0-9:]*)\/(.{6})\/ (.*)\]/gm, "$2").replace(/{{perbang\|([0-9A-Fa-f].{5})(.*)/g, "$1").replace(/\[(.*)\/(.*)\/ (.*)\]/g, "$2")); } catch (e) {} - }).filter(i => typeof i !== "number"); + index++; + }).filter(i => typeof i === "number"); + if (typeof box.mane !== "undefined") data.search.mane = [...new Set(cdata)]; } catch (e) {} try { -- cgit