From a78ecb800efc05258c7c1334d403eafc60afa1fb Mon Sep 17 00:00:00 2001 From: b Date: Sat, 23 Jan 2021 21:58:53 -0600 Subject: [PATCH] Update item searcher stuff --- crafter.html | 22 ++++++++++--------- crafter.js | 4 ++-- index.html | 17 ++++++++++----- items-narrow.css | 7 ++++++ items-wide.css | 8 +++++++ items.html | 47 ++++++++++++++++++++++++++++++---------- items.js | 29 ++++++++++++++++++++----- load.js | 2 +- media/icons/atlas64.png | Bin 0 -> 358 bytes query.js | 34 +++++++++++++++++++++++++---- updated.json | 2 +- 11 files changed, 131 insertions(+), 41 deletions(-) create mode 100644 items-narrow.css create mode 100644 items-wide.css create mode 100755 media/icons/atlas64.png diff --git a/crafter.html b/crafter.html index 12fbe32..95d11ce 100644 --- a/crafter.html +++ b/crafter.html @@ -17,22 +17,24 @@
- +
WynnBuilder
-
+ - - -
WynnCrafter
-
+ + +
WynnCrafter
+ + + + +
WynnAtlas
+
- -

- Forum thread (instructions/help) -

+
diff --git a/crafter.js b/crafter.js index cd428ce..57d8981 100644 --- a/crafter.js +++ b/crafter.js @@ -27,7 +27,7 @@ let ingFields = ["fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "hprPct" let player_craft; function setTitle() { - document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (ingredient db version "+ING_DB_VERSION+")"; + document.getElementById("header").textContent = "WynnCrafter version "+BUILD_VERSION+" (ingredient db version "+ING_DB_VERSION+")"; document.getElementById("header").classList.add("funnynumber"); } setTitle(); @@ -261,4 +261,4 @@ function resetFields() { calculateCraft(); } -load_ing_init(init); \ No newline at end of file +load_ing_init(init); diff --git a/index.html b/index.html index db3a283..279c331 100644 --- a/index.html +++ b/index.html @@ -20,15 +20,20 @@
diff --git a/items-narrow.css b/items-narrow.css new file mode 100644 index 0000000..dc4a7f6 --- /dev/null +++ b/items-narrow.css @@ -0,0 +1,7 @@ +.items { + padding: 0%; + display: grid; + grid-template-columns: repeat(1, 1fr); + width: 100%; + gap: 5px; +} diff --git a/items-wide.css b/items-wide.css new file mode 100644 index 0000000..0353758 --- /dev/null +++ b/items-wide.css @@ -0,0 +1,8 @@ +.items { + padding: 0%; + display: grid; + grid-template-columns: repeat(5, 1fr); + width: 100%; + gap: 5px; + grid-template-rows: masonry; +} diff --git a/items.html b/items.html index f5f128b..6253188 100644 --- a/items.html +++ b/items.html @@ -1,35 +1,58 @@ + + + + + Wynn Clientside - -
- Made by: hppeng and ferricles -
-
- Additional credits +



-
-
-
item
-
+
+ diff --git a/items.js b/items.js index 2973536..0a0419f 100644 --- a/items.js +++ b/items.js @@ -1,11 +1,30 @@ +function applyQuery(items, query) { + return items.filter(query.filter, query).sort(query.compare); +} + +function displayItems(items_copy) { + let items_parent = document.getElementById("main"); + for (let i in items_copy) { + let item = items_copy[i]; + let box = document.createElement("div"); + box.classList.add("box"); + box.id = "item"+i; + items_parent.appendChild(box); + displayExpandedItem(expandItem(item, []), box.id); + } +} + function init() { let items_copy = items.slice(); - let query = new NameQuery("Bob's"); - items_copy = items_copy.filter(query.filter, query).sort(query.compare); - let item = items_copy[0]; - console.log(item); - displayExpandedItem(expandItem(item, []), "test"); + //let query = new NameQuery("Bob's"); + let query1 = new IdQuery("poison"); + items_copy = applyQuery(items_copy, query1); + + let query2 = new TypeQuery("boots"); + items_copy = applyQuery(items_copy, query2); + + displayItems(items_copy); } load_init(init); diff --git a/load.js b/load.js index 1a65771..c60237b 100644 --- a/load.js +++ b/load.js @@ -64,7 +64,7 @@ function clean_item(item) { async function load(init_func) { let getUrl = window.location; - let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; + let baseUrl = getUrl.protocol + "//" + getUrl.host + "/";// + getUrl.pathname.split('/')[1]; let url = baseUrl + "/compress.json"; let result = await (await fetch(url)).json(); items = result.items; diff --git a/media/icons/atlas64.png b/media/icons/atlas64.png new file mode 100755 index 0000000000000000000000000000000000000000..5e5d552a0b185b988192c07f8a26a7effb6abe63 GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`032l#}z0%-{e2?q^^1qBQzW(Z_BF#Na>@c+X>pm=%DhsQvQvn0qb_&*dd z1p8MAfdmUYB8wRq_zr_Gxzg z?)0}V;AC*t6SQ>hpAz%^(i2_FM(JrmLdzMZT$tYZ_T&RGhG`57<@z~{*RCnx o5sA#q_|sVYApG2chX*9`84aQfoeDm`26~0T)78&qol`;+0B2o^WdHyG literal 0 HcmV?d00001 diff --git a/query.js b/query.js index c0d974c..c3bc06f 100644 --- a/query.js +++ b/query.js @@ -1,8 +1,4 @@ -/** - * @description A query into the item - * @module ItemNotFound - */ class NameQuery { constructor(string) { this.queryString = string; @@ -19,3 +15,33 @@ class NameQuery { return a < b; } } + +class TypeQuery { + constructor(type) { + this.type = type; + } + + filter(item) { + if (item.remapID === undefined) { + return (item.type === this.type); + } + return false; + } + + compare(a, b) { + return a < b; + } +} + +class IdQuery { + constructor(id) { + this.id = id; + this.compare = function(a, b) { + return b[id] - a[id]; + }; + } + + filter(item) { + return (this.id in item) && (item[this.id]); + } +} diff --git a/updated.json b/updated.json index 9b19c46..e938bc2 100644 --- a/updated.json +++ b/updated.json @@ -257086,7 +257086,7 @@ "tier": "Fabled", "type": "spear", "name": "Rhythm of Seasons", - "displayName": "Rhythm of Seasons", + "displayName": "Rhythm of the Seasons", "set": null, "quest": null, "classReq": null,