diff --git a/tunictracker/tracker/data/holy_cross_codes.json b/tunictracker/tracker/data/holy_cross_codes.json new file mode 100644 index 0000000..9dd44ea --- /dev/null +++ b/tunictracker/tracker/data/holy_cross_codes.json @@ -0,0 +1,69 @@ +{ + "Cathedral": { + "Secret Legend Door": "LULURULURDRRURDLDRDLDL" + }, + "Caustic Light Cave": { + "Casting Light Fairy": "RULURDRURDLDR" + }, + "Cube Cave": { + "Cube Fairy": "RRRRUUUURRRUUURRUURU" + }, + "East Forest": { + "Dancer Fairy": "UDUDLRLRDLUR", + "Obelisk Fairy": "DRDLULDLURULURURULURDRDRDLDRDLU" + }, + "Eastern Vault Fortress": { + "Candles Fairy": "RLDRUL" + }, + "Hourglass Cave": { + "Hourglass Door": "RULURULUURDLDRDLDR", + "Hourglass Fairy": "LURURDRURULLLURU" + }, + "Library Hall": { + "Library Fairy": "URDRULURULURDLDRURDRULURULULDRDLDRDL" + }, + "Lower Mountain": { + "Top Of Mountain Door": "ULDLULDLURURULURDRULULURULDLURUULURDRDRURDLDRURRDRURDRURRDLDLDRDRDLLDRDLDRURDRURRDDLURULDLULULURRULU" + }, + "Maze Cave": { + "Maze Fairy": "ULDLURDRURDLULU" + }, + "Old House": { + "Old House Door": "ULDRDL", + "Old House Fairy": "UURDDRUURDDD" + }, + "Overworld": { + "Back To Work Treasure": "RDLULLDRRDD", + "Compass Fairy": "LRDUUDRLURDLUDRL", + "Fire Wand Obelisk Page": "URDLDRUL", + "Fountain Cross Door": "URDLDLU", + "Fountain Fairy": "DLLDURD", + "Lower Flower Fairy": "URDLDLDLU", + "Moss Fairy": "URULDRURULDLDRULURDRD", + "Power Up Treasure": "UDRUDLUDLRDLRU", + "Sacred Geometry Treasure": "DLLUURRLDRUD", + "Southeast Cross Door": "DRULUR", + "Upper Flowers Fairy": "ULDLDLDLURDRRDR", + "Vintage Treasure": "DRRRRRRRRRRRLLLLLLLLLLLL" + }, + "Patrol Cave": { + "Patrol Fairy": "DDRURDLDRURDD" + }, + "Quarry": { + "Quarry Fairy": "URDLURULDLURRD" + }, + "Ruined Passage": { + "Ruined Passage Door": "LURULDLURDRULURD" + }, + "Sealed Temple": { + "Temple Fairy": "URULURULURDRUUL" + }, + "Secret Gathering Place": { + "Waterfall Fairy": "DRURURULULURURULDLDLDRDLDRDRUR" + }, + "West Garden": { + "Sword Door": "DRULUR", + "Tiles Fairy": "URULURULURDRULRLURULURULU", + "Tree Fairy": "LDRLUD" + } +} diff --git a/tunictracker/tracker/static/tracker/assets/refresh.js b/tunictracker/tracker/static/tracker/assets/refresh.js index 988e3ce..0624a60 100644 --- a/tunictracker/tracker/static/tracker/assets/refresh.js +++ b/tunictracker/tracker/static/tracker/assets/refresh.js @@ -1,18 +1,22 @@ +var current_hash = ""; + window.onload = () => { - // - // let overview = document.getElementById("overview"); - // let breakdown_current = document.getElementById("breakdown-current"); const refresh_interval = setInterval(refresh_elements, 500); }; async function refresh_elements() { - fetch("http://localhost:8000/spoiler") + fetch("http://192.168.1.101:8000/spoiler") .then((response) => response.json()) .then( (data) => { // Attempt to receive response JSON. const response_object = JSON.parse(JSON.stringify(data)); - document.getElementById("status-block").classList.add("hidden") + document.getElementById("status-block").classList.add("hidden"); + if (response_object.Debug.Hash == current_hash) { + return; + } else { + current_hash = response_object.Debug.Hash; + } // Parse out data from the back-end into variables. const overview_checks_undiscovered = @@ -23,6 +27,8 @@ async function refresh_elements() { const overview_entrances_total = response_object.Totals.Entrances.Total; const current_scene_name = response_object.Current.Scene; const all_scenes = response_object.Scenes; + const debug_info = response_object.Debug; + const cross_codes = response_object.Codes; // Refresh elements with new data from the back end. @@ -42,6 +48,10 @@ async function refresh_elements() { .querySelector(".breakdown-list") .firstElementChild.cloneNode(true); breakdown_block.classList.remove("hidden"); + let debug_item = document + .getElementById("debug-block") + .firstElementChild.cloneNode(true); + debug_item.classList.remove("hidden"); let new_breakdown_list = document .getElementById("overview") .querySelector(".breakdown-list") @@ -50,10 +60,14 @@ async function refresh_elements() { .getElementById("overview") .querySelector(".summary-list") .cloneNode(true); + let new_debug_block = document + .getElementById("debug-block") + .cloneNode(true); // Clear out the current lists. new_breakdown_list.innerHTML = ""; new_summary_list.firstElementChild.innerHTML = ""; + new_debug_block.innerHTML = ""; // Set content to updated data. overview_checks_title.textContent = `Checks: ${overview_checks_undiscovered}/${overview_checks_total}`; @@ -213,6 +227,10 @@ async function refresh_elements() { ); new_breakdown_list.appendChild(breakdown_block.cloneNode(true)); }); + Object.keys(debug_info).forEach((item) => { + debug_item.textContent = `${item}: ${debug_info[item]}`; + new_debug_block.appendChild(debug_item.cloneNode(true)); + }); // Replace with new data. // console.log(new_summary_list); @@ -224,17 +242,20 @@ async function refresh_elements() { .getElementById("overview") .querySelector(".breakdown-list") .replaceWith(new_breakdown_list.cloneNode(true)); + // document + // .getElementById("breakdown-current") + // .replaceWith( + // document.getElementById("breakdown-current").cloneNode(true) + // ); document - .getElementById("breakdown-current") - .replaceWith( - document.getElementById("breakdown-current").cloneNode(true) - ); + .getElementById("debug-block") + .replaceWith(new_debug_block.cloneNode(true)); // Debug // console.log("We have data."); }, (error) => { - document.getElementById("status-block").classList.remove("hidden") + document.getElementById("status-block").classList.remove("hidden"); return error; } ); diff --git a/tunictracker/tracker/templates/tracker/breakdown/block.html b/tunictracker/tracker/templates/tracker/breakdown/block.html index f077320..d7476a7 100644 --- a/tunictracker/tracker/templates/tracker/breakdown/block.html +++ b/tunictracker/tracker/templates/tracker/breakdown/block.html @@ -57,4 +57,5 @@ {% endfor %} +