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 %} +
{% include "tracker/codes/index.html" %}
diff --git a/tunictracker/tracker/templates/tracker/codes/index.html b/tunictracker/tracker/templates/tracker/codes/index.html new file mode 100644 index 0000000..d26513c --- /dev/null +++ b/tunictracker/tracker/templates/tracker/codes/index.html @@ -0,0 +1,31 @@ +
+ Holy Cross Codes +
+ + +
+
diff --git a/tunictracker/tracker/templates/tracker/index.html b/tunictracker/tracker/templates/tracker/index.html index cca879b..013990f 100644 --- a/tunictracker/tracker/templates/tracker/index.html +++ b/tunictracker/tracker/templates/tracker/index.html @@ -43,35 +43,17 @@
{% include "tracker/breakdown/block.html" with scene_title=current_scene.title scene_data=current_scene.data %}
-
+
Tracker Debug -
-
-
    - Name: {{ debug.Name }} +
    + + {% for name, value in debug.items %} +
      + {{ name }}: {{ value }}
    -
      - Seed: {{ debug.Seed }} -
    -
      - Spoiler Seed: {{ debug.SpoilerSeed }} -
    -
      - Archipelago: {{ debug.Archipelago }} -
    -
      - Randomized: {{ debug.Randomized }} -
    -
      - Hex Quest: {{ debug.HexQuest }} -
    -
      - Entrance Randomizer: {{ debug.EntranceRando }} -
    -
      - Fixed Shops: {{ debug.FixedShops }} -
    -
    + {% endfor %}
diff --git a/tunictracker/tracker/views.py b/tunictracker/tracker/views.py index 0e29e18..b315996 100644 --- a/tunictracker/tracker/views.py +++ b/tunictracker/tracker/views.py @@ -31,16 +31,28 @@ def index(request): is_hidden = False except: return + with open('tracker/data/holy_cross_codes.json', 'r') as t: + try: + cross_codes = loads(t.read()) + except: + return tracker_debug = tracker_output["Debug"] tracker_totals = tracker_output["Totals"] tracker_current_scene = tracker_output["Current"]["Scene"] tracker_current_scane_data = tracker_output["Scenes"][tracker_current_scene] tracker_scenes = tracker_output["Scenes"] + tracker_codes = tracker_output["Codes"] + try: + current_cross_codes = cross_codes[tracker_current_scene] + except: + current_cross_codes = {} template = loader.get_template("tracker/index.html") context = { "server_address": server_address, "is_hidden": is_hidden, "debug": tracker_debug, + "codes": current_cross_codes, + "codes_entered": tracker_codes, "totals": tracker_totals, "scenes": tracker_scenes, "current_scene": { diff --git a/tunictracker/tunictracker/settings.py b/tunictracker/tunictracker/settings.py index bcb6d2c..b9278c3 100644 --- a/tunictracker/tunictracker/settings.py +++ b/tunictracker/tunictracker/settings.py @@ -129,4 +129,4 @@ TAILWIND_APP_NAME = 'werefoxtheme' INTERNAL_IPS = [ "127.0.0.1", -] \ No newline at end of file +]