Added panel in current breakdown for holy cross codes. Need to add logic for whether they have been entered, need to add live update.

This commit is contained in:
Ada Werefox 2024-03-06 12:01:57 -06:00
parent 3e34ac33e0
commit c521c24602
7 changed files with 154 additions and 38 deletions

View File

@ -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"
}
}

View File

@ -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;
}
);

View File

@ -57,4 +57,5 @@
{% endfor %}
</div>
</div>
<div class="pt-4">{% include "tracker/codes/index.html" %}</div>
</div>

View File

@ -0,0 +1,31 @@
<div class="flex flex-col max-w-full text-lg rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark justify-start p-4 {% if not codes %}hidden{% endif %}">
Holy Cross Codes
<div class="flex flex-col space-y-2" id="codes-block">
<ul class="flex flex-col space-y-2 rounded-md hidden">
</ul>
<ul class="flex flex-col space-y-4 rounded-md">
<ul class="flex flex-col p-2 rounded-md bg-bluelight-translucent-dark w-full hidden">
</ul>
{% for name, code in codes.items %}
<ul class="flex flex-col p-2 rounded-md bg-bluelight-translucent-dark w-full">
<div class="p-2">{{ name }}:</div>
<div class="p-2 m-auto justify-center align-top">
<div class="max-w-64">
{% for arrow in code %}
{% if arrow == "U" %}
⬆️
{% elif arrow == "D" %}
⬇️
{% elif arrow == "L" %}
⬅️
{% elif arrow == "R" %}
➡️
{% endif %}
{% endfor %}
</div>
</div>
</ul>
{% endfor %}
</ul>
</div>
</div>

View File

@ -43,35 +43,17 @@
<div id="breakdown-current">
{% include "tracker/breakdown/block.html" with scene_title=current_scene.title scene_data=current_scene.data %}
</div>
<details class="group flex max-w-full rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
<details class="group p-2 flex max-w-full rounded-md ring-4 bg-bluelight-translucent ring-bluelight-dark">
<summary class="justify-start p-2">Tracker Debug</summary>
<div class="p-2 pl-4 pr-4 flex flex-col space-y-2">
<div>
<ul>
Name: {{ debug.Name }}
<div class="p-2 flex flex-col space-y-2"
id="debug-block">
<ul class="p-2 rounded-md bg-bluelight-translucent hidden">
</ul>
{% for name, value in debug.items %}
<ul class="p-2 rounded-md bg-bluelight-translucent">
{{ name }}: {{ value }}
</ul>
<ul>
Seed: {{ debug.Seed }}
</ul>
<ul>
Spoiler Seed: {{ debug.SpoilerSeed }}
</ul>
<ul>
Archipelago: {{ debug.Archipelago }}
</ul>
<ul>
Randomized: {{ debug.Randomized }}
</ul>
<ul>
Hex Quest: {{ debug.HexQuest }}
</ul>
<ul>
Entrance Randomizer: {{ debug.EntranceRando }}
</ul>
<ul>
Fixed Shops: {{ debug.FixedShops }}
</ul>
</div>
{% endfor %}
</div>
</details>
</div>

View File

@ -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": {

View File

@ -129,4 +129,4 @@ TAILWIND_APP_NAME = 'werefoxtheme'
INTERNAL_IPS = [
"127.0.0.1",
]
]