-
item
+
+
+
diff --git a/items.js b/items.js
index 2973536..d6b48d1 100644
--- a/items.js
+++ b/items.js
@@ -1,11 +1,45 @@
+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 doItemSearch() {
+ window.scrollTo(0, 0);
+ let input_json = document.getElementById("query-json").value;
+ let input = JSON.parse(input_json);
+ let items_copy = items.slice();
+ document.getElementById("main").textContent = "";
+ for (const _query of input) {
+ const query = queryTypeMap.get(_query.queryType)(_query.value);
+ items_copy = applyQuery(items_copy, query);
+ }
+ document.getElementById("summary").textContent = items_copy.length + " results."
+ displayItems(items_copy);
+}
+
function init() {
+ return;
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("sdRaw");
+ items_copy = applyQuery(items_copy, query1);
+
+ let query2 = new TypeQuery("helmet");
+ 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 0000000..5e5d552
Binary files /dev/null and b/media/icons/atlas64.png differ
diff --git a/media/icons/searcher.png b/media/icons/searcher.png
index a42a2c2..00f4a92 100644
Binary files a/media/icons/searcher.png and b/media/icons/searcher.png differ
diff --git a/media/items/generic-bow.png b/media/items/generic-bow.png
index 2975c47..1313b1d 100644
Binary files a/media/items/generic-bow.png and b/media/items/generic-bow.png differ
diff --git a/media/items/generic-bracelet.png b/media/items/generic-bracelet.png
index be796d1..abd99b7 100644
Binary files a/media/items/generic-bracelet.png and b/media/items/generic-bracelet.png differ
diff --git a/media/items/generic-chestplate.png b/media/items/generic-chestplate.png
index c95c000..0f90a4c 100644
Binary files a/media/items/generic-chestplate.png and b/media/items/generic-chestplate.png differ
diff --git a/media/items/generic-dagger.png b/media/items/generic-dagger.png
index 2975c47..f90e830 100644
Binary files a/media/items/generic-dagger.png and b/media/items/generic-dagger.png differ
diff --git a/media/items/generic-necklace.png b/media/items/generic-necklace.png
index 5e4988e..e1cedda 100644
Binary files a/media/items/generic-necklace.png and b/media/items/generic-necklace.png differ
diff --git a/media/items/generic-relik.png b/media/items/generic-relik.png
index 2975c47..0593e15 100644
Binary files a/media/items/generic-relik.png and b/media/items/generic-relik.png differ
diff --git a/media/items/generic-ring.png b/media/items/generic-ring.png
index 4c49a79..ef0fa52 100644
Binary files a/media/items/generic-ring.png and b/media/items/generic-ring.png differ
diff --git a/media/items/generic-spear.png b/media/items/generic-spear.png
index 2975c47..96299d6 100644
Binary files a/media/items/generic-spear.png and b/media/items/generic-spear.png differ
diff --git a/media/items/generic-wand.png b/media/items/generic-wand.png
index 2975c47..2aa60f5 100644
Binary files a/media/items/generic-wand.png and b/media/items/generic-wand.png differ
diff --git a/query.js b/query.js
index c0d974c..2f6f4fe 100644
--- a/query.js
+++ b/query.js
@@ -1,21 +1,57 @@
+let queryTypeMap = new Map();
-/**
- * @description A query into the item
- * @module ItemNotFound
- */
class NameQuery {
- constructor(string) {
- this.queryString = string;
- }
+ constructor(string) { this.queryString = string.toLowerCase(); }
filter(item) {
if (item.remapID === undefined) {
- return (item.displayName.includes(this.queryString));
+ return (item.displayName.toLowerCase().includes(this.queryString));
}
return false;
}
- compare(a, b) {
- return a < b;
+ compare(a, b) { return a < b; }
+}
+queryTypeMap.set("name", function(s) { return new NameQuery(s); } );
+
+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; }
+}
+queryTypeMap.set("type", function(s) { return new TypeQuery(s); } );
+
+class CategoryQuery {
+ constructor(category) { this.category = category; }
+
+ filter(item) {
+ if (item.remapID === undefined) {
+ return (item.category === this.category);
+ }
+ return false;
+ }
+
+ compare(a, b) { return a < b; }
+}
+queryTypeMap.set("category", function(s) { return new CategoryQuery(s); } );
+
+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]);
}
}
+queryTypeMap.set("stat", function(s) { return new IdQuery(s); } );
diff --git a/translations.txt b/translations.txt
new file mode 100644
index 0000000..82f4912
--- /dev/null
+++ b/translations.txt
@@ -0,0 +1,88 @@
+Mapping from API name to shortened names
+
+"name": "name",
+"displayName": "displayName",
+"tier": "tier",
+"set": "set",
+"sockets": "slots",
+"type": "type",
+"dropType": "drop",
+"quest": "quest",
+"restrictions": "restrict",
+"damage": "nDam",
+"fireDamage": "fDam",
+"waterDamage": "wDam",
+"airDamage": "aDam",
+"thunderDamage": "tDam",
+"earthDamage": "eDam",
+"attackSpeed": "atkSpd",
+"health": "hp",
+"fireDefense": "fDef",
+"waterDefense": "wDef",
+"airDefense": "aDef",
+"thunderDefense": "tDef",
+"earthDefense": "eDef",
+"level": "lvl",
+"classRequirement": "classReq",
+"strength": "strReq",
+"dexterity": "dexReq",
+"intelligence": "intReq",
+"agility": "agiReq",
+"defense": "defReq",
+"healthRegen": "hprPct",
+"manaRegen": "mr",
+"spellDamage": "sdPct",
+"damageBonus": "mdPct",
+"lifeSteal": "ls",
+"manaSteal": "ms",
+"xpBonus": "xpb",
+"lootBonus": "lb",
+"reflection": "ref",
+"strengthPoints": "str",
+"dexterityPoints": "dex",
+"intelligencePoints": "int",
+"agilityPoints": "agi",
+"defensePoints": "def",
+"thorns": "thorns",
+"exploding": "expd",
+"speed": "spd",
+"attackSpeedBonus": "atkTier",
+"poison": "poison",
+"healthBonus": "hpBonus",
+"soulPoints": "spRegen",
+"emeraldStealing": "eSteal",
+"healthRegenRaw": "hprRaw",
+"spellDamageRaw": "sdRaw",
+"damageBonusRaw": "mdRaw",
+"bonusFireDamage": "fDamPct",
+"bonusWaterDamage": "wDamPct",
+"bonusAirDamage": "aDamPct",
+"bonusThunderDamage": "tDamPct",
+"bonusEarthDamage": "eDamPct",
+"bonusFireDefense": "fDefPct",
+"bonusWaterDefense": "wDefPct",
+"bonusAirDefense": "aDefPct",
+"bonusThunderDefense": "tDefPct",
+"bonusEarthDefense": "eDefPct",
+"accessoryType": "type",
+"identified": "fixID",
+"skin": "skin",
+"category": "category",
+
+"spellCostPct1": "spPct1",
+"spellCostRaw1": "spRaw1",
+"spellCostPct2": "spPct2",
+"spellCostRaw2": "spRaw2",
+"spellCostPct3": "spPct3",
+"spellCostRaw3": "spRaw3",
+"spellCostPct4": "spPct4",
+"spellCostRaw4": "spRaw4",
+
+"rainbowSpellDamageRaw": "rainbowRaw",
+"sprint": "sprint",
+"sprintRegen": "sprintReg",
+"jumpHeight": "jh",
+"lootQuality": "lq",
+
+"gatherXpBonus": "gXp",
+"gatherSpeed": "gSpd",
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,
diff --git a/wide.css b/wide.css
index a96d397..0c826a0 100644
--- a/wide.css
+++ b/wide.css
@@ -15,7 +15,7 @@
}
.sticky-box {
position: sticky;
- top: 0;
+ top: 10px;
}
.summary {
padding: 2% 2% 0%;
+
+
+ +
+ Basic Dumb JSON search
+Query types:
+name, type, category, stat
+ ++ +
hello
+