From 00e126349a1da168bad26778cdd96a6da125536c Mon Sep 17 00:00:00 2001 From: Jason Coon <3598755+jasoncoon@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:47:01 -0500 Subject: [PATCH] Add & fix `Item Spawning Statues` set. Sort sets alphabetically. Fix find buttons not working with sets. Sync selected set & blocks list. --- resources/js/main.js | 36 +++++++++ resources/js/sets.js | 174 ++++++++++++++++++++++--------------------- 2 files changed, 126 insertions(+), 84 deletions(-) diff --git a/resources/js/main.js b/resources/js/main.js index 93f5cbb..8e05f3a 100644 --- a/resources/js/main.js +++ b/resources/js/main.js @@ -85,6 +85,42 @@ function addSetListItems() { function highlightSet(setIndex) { var set = sets[setIndex]; + var selectedValues = []; + + // clear and set selectedInfos + for(j = 0; j < blockSelector.options.length; j++) { + option = blockSelector.options[j]; + + var tileInfo = getTileInfoFromOption(option); + + if ( + tileInfo && + set.Entries.some( + (entry) => + ((entry.Id && entry.Id === tileInfo.Id) || + (entry.parent && + tileInfo.parent && + entry.parent.Id === tileInfo.parent.Id)) && + (!entry.U || entry.U === tileInfo.U) && + (!entry.V || entry.V === tileInfo.V) + ) + ) { + // if (option.prop) option.prop("selected", true); + option.selected = true; + selectedValues.push(tileInfo.Id); + // console.log({ tileInfo, option, set }); + } else { + if (option.prop) option.prop("selected", false); + option.selected = false; + } + } + + // console.log({blockSelector}); + + console.log({set}); + + // blockSelector.val(selectedValues); + highlightInfos(set.Entries); } diff --git a/resources/js/sets.js b/resources/js/sets.js index bffb497..333ab33 100644 --- a/resources/js/sets.js +++ b/resources/js/sets.js @@ -1,104 +1,135 @@ var sets = [ { - "Name": "Crimson Blocks", + "Name": "Chests", "Entries": [ { - "Id": "199", - "Name": "Flesh Grass", + "Id": "21", + "Name": "Chest", + "isTile": true + } + ] + }, + { + "Name": "Corruption Blocks", + "Entries": [ + { + "Id": "23", + "Name": "Corrupted Grass", "isTile": true }, { - "Id": "200", - "Name": "Red Ice", + "Id": "24", + "Name": "Corrupted Weeds", "isTile": true }, { - "Id": "201", - "Name": "Flesh Weeds", + "Id": "25", + "Name": "Ebonstone", "isTile": true }, { - "Id": "203", - "Name": " Block", + "Id": "32", + "Name": "Corruption Thorns", "isTile": true }, { - "Id": "205", - "Name": "Crimstone Vines", + "Id": "112", + "Name": "Ebonsand", "isTile": true }, { - "Id": "234", - "Name": "Crimsand", + "Id": "163", + "Name": "Purple Ice", "isTile": true }, { - "Id": "352", - "Name": "Crimtane Thorns", + "Id": "398", + "Name": "Corrupt Hardened Sand", "isTile": true }, { - "Id": "399", - "Name": "Crimson Hardened Sand", + "Id": "400", + "Name": "Corrupt Sandstone", "isTile": true }, { - "Id": "401", - "Name": "Crimson Sandstone", + "Id": "636", + "Name": "Corrupt Vines", "isTile": true } ] }, { - "Name": "Corruption Blocks", + "Name": "Crimson Blocks", "Entries": [ { - "Id": "23", - "Name": "Corrupted Grass", + "Id": "199", + "Name": "Flesh Grass", "isTile": true }, { - "Id": "24", - "Name": "Corrupted Weeds", + "Id": "200", + "Name": "Red Ice", "isTile": true }, { - "Id": "25", - "Name": "Ebonstone", + "Id": "201", + "Name": "Flesh Weeds", "isTile": true }, { - "Id": "32", - "Name": "Corruption Thorns", + "Id": "203", + "Name": " Block", "isTile": true }, { - "Id": "112", - "Name": "Ebonsand", + "Id": "205", + "Name": "Crimstone Vines", "isTile": true }, { - "Id": "163", - "Name": "Purple Ice", + "Id": "234", + "Name": "Crimsand", "isTile": true }, { - "Id": "398", - "Name": "Corrupt Hardened Sand", + "Id": "352", + "Name": "Crimtane Thorns", "isTile": true }, { - "Id": "400", - "Name": "Corrupt Sandstone", + "Id": "399", + "Name": "Crimson Hardened Sand", "isTile": true }, { - "Id": "636", - "Name": "Corrupt Vines", + "Id": "401", + "Name": "Crimson Sandstone", "isTile": true } ] }, + { + "Name": "Enchanted Items", + "Entries": [ + { + "Id": "55", + "Name": "Enchanted Boomerang", + "isItem": true + }, + { + "Id": "187", + "Name": "3x2 Decos - Enchanted Sword", + "U": 918, "V": 0, + "isTile": true + }, + { + "Id": "989", + "Name": "Enchanted Sword", + "isItem": true + } + ] + }, { "Name": "Hallow Blocks", "Entries": [ @@ -145,12 +176,28 @@ var sets = [ ] }, { - "Name": "Chests", + "Name": "Item Spawning Statues", "Entries": [ { - "Id": "21", - "Name": "Chest", - "isTile": true + "Id": "105", + "Name": "Bomb Statue", + "isItem": true, + "U": 612, + "V": 0 + }, + { + "Id": "105", + "Name": "Heart Statue", + "isItem": true, + "U": 1332, + "V": 0 + }, + { + "Id": "105", + "Name": "Star Statue", + "isTile": true, + "U": 72, + "V": 0 } ] }, @@ -174,46 +221,5 @@ var sets = [ "isItem": true } ] - }, - { - "Name": "Enchanted Items", - "Entries": [ - { - "Id": "55", - "Name": "Enchanted Boomerang", - "isItem": true - }, - { - "Id": "187", - "Name": "3x2 Decos - Enchanted Sword", - "U": 918, "V": 0, - "isTile": true - }, - { - "Id": "989", - "Name": "Enchanted Sword", - "isItem": true - } - ] - }, - { - "Name": "Item-summoning statues", - "Entries": [ - { - "Id": "473", - "Name": "Heart Statue", - "isItem": true - }, - { - "Id": "438", - "Name": "Star Statue", - "isTile": true - }, - { - "Id": "453", - "Name": "Bomb Statue", - "isItem": true - }, - ] - } + } ]