Page refresh should update with current information. Scene and checks lists update properly in javascript.
This commit is contained in:
parent
b2651e6277
commit
b7cce37c93
@ -1,5 +1,24 @@
|
||||
var current_hash = "";
|
||||
// Global state for overview
|
||||
var current_scene = "";
|
||||
var current_seed = Number.MAX_VALUE;
|
||||
var current_checks = 0;
|
||||
var current_entrances = 0;
|
||||
var current_hints = 0;
|
||||
var current_codes = { total: 0, codes: { name: "", distance: 0 } };
|
||||
var total_checks = 0;
|
||||
var total_entrances = 0;
|
||||
|
||||
// Global state for all entrances
|
||||
// This should hold numbers for how many entrances are mapped/total per scene.
|
||||
var current_entrances_list = {};
|
||||
|
||||
// Global state for all checks
|
||||
// This should hold numbers for how many checks are cleared/total per scene.
|
||||
var current_checks_list = {};
|
||||
|
||||
// Global state internal
|
||||
var server_address = "";
|
||||
var cross_codes = {};
|
||||
|
||||
window.onload = () => {
|
||||
get_updated_server_address();
|
||||
@ -7,12 +26,8 @@ window.onload = () => {
|
||||
.then((response) => response.json())
|
||||
.then(
|
||||
(data) => {
|
||||
const cross_codes = JSON.parse(JSON.stringify(data));
|
||||
const refresh_interval = setInterval(
|
||||
refresh_elements,
|
||||
500,
|
||||
cross_codes
|
||||
);
|
||||
cross_codes = JSON.parse(JSON.stringify(data));
|
||||
const refresh_interval = setInterval(refresh_elements, 500);
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
@ -24,16 +39,14 @@ function open_breakdown(event) {
|
||||
let scene = event.dataset.scene;
|
||||
Array.from(document.getElementById("breakdown-list").children).forEach(
|
||||
(breakdown) => {
|
||||
if (breakdown.id == `${scene}-breakdown`) {
|
||||
if (
|
||||
!(
|
||||
document
|
||||
.getElementById("breakdown-current")
|
||||
.querySelector(".breakdown-block-title").textContent == scene
|
||||
)
|
||||
) {
|
||||
breakdown.classList.remove("hidden");
|
||||
}
|
||||
let breakdown_scene_title = breakdown.querySelector(
|
||||
".breakdown-block-title"
|
||||
).textContent;
|
||||
if (
|
||||
breakdown_scene_title == scene ||
|
||||
breakdown.dataset.current == "true"
|
||||
) {
|
||||
breakdown.classList.remove("hidden");
|
||||
} else {
|
||||
breakdown.classList.add("hidden");
|
||||
}
|
||||
@ -54,10 +67,10 @@ function hide_empty_summaries() {
|
||||
summary.querySelector(".summary-title").textContent == "Posterity" ||
|
||||
summary.querySelector(".summary-title").textContent == "Resurrection"
|
||||
) &&
|
||||
(checks_undiscovered <= 0 &&
|
||||
entrances_undiscovered <= 0)
|
||||
checks_undiscovered <= 0 &&
|
||||
entrances_undiscovered <= 0
|
||||
) {
|
||||
console.log(`${checks_undiscovered} and ${entrances_undiscovered}`)
|
||||
console.log(`${checks_undiscovered} and ${entrances_undiscovered}`);
|
||||
summary.classList.toggle("hidden");
|
||||
}
|
||||
});
|
||||
@ -110,383 +123,506 @@ async function get_updated_server_address() {
|
||||
);
|
||||
}
|
||||
|
||||
async function refresh_elements(cross_codes) {
|
||||
fetch(`${server_address}spoiler`)
|
||||
async function refresh_overview() {
|
||||
fetch(`${server_address}overview`)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
// Attempt to receive response JSON.
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
async function refresh_hints() {
|
||||
fetch(`${server_address}hints`)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
// Attempt to receive response JSON.
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
async function refresh_checks() {
|
||||
const response = await fetch(`${server_address}items`);
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
async function refresh_entrances() {
|
||||
fetch(`${server_address}doors`).then((response) => response.json());
|
||||
}
|
||||
|
||||
async function update_overview(overview) {
|
||||
let overview_checks_title = document
|
||||
.getElementById("overview-totals")
|
||||
.querySelector(".overview-checks");
|
||||
let overview_entrances_title = document
|
||||
.getElementById("overview-totals")
|
||||
.querySelector(".overview-entrances");
|
||||
|
||||
// Set content to updated data.
|
||||
overview_checks_title.textContent = `Checks: ${current_checks}/${total_checks}`;
|
||||
overview_entrances_title.textContent = `Entrances: ${current_entrances}/${total_entrances}`;
|
||||
}
|
||||
|
||||
async function update_codes(codes) {
|
||||
const default_cross_codes = cross_codes.Default;
|
||||
const global_cross_codes = cross_codes.Global;
|
||||
}
|
||||
|
||||
async function update_summary() {}
|
||||
|
||||
async function update_checks(checks) {
|
||||
total_checks = checks.total;
|
||||
// Create new lists with updated data.
|
||||
let breakdown_list = Array.from(
|
||||
document.getElementById("breakdown-list").children
|
||||
);
|
||||
breakdown_list.forEach((scene) => {
|
||||
// Create variables for element pointers.
|
||||
let scene_title = scene.querySelector(".breakdown-block-title").textContent;
|
||||
if (scene_title) {
|
||||
scene.querySelector(
|
||||
".breakdown-block-checks-title"
|
||||
).textContent = `Checks: ${checks.scenes[scene_title].collected}/${checks.scenes[scene_title].total}`;
|
||||
|
||||
let new_breakdown_block_checks_list = scene
|
||||
.querySelector(".breakdown-block-checks-list")
|
||||
.cloneNode(true);
|
||||
let breakdown_block_checks_list_item = scene
|
||||
.querySelector(".breakdown-block-checks-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
|
||||
Object.keys(checks.scenes[scene_title].checks).forEach((check) => {
|
||||
if (!check.name) {
|
||||
breakdown_block_checks_list_item.textContent = `❌ ${check}`;
|
||||
new_breakdown_block_checks_list.appendChild(
|
||||
breakdown_block_checks_list_item.cloneNode(true)
|
||||
);
|
||||
}
|
||||
});
|
||||
document
|
||||
.getElementById("breakdown-list")
|
||||
.querySelector(`[data-breakdown-scene="${scene_title}"]`)
|
||||
.querySelector(".breakdown-block-checks-list").innerHTML = "";
|
||||
document
|
||||
.getElementById("breakdown-list")
|
||||
.querySelector(`[data-breakdown-scene="${scene_title}"]`)
|
||||
.querySelector(".breakdown-block-checks-list")
|
||||
.replaceWith(new_breakdown_block_checks_list);
|
||||
}
|
||||
});
|
||||
current_checks = checks.collected;
|
||||
return;
|
||||
}
|
||||
|
||||
async function update_entrances(entrances) {
|
||||
total_checks = entrances.total;
|
||||
// Create new lists with updated data.
|
||||
Object.keys(current_entrances_list).forEach((scene) => {
|
||||
// Create variables for element pointers.
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
async function update_hints(hints) {
|
||||
return;
|
||||
}
|
||||
|
||||
async function update_scene(scene) {
|
||||
Array.from(document.getElementById("breakdown-list").children).forEach(
|
||||
(breakdown) => {
|
||||
if (
|
||||
breakdown.querySelector(".breakdown-block-title").textContent == scene
|
||||
) {
|
||||
breakdown.classList.remove("hidden");
|
||||
breakdown.dataset.current = "true";
|
||||
} else if (breakdown.dataset.current == "true") {
|
||||
breakdown.dataset.current = "false";
|
||||
breakdown.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
);
|
||||
Array.from(
|
||||
document.getElementById("summary-list").firstElementChild.children
|
||||
).forEach((summary) => {
|
||||
if (summary.dataset.scene == scene) {
|
||||
summary.classList.add("hidden");
|
||||
} else if (!(summary.dataset.scene == "")) {
|
||||
summary.classList.remove("hidden");
|
||||
}
|
||||
});
|
||||
current_scene = scene;
|
||||
}
|
||||
|
||||
async function refresh_elements() {
|
||||
fetch(`${server_address}overview`)
|
||||
.then((response) => response.json())
|
||||
.then(
|
||||
(data) => {
|
||||
// Attempt to receive response JSON.
|
||||
const response_object = JSON.parse(JSON.stringify(data));
|
||||
const overview = JSON.parse(JSON.stringify(data));
|
||||
document.getElementById("status-block").classList.add("hidden");
|
||||
if (response_object.Debug.Hash == current_hash) {
|
||||
return;
|
||||
if (overview.seed != current_seed) {
|
||||
current_seed = overview.seed;
|
||||
current_scene = overview.scene;
|
||||
current_checks = overview.items;
|
||||
current_entrances = overview.entrances;
|
||||
current_hints = overview.hints;
|
||||
current_codes = overview.codes.length;
|
||||
refresh_checks().then((data) => update_checks(data));
|
||||
update_entrances(refresh_entrances());
|
||||
update_hints(refresh_hints());
|
||||
} else {
|
||||
current_hash = response_object.Debug.Hash;
|
||||
get_updated_server_address();
|
||||
if (overview.scene != current_scene) {
|
||||
update_scene(overview.scene);
|
||||
}
|
||||
if (overview.items != current_checks) {
|
||||
refresh_checks().then((data) => update_checks(data));
|
||||
}
|
||||
if (overview.entraces != current_entrances) {
|
||||
update_entrances(refresh_entrances);
|
||||
}
|
||||
if (overview.hints != current_hints) {
|
||||
update_hints(refresh_hints);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse out data from the back-end into variables.
|
||||
const overview_checks_undiscovered =
|
||||
response_object.Totals.Checks.Undiscovered;
|
||||
const overview_checks_total = response_object.Totals.Checks.Total;
|
||||
const overview_entrances_undiscovered =
|
||||
response_object.Totals.Entrances.Undiscovered;
|
||||
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_entered = response_object.Codes;
|
||||
const default_cross_codes = cross_codes.Default;
|
||||
const global_cross_codes = cross_codes.Global;
|
||||
// let summary_block = document
|
||||
// .getElementById("summary-list")
|
||||
// .firstElementChild.firstElementChild.cloneNode(true);
|
||||
// let breakdown_block = document
|
||||
// .getElementById("breakdown-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
// breakdown_block.id = "";
|
||||
// breakdown_block.classList.remove("hidden");
|
||||
|
||||
// Refresh elements with new data from the back end.
|
||||
|
||||
// Clone all the needed elements for updating.
|
||||
let overview_checks_title = document
|
||||
.getElementById("overview-totals")
|
||||
.querySelector(".overview-checks");
|
||||
let overview_entrances_title = document
|
||||
.getElementById("overview-totals")
|
||||
.querySelector(".overview-entrances");
|
||||
let summary_block = document
|
||||
.getElementById("summary-list")
|
||||
.firstElementChild.firstElementChild.cloneNode(true);
|
||||
let breakdown_block = document
|
||||
.getElementById("breakdown-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
breakdown_block.id = "";
|
||||
breakdown_block.classList.remove("hidden");
|
||||
let debug_item = document
|
||||
.getElementById("debug-block")
|
||||
.querySelector(".debug-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
debug_item.classList.remove("hidden");
|
||||
let new_breakdown_list = document
|
||||
.getElementById("breakdown-list")
|
||||
.cloneNode(true);
|
||||
let new_summary_list = document
|
||||
.getElementById("summary-list")
|
||||
.cloneNode(true);
|
||||
let new_debug_block = document
|
||||
.getElementById("debug-block")
|
||||
.querySelector(".debug-list")
|
||||
.cloneNode(true);
|
||||
let current_open_breakdown = "";
|
||||
Array.from(new_breakdown_list.children).forEach((scene) => {
|
||||
if (!Array.from(scene.classList).includes("hidden")) {
|
||||
current_open_breakdown = scene.id;
|
||||
}
|
||||
});
|
||||
// let debug_item = document
|
||||
// .getElementById("debug-block")
|
||||
// .querySelector(".debug-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
// debug_item.classList.remove("hidden");
|
||||
// let new_breakdown_list = document
|
||||
// .getElementById("breakdown-list")
|
||||
// .cloneNode(true);
|
||||
// let new_summary_list = document
|
||||
// .getElementById("summary-list")
|
||||
// .cloneNode(true);
|
||||
// let new_debug_block = document
|
||||
// .getElementById("debug-block")
|
||||
// .querySelector(".debug-list")
|
||||
// .cloneNode(true);
|
||||
// let current_open_breakdown = "";
|
||||
// Array.from(new_breakdown_list.children).forEach((scene) => {
|
||||
// if (!Array.from(scene.classList).includes("hidden")) {
|
||||
// current_open_breakdown = scene.id;
|
||||
// }
|
||||
// });
|
||||
|
||||
// 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}`;
|
||||
overview_entrances_title.textContent = `Entrances: ${overview_entrances_undiscovered}/${overview_entrances_total}`;
|
||||
// new_breakdown_list.innerHTML = "";
|
||||
// new_summary_list.firstElementChild.innerHTML = "";
|
||||
// new_debug_block.innerHTML = "";
|
||||
|
||||
// Create new lists with updated data.
|
||||
Object.keys(all_scenes).forEach((scene) => {
|
||||
// Create variables for element pointers.
|
||||
summary_block = document
|
||||
.getElementById("summary-list")
|
||||
.firstElementChild.firstElementChild.cloneNode(true);
|
||||
summary_block.classList.remove("hidden");
|
||||
let summary_title = summary_block.querySelector(".summary-title");
|
||||
let summary_checks = summary_block.querySelector(".summary-checks");
|
||||
let summary_entrances =
|
||||
summary_block.querySelector(".summary-entrances");
|
||||
// Object.keys(current_entrances_list).forEach((scene) => {
|
||||
// // Create variables for element pointers.
|
||||
// summary_block = document
|
||||
// .getElementById("summary-list")
|
||||
// .firstElementChild.firstElementChild.cloneNode(true);
|
||||
// summary_block.classList.remove("hidden");
|
||||
// let summary_title = summary_block.querySelector(".summary-title");
|
||||
// let summary_checks = summary_block.querySelector(".summary-checks");
|
||||
// let summary_entrances =
|
||||
// summary_block.querySelector(".summary-entrances");
|
||||
|
||||
breakdown_block = document
|
||||
.getElementById("breakdown-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
let breakdown_block_title = breakdown_block.querySelector(
|
||||
".breakdown-block-title"
|
||||
);
|
||||
let breakdown_block_checks_title = breakdown_block.querySelector(
|
||||
".breakdown-block-checks-title"
|
||||
);
|
||||
let new_breakdown_block_checks_list = breakdown_block
|
||||
.querySelector(".breakdown-block-checks-list")
|
||||
.cloneNode(true);
|
||||
let breakdown_block_checks_list_item = breakdown_block
|
||||
.querySelector(".breakdown-block-checks-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
let breakdown_block_entrances_title = breakdown_block.querySelector(
|
||||
".breakdown-block-entrances-title"
|
||||
);
|
||||
let new_breakdown_block_entrances_list = breakdown_block
|
||||
.querySelector(".breakdown-block-entrances-list")
|
||||
.cloneNode(true);
|
||||
let breakdown_block_entrances_list_item = breakdown_block
|
||||
.querySelector(".breakdown-block-entrances-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
let new_breakdown_block_mapped_list = breakdown_block
|
||||
.querySelector(".breakdown-block-mapped-list")
|
||||
.cloneNode(true);
|
||||
let breakdown_block_mapped_list_item = breakdown_block
|
||||
.querySelector(".breakdown-block-mapped-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
// breakdown_block = document
|
||||
// .getElementById("breakdown-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
// let breakdown_block_title = breakdown_block.querySelector(
|
||||
// ".breakdown-block-title"
|
||||
// );
|
||||
// let breakdown_block_checks_title = breakdown_block.querySelector(
|
||||
// ".breakdown-block-checks-title"
|
||||
// );
|
||||
// let new_breakdown_block_checks_list = breakdown_block
|
||||
// .querySelector(".breakdown-block-checks-list")
|
||||
// .cloneNode(true);
|
||||
// let breakdown_block_checks_list_item = breakdown_block
|
||||
// .querySelector(".breakdown-block-checks-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
// let breakdown_block_entrances_title = breakdown_block.querySelector(
|
||||
// ".breakdown-block-entrances-title"
|
||||
// );
|
||||
// let new_breakdown_block_entrances_list = breakdown_block
|
||||
// .querySelector(".breakdown-block-entrances-list")
|
||||
// .cloneNode(true);
|
||||
// let breakdown_block_entrances_list_item = breakdown_block
|
||||
// .querySelector(".breakdown-block-entrances-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
// let new_breakdown_block_mapped_list = breakdown_block
|
||||
// .querySelector(".breakdown-block-mapped-list")
|
||||
// .cloneNode(true);
|
||||
// let breakdown_block_mapped_list_item = breakdown_block
|
||||
// .querySelector(".breakdown-block-mapped-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
|
||||
// Clear out current list content.
|
||||
new_breakdown_block_checks_list.innerHTML = "";
|
||||
new_breakdown_block_entrances_list.innerHTML = "";
|
||||
new_breakdown_block_mapped_list.innerHTML = "";
|
||||
new_breakdown_block_checks_list.appendChild(
|
||||
breakdown_block_checks_list_item.cloneNode(true)
|
||||
);
|
||||
breakdown_block_checks_list_item.classList.remove("hidden");
|
||||
new_breakdown_block_entrances_list.appendChild(
|
||||
breakdown_block_entrances_list_item.cloneNode(true)
|
||||
);
|
||||
breakdown_block_entrances_list_item.classList.remove("hidden");
|
||||
new_breakdown_block_mapped_list.appendChild(
|
||||
breakdown_block_mapped_list_item.cloneNode(true)
|
||||
);
|
||||
breakdown_block_mapped_list_item.classList.remove("hidden");
|
||||
// // Clear out current list content.
|
||||
// new_breakdown_block_checks_list.innerHTML = "";
|
||||
// new_breakdown_block_entrances_list.innerHTML = "";
|
||||
// new_breakdown_block_mapped_list.innerHTML = "";
|
||||
// new_breakdown_block_checks_list.appendChild(
|
||||
// breakdown_block_checks_list_item.cloneNode(true)
|
||||
// );
|
||||
// breakdown_block_checks_list_item.classList.remove("hidden");
|
||||
// new_breakdown_block_entrances_list.appendChild(
|
||||
// breakdown_block_entrances_list_item.cloneNode(true)
|
||||
// );
|
||||
// breakdown_block_entrances_list_item.classList.remove("hidden");
|
||||
// new_breakdown_block_mapped_list.appendChild(
|
||||
// breakdown_block_mapped_list_item.cloneNode(true)
|
||||
// );
|
||||
// breakdown_block_mapped_list_item.classList.remove("hidden");
|
||||
|
||||
// Create variables for commonly used values.
|
||||
let scene_checks_undiscovered =
|
||||
all_scenes[scene].Totals.Checks.Undiscovered;
|
||||
let scene_checks_total = all_scenes[scene].Totals.Checks.Total;
|
||||
let scene_entrances_undiscovered =
|
||||
all_scenes[scene].Totals.Entrances.Undiscovered;
|
||||
let scene_entrances_total = all_scenes[scene].Totals.Entrances.Total;
|
||||
let scene_has_codes = Object.keys(cross_codes).includes(scene);
|
||||
// // Create variables for commonly used values.
|
||||
// let scene_checks_undiscovered = 0;
|
||||
// // all_items[scene];
|
||||
// let scene_checks_total = 0; //all_scenes[scene].Totals.Checks.Total;
|
||||
// let scene_entrances_undiscovered = 0;
|
||||
// // all_scenes[scene].Totals.Entrances.Undiscovered;
|
||||
// let scene_entrances_total = 0; //all_scenes[scene].Totals.Entrances.Total;
|
||||
// // let scene_has_codes = Object.keys(cross_codes).includes(scene);
|
||||
|
||||
// Set textContent.
|
||||
summary_title.textContent = scene;
|
||||
summary_checks.textContent = `Checks: ${scene_checks_undiscovered}/${scene_checks_total}`;
|
||||
summary_checks.dataset.checksUndiscovered = scene_checks_undiscovered;
|
||||
summary_checks.dataset.checksTotal = scene_checks_undiscovered;
|
||||
summary_entrances.textContent = `Entrances: ${scene_entrances_undiscovered}/${scene_entrances_total}`;
|
||||
summary_entrances.dataset.entrancesUndiscovered =
|
||||
scene_entrances_undiscovered;
|
||||
summary_entrances.dataset.entrancesTotal = scene_entrances_total;
|
||||
breakdown_block_title.textContent = scene;
|
||||
breakdown_block_checks_title.textContent = `Checks: ${all_scenes[scene].Totals.Checks.Undiscovered}/${all_scenes[scene].Totals.Checks.Total}`;
|
||||
breakdown_block_entrances_title.textContent = `Entrances: ${all_scenes[scene].Totals.Entrances.Undiscovered}/${all_scenes[scene].Totals.Entrances.Total}`;
|
||||
// // Set textContent.
|
||||
// summary_title.textContent = scene;
|
||||
// summary_checks.textContent = `Checks: ${scene_checks_undiscovered}/${scene_checks_total}`;
|
||||
// summary_checks.dataset.checksUndiscovered = scene_checks_undiscovered;
|
||||
// summary_checks.dataset.checksTotal = scene_checks_undiscovered;
|
||||
// summary_entrances.textContent = `Entrances: ${scene_entrances_undiscovered}/${scene_entrances_total}`;
|
||||
// summary_entrances.dataset.entrancesUndiscovered =
|
||||
// scene_entrances_undiscovered;
|
||||
// summary_entrances.dataset.entrancesTotal = scene_entrances_total;
|
||||
// breakdown_block_title.textContent = scene;
|
||||
// breakdown_block_checks_title.textContent = `Checks: ${all_scenes[scene].Totals.Checks.Undiscovered}/${all_scenes[scene].Totals.Checks.Total}`;
|
||||
// breakdown_block_entrances_title.textContent = `Entrances: ${all_scenes[scene].Totals.Entrances.Undiscovered}/${all_scenes[scene].Totals.Entrances.Total}`;
|
||||
|
||||
// Create checks, entrances, mapped entrances, and cross code lists.
|
||||
Object.keys(all_scenes[scene].Checks).forEach((check) => {
|
||||
if (!all_scenes[scene].Checks[check]) {
|
||||
breakdown_block_checks_list_item.textContent = `❌ ${check}`;
|
||||
new_breakdown_block_checks_list.appendChild(
|
||||
breakdown_block_checks_list_item.cloneNode(true)
|
||||
);
|
||||
}
|
||||
});
|
||||
Object.keys(all_scenes[scene].Entrances).forEach((entrances) => {
|
||||
if (all_scenes[scene].Entrances[entrances].Door == "") {
|
||||
breakdown_block_entrances_list_item.textContent = `❌ ${entrances}`;
|
||||
new_breakdown_block_entrances_list.appendChild(
|
||||
breakdown_block_entrances_list_item.cloneNode(true)
|
||||
);
|
||||
} else {
|
||||
breakdown_block_mapped_list_item.textContent = `✔️ ${entrances} -> ${all_scenes[scene].Entrances[entrances].Door}`;
|
||||
breakdown_block_mapped_list_item.id = `${entrances}-mapped`;
|
||||
breakdown_block_mapped_list_item.dataset.scene =
|
||||
all_scenes[scene].Entrances[entrances].Scene;
|
||||
new_breakdown_block_mapped_list.appendChild(
|
||||
breakdown_block_mapped_list_item.cloneNode(true)
|
||||
);
|
||||
}
|
||||
});
|
||||
// // Create checks, entrances, mapped entrances, and cross code lists.
|
||||
// Object.keys(all_scenes[scene].Checks).forEach((check) => {
|
||||
// if (!all_scenes[scene].Checks[check]) {
|
||||
// breakdown_block_checks_list_item.textContent = `❌ ${check}`;
|
||||
// new_breakdown_block_checks_list.appendChild(
|
||||
// breakdown_block_checks_list_item.cloneNode(true)
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// Object.keys(all_scenes[scene].Entrances).forEach((entrances) => {
|
||||
// if (all_scenes[scene].Entrances[entrances].Door == "") {
|
||||
// breakdown_block_entrances_list_item.textContent = `❌ ${entrances}`;
|
||||
// new_breakdown_block_entrances_list.appendChild(
|
||||
// breakdown_block_entrances_list_item.cloneNode(true)
|
||||
// );
|
||||
// } else {
|
||||
// breakdown_block_mapped_list_item.textContent = `✔️ ${entrances} -> ${all_scenes[scene].Entrances[entrances].Door}`;
|
||||
// breakdown_block_mapped_list_item.id = `${entrances}-mapped`;
|
||||
// breakdown_block_mapped_list_item.dataset.scene =
|
||||
// all_scenes[scene].Entrances[entrances].Scene;
|
||||
// new_breakdown_block_mapped_list.appendChild(
|
||||
// breakdown_block_mapped_list_item.cloneNode(true)
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
// Apply color coding to summary block
|
||||
summary_block.firstElementChild.classList.remove(
|
||||
"from-highlight-both-light",
|
||||
"from-highlight-checks-light",
|
||||
"from-highlight-entrances-light",
|
||||
"from-highlight-empty-light",
|
||||
"from-highlight-undiscovered-light",
|
||||
"to-highlight-both-dark",
|
||||
"to-highlight-checks-dark",
|
||||
"to-highlight-entrances-dark",
|
||||
"to-highlight-empty-dark",
|
||||
"to-highlight-undiscovered-dark",
|
||||
"text-highlight-both-text",
|
||||
"text-highlight-checks-text",
|
||||
"text-highlight-entrances-text",
|
||||
"text-highlight-empty-text",
|
||||
"text-highlight-undiscovered-text"
|
||||
);
|
||||
if (
|
||||
scene_checks_undiscovered > 0 &&
|
||||
scene_entrances_undiscovered > 0
|
||||
) {
|
||||
if (
|
||||
scene_checks_total == scene_checks_undiscovered &&
|
||||
scene_entrances_total == scene_entrances_undiscovered
|
||||
) {
|
||||
summary_block.firstElementChild.classList.add(
|
||||
"from-highlight-undiscovered-light",
|
||||
"to-highlight-undiscovered-dark",
|
||||
"text-highlight-undiscovered-text"
|
||||
);
|
||||
} else {
|
||||
summary_block.firstElementChild.classList.add(
|
||||
"from-highlight-both-light",
|
||||
"to-highlight-both-dark",
|
||||
"text-highlight-both-text"
|
||||
);
|
||||
}
|
||||
} else if (scene_checks_undiscovered > 0) {
|
||||
summary_block.firstElementChild.classList.add(
|
||||
"from-highlight-checks-light",
|
||||
"to-highlight-checks-dark",
|
||||
"text-highlight-checks-text"
|
||||
);
|
||||
} else if (scene_entrances_undiscovered > 0) {
|
||||
summary_block.firstElementChild.classList.add(
|
||||
"from-highlight-entrances-light",
|
||||
"to-highlight-entrances-dark",
|
||||
"text-highlight-entrances-text"
|
||||
);
|
||||
} else {
|
||||
summary_block.firstElementChild.classList.add(
|
||||
"from-highlight-empty-light",
|
||||
"to-highlight-empty-dark",
|
||||
"text-highlight-empty-text"
|
||||
);
|
||||
}
|
||||
// // Apply color coding to summary block
|
||||
// summary_block.firstElementChild.classList.remove(
|
||||
// "from-highlight-both-light",
|
||||
// "from-highlight-checks-light",
|
||||
// "from-highlight-entrances-light",
|
||||
// "from-highlight-empty-light",
|
||||
// "from-highlight-undiscovered-light",
|
||||
// "to-highlight-both-dark",
|
||||
// "to-highlight-checks-dark",
|
||||
// "to-highlight-entrances-dark",
|
||||
// "to-highlight-empty-dark",
|
||||
// "to-highlight-undiscovered-dark",
|
||||
// "text-highlight-both-text",
|
||||
// "text-highlight-checks-text",
|
||||
// "text-highlight-entrances-text",
|
||||
// "text-highlight-empty-text",
|
||||
// "text-highlight-undiscovered-text"
|
||||
// );
|
||||
// if (
|
||||
// scene_checks_undiscovered > 0 &&
|
||||
// scene_entrances_undiscovered > 0
|
||||
// ) {
|
||||
// if (
|
||||
// scene_checks_total == scene_checks_undiscovered &&
|
||||
// scene_entrances_total == scene_entrances_undiscovered
|
||||
// ) {
|
||||
// summary_block.firstElementChild.classList.add(
|
||||
// "from-highlight-undiscovered-light",
|
||||
// "to-highlight-undiscovered-dark",
|
||||
// "text-highlight-undiscovered-text"
|
||||
// );
|
||||
// } else {
|
||||
// summary_block.firstElementChild.classList.add(
|
||||
// "from-highlight-both-light",
|
||||
// "to-highlight-both-dark",
|
||||
// "text-highlight-both-text"
|
||||
// );
|
||||
// }
|
||||
// } else if (scene_checks_undiscovered > 0) {
|
||||
// summary_block.firstElementChild.classList.add(
|
||||
// "from-highlight-checks-light",
|
||||
// "to-highlight-checks-dark",
|
||||
// "text-highlight-checks-text"
|
||||
// );
|
||||
// } else if (scene_entrances_undiscovered > 0) {
|
||||
// summary_block.firstElementChild.classList.add(
|
||||
// "from-highlight-entrances-light",
|
||||
// "to-highlight-entrances-dark",
|
||||
// "text-highlight-entrances-text"
|
||||
// );
|
||||
// } else {
|
||||
// summary_block.firstElementChild.classList.add(
|
||||
// "from-highlight-empty-light",
|
||||
// "to-highlight-empty-dark",
|
||||
// "text-highlight-empty-text"
|
||||
// );
|
||||
// }
|
||||
|
||||
// Replace lists
|
||||
breakdown_block
|
||||
.querySelector(".breakdown-block-checks-list")
|
||||
.replaceWith(new_breakdown_block_checks_list);
|
||||
breakdown_block
|
||||
.querySelector(".breakdown-block-entrances-list")
|
||||
.replaceWith(new_breakdown_block_entrances_list);
|
||||
breakdown_block
|
||||
.querySelector(".breakdown-block-mapped-list")
|
||||
.replaceWith(new_breakdown_block_mapped_list);
|
||||
// // Replace lists
|
||||
// breakdown_block
|
||||
// .querySelector(".breakdown-block-checks-list")
|
||||
// .replaceWith(new_breakdown_block_checks_list);
|
||||
// breakdown_block
|
||||
// .querySelector(".breakdown-block-entrances-list")
|
||||
// .replaceWith(new_breakdown_block_entrances_list);
|
||||
// breakdown_block
|
||||
// .querySelector(".breakdown-block-mapped-list")
|
||||
// .replaceWith(new_breakdown_block_mapped_list);
|
||||
|
||||
breakdown_block.id = `${
|
||||
breakdown_block.querySelector(".breakdown-block-title").textContent
|
||||
}-breakdown`;
|
||||
breakdown_block.classList.add("hidden");
|
||||
// breakdown_block.id = `${
|
||||
// breakdown_block.querySelector(".breakdown-block-title").textContent
|
||||
// }-breakdown`;
|
||||
// breakdown_block.classList.add("hidden");
|
||||
|
||||
// Append relevant elements to lists.
|
||||
if (current_open_breakdown == breakdown_block.id) {
|
||||
breakdown_block.classList.remove("hidden");
|
||||
}
|
||||
if (scene == current_scene_name) {
|
||||
summary_block.classList.add("hidden");
|
||||
breakdown_block.classList.remove("hidden");
|
||||
document
|
||||
.getElementById("breakdown-current")
|
||||
.firstElementChild.replaceWith(breakdown_block.cloneNode(true));
|
||||
breakdown_block.classList.add("hidden");
|
||||
} else if (
|
||||
scene_checks_undiscovered <= 0 &&
|
||||
scene_entrances_total <= 0
|
||||
) {
|
||||
summary_block.classList.add("hidden");
|
||||
}
|
||||
if (document.getElementById("hideDone").checked) {
|
||||
if (
|
||||
scene_checks_undiscovered <= 0 &&
|
||||
scene_entrances_undiscovered <= 0
|
||||
) {
|
||||
summary_block.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
summary_block.dataset.scene = scene;
|
||||
new_summary_list.firstElementChild.appendChild(
|
||||
summary_block.cloneNode(true)
|
||||
);
|
||||
new_breakdown_list.appendChild(breakdown_block.cloneNode(true));
|
||||
});
|
||||
let new_cross_codes_block_list = document
|
||||
.getElementById("codes-list")
|
||||
.cloneNode(true);
|
||||
let cross_codes_block_list_item = document
|
||||
.getElementById("codes-list")
|
||||
.firstElementChild.cloneNode(true);
|
||||
new_cross_codes_block_list.innerHTML = "";
|
||||
// // Append relevant elements to lists.
|
||||
// if (current_open_breakdown == breakdown_block.id) {
|
||||
// breakdown_block.classList.remove("hidden");
|
||||
// }
|
||||
// if (scene == current_scene_name) {
|
||||
// summary_block.classList.add("hidden");
|
||||
// breakdown_block.classList.remove("hidden");
|
||||
// document
|
||||
// .getElementById("breakdown-current")
|
||||
// .firstElementChild.replaceWith(breakdown_block.cloneNode(true));
|
||||
// breakdown_block.classList.add("hidden");
|
||||
// } else if (
|
||||
// scene_checks_undiscovered <= 0 &&
|
||||
// scene_entrances_total <= 0
|
||||
// ) {
|
||||
// summary_block.classList.add("hidden");
|
||||
// }
|
||||
// if (document.getElementById("hideDone").checked) {
|
||||
// if (
|
||||
// scene_checks_undiscovered <= 0 &&
|
||||
// scene_entrances_undiscovered <= 0
|
||||
// ) {
|
||||
// summary_block.classList.add("hidden");
|
||||
// }
|
||||
// }
|
||||
// summary_block.dataset.scene = scene;
|
||||
// new_summary_list.firstElementChild.appendChild(
|
||||
// summary_block.cloneNode(true)
|
||||
// );
|
||||
// new_breakdown_list.appendChild(breakdown_block.cloneNode(true));
|
||||
// });
|
||||
// let new_cross_codes_block_list = document
|
||||
// .getElementById("codes-list")
|
||||
// .cloneNode(true);
|
||||
// let cross_codes_block_list_item = document
|
||||
// .getElementById("codes-list")
|
||||
// .firstElementChild.cloneNode(true);
|
||||
// new_cross_codes_block_list.innerHTML = "";
|
||||
|
||||
Object.keys(default_cross_codes).forEach((code) => {
|
||||
cross_codes_block_list_item.querySelector(
|
||||
".codes-list-item-title"
|
||||
).textContent = code;
|
||||
cross_codes_block_list_item.querySelector(
|
||||
".codes-list-item-code"
|
||||
).textContent = default_cross_codes[code]
|
||||
.replace(/U/g, "⬆️")
|
||||
.replace(/R/g, "➡️")
|
||||
.replace(/D/g, "⬇️")
|
||||
.replace(/L/g, "⬅️");
|
||||
new_cross_codes_block_list.appendChild(
|
||||
cross_codes_block_list_item.cloneNode(true)
|
||||
);
|
||||
});
|
||||
Object.keys(global_cross_codes).forEach((code) => {
|
||||
cross_codes_block_list_item.querySelector(
|
||||
".codes-list-item-title"
|
||||
).textContent = code;
|
||||
cross_codes_block_list_item.querySelector(
|
||||
".codes-list-item-code"
|
||||
).textContent = global_cross_codes[code]
|
||||
.replace(/U/g, "⬆️")
|
||||
.replace(/R/g, "➡️")
|
||||
.replace(/D/g, "⬇️")
|
||||
.replace(/L/g, "⬅️");
|
||||
if (cross_codes_entered.Global[code]) {
|
||||
cross_codes_block_list_item.classList.add("hidden");
|
||||
} else {
|
||||
cross_codes_block_list_item.classList.remove("hidden");
|
||||
}
|
||||
new_cross_codes_block_list.appendChild(
|
||||
cross_codes_block_list_item.cloneNode(true)
|
||||
);
|
||||
});
|
||||
if (!(typeof cross_codes[current_scene_name] === "undefined")) {
|
||||
Object.keys(cross_codes[current_scene_name]).forEach((code) => {
|
||||
cross_codes_block_list_item.querySelector(
|
||||
".codes-list-item-title"
|
||||
).textContent = code;
|
||||
cross_codes_block_list_item.querySelector(
|
||||
".codes-list-item-code"
|
||||
).textContent = cross_codes[current_scene_name][code]
|
||||
.replace(/U/g, "⬆️")
|
||||
.replace(/R/g, "➡️")
|
||||
.replace(/D/g, "⬇️")
|
||||
.replace(/L/g, "⬅️");
|
||||
if (cross_codes_entered[current_scene_name][code]) {
|
||||
cross_codes_block_list_item.classList.add("hidden");
|
||||
} else {
|
||||
cross_codes_block_list_item.classList.remove("hidden");
|
||||
}
|
||||
new_cross_codes_block_list.appendChild(
|
||||
cross_codes_block_list_item.cloneNode(true)
|
||||
);
|
||||
});
|
||||
}
|
||||
document
|
||||
.getElementById("codes-list")
|
||||
.replaceWith(new_cross_codes_block_list);
|
||||
// Object.keys(default_cross_codes).forEach((code) => {
|
||||
// cross_codes_block_list_item.querySelector(
|
||||
// ".codes-list-item-title"
|
||||
// ).textContent = code;
|
||||
// cross_codes_block_list_item.querySelector(
|
||||
// ".codes-list-item-code"
|
||||
// ).textContent = default_cross_codes[code]
|
||||
// .replace(/U/g, "⬆️")
|
||||
// .replace(/R/g, "➡️")
|
||||
// .replace(/D/g, "⬇️")
|
||||
// .replace(/L/g, "⬅️");
|
||||
// new_cross_codes_block_list.appendChild(
|
||||
// cross_codes_block_list_item.cloneNode(true)
|
||||
// );
|
||||
// });
|
||||
// Object.keys(global_cross_codes).forEach((code) => {
|
||||
// cross_codes_block_list_item.querySelector(
|
||||
// ".codes-list-item-title"
|
||||
// ).textContent = code;
|
||||
// cross_codes_block_list_item.querySelector(
|
||||
// ".codes-list-item-code"
|
||||
// ).textContent = global_cross_codes[code]
|
||||
// .replace(/U/g, "⬆️")
|
||||
// .replace(/R/g, "➡️")
|
||||
// .replace(/D/g, "⬇️")
|
||||
// .replace(/L/g, "⬅️");
|
||||
// if (cross_codes_entered.Global[code]) {
|
||||
// cross_codes_block_list_item.classList.add("hidden");
|
||||
// } else {
|
||||
// cross_codes_block_list_item.classList.remove("hidden");
|
||||
// }
|
||||
// new_cross_codes_block_list.appendChild(
|
||||
// cross_codes_block_list_item.cloneNode(true)
|
||||
// );
|
||||
// });
|
||||
// if (!(typeof cross_codes[current_scene_name] === "undefined")) {
|
||||
// Object.keys(cross_codes[current_scene_name]).forEach((code) => {
|
||||
// cross_codes_block_list_item.querySelector(
|
||||
// ".codes-list-item-title"
|
||||
// ).textContent = code;
|
||||
// cross_codes_block_list_item.querySelector(
|
||||
// ".codes-list-item-code"
|
||||
// ).textContent = cross_codes[current_scene_name][code]
|
||||
// .replace(/U/g, "⬆️")
|
||||
// .replace(/R/g, "➡️")
|
||||
// .replace(/D/g, "⬇️")
|
||||
// .replace(/L/g, "⬅️");
|
||||
// if (cross_codes_entered[current_scene_name][code]) {
|
||||
// cross_codes_block_list_item.classList.add("hidden");
|
||||
// } else {
|
||||
// cross_codes_block_list_item.classList.remove("hidden");
|
||||
// }
|
||||
// new_cross_codes_block_list.appendChild(
|
||||
// cross_codes_block_list_item.cloneNode(true)
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
// document
|
||||
// .getElementById("codes-list")
|
||||
// .replaceWith(new_cross_codes_block_list);
|
||||
|
||||
Object.keys(debug_info).forEach((item) => {
|
||||
debug_item.querySelector(
|
||||
".debug-item"
|
||||
).textContent = `${item}: ${debug_info[item]}`;
|
||||
new_debug_block.appendChild(debug_item.cloneNode(true));
|
||||
});
|
||||
// // Object.keys(debug_info).forEach((item) => {
|
||||
// // debug_item.querySelector(
|
||||
// // ".debug-item"
|
||||
// // ).textContent = `${item}: ${debug_info[item]}`;
|
||||
// // new_debug_block.appendChild(debug_item.cloneNode(true));
|
||||
// // });
|
||||
|
||||
// Replace with new data.
|
||||
document
|
||||
.getElementById("summary-list")
|
||||
.replaceWith(new_summary_list.cloneNode(true));
|
||||
document
|
||||
.getElementById("breakdown-list")
|
||||
.replaceWith(new_breakdown_list.cloneNode(true));
|
||||
document
|
||||
.getElementById("debug-block")
|
||||
.querySelector(".debug-list")
|
||||
.replaceWith(new_debug_block.cloneNode(true));
|
||||
// // Replace with new data.
|
||||
// document
|
||||
// .getElementById("summary-list")
|
||||
// .replaceWith(new_summary_list.cloneNode(true));
|
||||
// document
|
||||
// .getElementById("breakdown-list")
|
||||
// .replaceWith(new_breakdown_list.cloneNode(true));
|
||||
// // document
|
||||
// // .getElementById("debug-block")
|
||||
// // .querySelector(".debug-list")
|
||||
// // .replaceWith(new_debug_block.cloneNode(true));
|
||||
},
|
||||
(error) => {
|
||||
document.getElementById("status-block").classList.remove("hidden");
|
||||
|
@ -48,7 +48,7 @@
|
||||
"Fire Wand Obelisk Page": "URDLDRUL",
|
||||
"Fountain Cross Door": "DRULUR",
|
||||
"Fountain Fairy": "DLLDURD",
|
||||
"Lower Flower Fairy": "URDLDLDLDLU",
|
||||
"Lower Flowers Fairy": "URDLDLDLDLU",
|
||||
"Moss Fairy": "URULDLULURDRDRULURDRD",
|
||||
"Power Up Treasure": "UDRUDLUDLRDLRU",
|
||||
"Sacred Geometry Treasure": "DLLUURRLDRUD",
|
||||
|
@ -1,20 +1,19 @@
|
||||
<div class="flex flex-col space-y-2 max-w-full {{ extra_classes }}"
|
||||
id="{{ scene }}-breakdown">
|
||||
<div class="flex flex-col space-y-2 max-w-full {{ extra_classes }}" data-current="{{ is_current_scene }}" data-breakdown-scene="{{ scene_title }}">
|
||||
<div class="px-2">
|
||||
<div class="flex text-xl breakdown-block-title">{{ scene_title }}</div>
|
||||
<div class="flex flex-col md:flex-row justify-center md:space-x-4">
|
||||
<div class="flex flex-col basis-1/2 overflow-hidden">
|
||||
<div class="my-2 flex flex-col space-y-2">
|
||||
<div class="flex flex-col justify-center md:flex-row md:space-x-4">
|
||||
<div class="flex flex-col overflow-hidden basis-1/2">
|
||||
<div class="flex flex-col my-2 space-y-2">
|
||||
<div class="text-md breakdown-block-checks-title">
|
||||
Checks: {{ scene_data.Totals.Checks.Undiscovered }}/{{ scene_data.Totals.Checks.Total }}
|
||||
Checks: {{ scene_data.checks.collected }}/{{ scene_data.checks.total }}
|
||||
</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-xl" />
|
||||
</div>
|
||||
<div class="pb-4 flex flex-col max-h-64 space-y-2 overflow-scroll scrollbar scrollbar-thumb-bluelight-dark scrollbar-track-bluelight breakdown-block-checks-list">
|
||||
<div class="flex flex-col pb-4 space-y-2 overflow-scroll max-h-64 scrollbar scrollbar-thumb-bluelight-dark scrollbar-track-bluelight breakdown-block-checks-list">
|
||||
<ul class="py-0.5 min-w-max bg-bluelight-translucent rounded-md px-1 text-sm hidden">
|
||||
</ul>
|
||||
{% for check_name, check in scene_data.Checks.items %}
|
||||
{% if not check %}
|
||||
{% for check_name, check in scene_data.checks.checks.items %}
|
||||
{% if not check.name %}
|
||||
<ul class="py-0.5 min-w-max bg-bluelight-translucent rounded-md px-1 text-sm">
|
||||
❌ {{ check_name }}
|
||||
</ul>
|
||||
@ -22,43 +21,39 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col basis-1/2 overflow-hidden">
|
||||
<div class="my-2 flex flex-col space-y-2">
|
||||
<div class="flex flex-col overflow-hidden basis-1/2">
|
||||
<div class="flex flex-col my-2 space-y-2">
|
||||
<div class="text-md breakdown-block-entrances-title">
|
||||
Entrances: {{ scene_data.Totals.Entrances.Undiscovered }}/{{ scene_data.Totals.Entrances.Total }}
|
||||
Entrances: {{ scene_data.entrances.found }}/{{ scene_data.entrances.total }}
|
||||
</div>
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-xl" />
|
||||
</div>
|
||||
<div class="pb-4 flex flex-col max-h-64 space-y-2 overflow-scroll scrollbar scrollbar-thumb-bluelight-dark scrollbar-track-bluelight breakdown-block-entrances-list">
|
||||
<div class="flex flex-col pb-4 space-y-2 overflow-scroll max-h-64 scrollbar scrollbar-thumb-bluelight-dark scrollbar-track-bluelight breakdown-block-entrances-list">
|
||||
<ul class="py-0.5 min-w-max bg-bluelight-translucent rounded-md px-1 text-sm hidden">
|
||||
</ul>
|
||||
{% for entrance_origin, entrance_destination in scene_data.Entrances.items %}
|
||||
{% if entrance_destination.Door == "" %}
|
||||
{% for entrance_origin, entrance_destination in scene_data.entrances.doors.items %}
|
||||
{% if entrance_destination.door == "" %}
|
||||
<ul class="py-0.5 min-w-max bg-bluelight-translucent rounded-md px-1 text-sm">
|
||||
❌ {{ entrance_origin }}
|
||||
</ul>
|
||||
{% else %}
|
||||
<ul class="py-0.5 min-w-max bg-bluelight-translucent rounded-md px-1 text-sm hidden">
|
||||
❌ {{ entrance_origin }}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="max-h-64 overflow-scroll scrollbar scrollbar-thumb-trans-pride-cyan-translucent scrollbar-track-bluelight-translucent">
|
||||
<div class="p-1 flex flex-col space-y-2 mx-auto min-w-max breakdown-block-mapped-list">
|
||||
<div class="overflow-scroll max-h-64 scrollbar scrollbar-thumb-trans-pride-cyan-translucent scrollbar-track-bluelight-translucent">
|
||||
<div class="flex flex-col p-1 mx-auto space-y-2 min-w-max breakdown-block-mapped-list">
|
||||
<button type="button"
|
||||
class="py-0.5 text-start bg-gradient-to-br from-bluelight-translucent-dark to-trans-pride-cyan-translucent rounded-md px-1 text-sm hidden"
|
||||
onclick="open_breakdown(this)"></button>
|
||||
{% for entrance_origin, entrance_destination in scene_data.Entrances.items %}
|
||||
{% if entrance_destination %}
|
||||
{% for entrance_origin, entrance_destination in scene_data.entrances.doors.items %}
|
||||
{% if entrance_destination.door %}
|
||||
<button type="button"
|
||||
class="py-0.5 text-start bg-gradient-to-br from-bluelight-translucent-dark to-trans-pride-cyan-translucent rounded-md px-1 text-sm shadow-sm shadow-[#242424]"
|
||||
id="{{ entrance_origin }}-mapped"
|
||||
onclick="open_breakdown(this)"
|
||||
data-scene="{{ entrance_destination.Scene }}">
|
||||
✔️ {{ entrance_origin }} -> {{ entrance_destination.Door }}
|
||||
data-scene="{{ entrance_destination.scene }}">
|
||||
✔️ {{ entrance_origin }} -> {{ entrance_destination.door }}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -1,21 +1,13 @@
|
||||
<details class="py-2 px-2 mt-2 flex flex-col space-y-4 max-w-full text-holy-cross text-base [text-shadow:_1px_1px_4px_rgb(0_0_0_/_100%)] rounded-xl bg-gradient-to-br from-[#ffe28530] to-[#ffffff30] drop-shadow-[0px_0px_4px_rgba(255,255,255,1)] justify-start">
|
||||
<summary>Holy Cross Codes</summary>
|
||||
<hr class="border-2 border-holy-cross opacity-30 rounded-xl" />
|
||||
<div class="flex flex-col space-y-2 max-h-96 rounded-xl overflow-y-scroll">
|
||||
<div class="grid grid-flow-row md:grid-cols-3 xl:grid-cols-5 gap-2 rounded-xl" id="codes-list">
|
||||
<div class="flex flex-col space-y-2 overflow-y-scroll max-h-96 rounded-xl">
|
||||
<div class="grid grid-flow-row gap-2 md:grid-cols-3 xl:grid-cols-5 rounded-xl" id="codes-list">
|
||||
{% for name, code in default_codes.items %}
|
||||
{% include "tracker/codes/block.html" with is_entered=False %}
|
||||
{% endfor %}
|
||||
{% for scene, codes in tracked_codes.items %}
|
||||
{% if scene == "Global" %}
|
||||
{% for name, code_tuple in codes.items %}
|
||||
{% include "tracker/codes/block.html" with code=code_tuple.0 is_entered=code_tuple.1 %}
|
||||
{% endfor %}
|
||||
{% elif scene == scene_title %}
|
||||
{% for name, code_tuple in codes.items %}
|
||||
{% include "tracker/codes/block.html" with code=code_tuple.0 is_entered=code_tuple.1 %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% for name, values in codes.items %}
|
||||
{% include "tracker/codes/block.html" with code=values.code is_entered=False %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,11 +2,11 @@
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<div class="container monospace py-4 space-y-2 text-[#E0FFFF] [text-shadow:_1px_1px_0_rgb(0_0_0_/_50%)]">
|
||||
<div class="p-2 rounded-lg bg-white bg-opacity-10 shadow-lg shadow-bluelight-background-dark">
|
||||
<div class="p-2 bg-white rounded-lg shadow-lg bg-opacity-10 shadow-bluelight-background-dark">
|
||||
{% if debug != '' %}
|
||||
<div class="space-y-2 px-2">
|
||||
<div class="px-2 space-y-2">
|
||||
<div class="flex flex-col align-middle max-w-fit">
|
||||
<div class="flex flex-row align-middle max-w-fit h-12 space-x-2">
|
||||
<div class="flex flex-row h-12 space-x-2 align-middle max-w-fit">
|
||||
<span class="flex flex-shrink-0 object-contain w-8 h-8 my-auto align-middle backdrop-blur">
|
||||
<img src="{% static 'tracker/images/neofox_flag_trans_256.png' %}"
|
||||
alt="A trans pride fox emoji."
|
||||
@ -25,15 +25,15 @@
|
||||
<div class="space-y-1">
|
||||
{% include "tracker/howto/index.html" %}
|
||||
<hr class="mt-2 border-2 border-bluelight-dark rounded-xl" />
|
||||
<div class="px-2 flex flex-col md:flex-row md:space-x-4 space-y-2 md:space-y-0 text-lg bg-gradient-to-r from-bluelight-light to-bluelight-dark rounded-sm"
|
||||
<div class="flex flex-col px-2 space-y-2 text-lg rounded-sm md:flex-row md:space-x-4 md:space-y-0 bg-gradient-to-r from-bluelight-light to-bluelight-dark"
|
||||
id="overview-totals">
|
||||
<div class="flex basis-1/2 overview-checks">Checks: {{ totals.Checks.Undiscovered }}/{{ totals.Checks.Total }}</div>
|
||||
<div class="flex basis-1/2 overview-entrances">
|
||||
Entrances: {{ totals.Entrances.Undiscovered }}/{{ totals.Entrances.Total }}
|
||||
</div>
|
||||
</div>
|
||||
<details class="group flex flex-col rounded-lg bg-gradient-to-br from-bluelight-background-light to-bluelight-background">
|
||||
<summary class="py-2 px-4 justify-start">Summary</summary>
|
||||
<details class="flex flex-col rounded-lg group bg-gradient-to-br from-bluelight-background-light to-bluelight-background">
|
||||
<summary class="justify-start px-4 py-2">Summary</summary>
|
||||
<div class="px-2 rounded-xl">
|
||||
<hr class="border-2 border-bluelight-translucent-dark rounded-xl" />
|
||||
<div class="py-2" id="summary-list">{% include "tracker/summary/list.html" %}</div>
|
||||
@ -43,39 +43,43 @@
|
||||
</div>
|
||||
<div class="flex flex-col space-y-2">
|
||||
{% include "tracker/status/index.html" %}
|
||||
<div class="p-flex flex-col max-w-full space-y-2">
|
||||
<div class="flex-col max-w-full space-y-2 p-flex">
|
||||
<div id="breakdown-list">
|
||||
{% include "tracker/breakdown/block.html" with extra_classes="hidden" %}
|
||||
{% include "tracker/breakdown/block.html" with extra_classes="hidden" is_current_scene="false" %}
|
||||
{% for scene_title, scene_data in scenes.items %}
|
||||
{% include "tracker/breakdown/block.html" with extra_classes="hidden" %}
|
||||
{% if scene_title == current_scene %}
|
||||
{% include "tracker/breakdown/block.html" with extra_classes="" is_current_scene="true" %}
|
||||
{% else %}
|
||||
{% include "tracker/breakdown/block.html" with extra_classes="hidden" is_current_scene="false" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="breakdown-current">
|
||||
{% comment %} <div id="breakdown-current">
|
||||
{% include "tracker/breakdown/block.html" with scene_title=current_scene.title scene_data=current_scene.data %}
|
||||
</div>
|
||||
</div> {% endcomment %}
|
||||
{% include "tracker/codes/index.html" %}
|
||||
</div>
|
||||
<details class="py-2 px-4 flex flex-col space-y-2 max-w-full text-md rounded-lg bg-gradient-to-br from-bluelight-background-light to-bluelight-background">
|
||||
<details class="flex flex-col max-w-full px-4 py-2 space-y-2 rounded-lg text-md bg-gradient-to-br from-bluelight-background-light to-bluelight-background">
|
||||
<summary class="justify-start">Settings</summary>
|
||||
{% include "tracker/settings/index.html" %}
|
||||
{% comment %} {% include "tracker/settings/index.html" %} {% endcomment %}
|
||||
{% include "tracker/address/index.html" %}
|
||||
<div class="p-2 m-auto justify-center align-middle flex flex-row space-x-2">
|
||||
<div class="flex flex-row justify-center p-2 m-auto space-x-2 align-middle">
|
||||
<input onclick="hide_empty_summaries()"
|
||||
type="checkbox"
|
||||
id="hideDone"
|
||||
class="p-2 my-auto rounded-md bg-white bg-opacity-10 shadow-sm shadow-[#242424]" />
|
||||
<label for="hideDone"
|
||||
class="my-auto justify-left align-top min-w-fit text-md text-nowrap">
|
||||
class="my-auto align-top justify-left min-w-fit text-md text-nowrap">
|
||||
Hide completed areas
|
||||
</label>
|
||||
</div>
|
||||
<div class="p-2 m-auto justify-center align-middle flex flex-row space-x-2">
|
||||
<div class="flex flex-row justify-center p-2 m-auto space-x-2 align-middle">
|
||||
<input onclick="notices_ur_debug()"
|
||||
class="p-2 my-auto rounded-md bg-white bg-opacity-10 shadow-sm shadow-[#242424]"
|
||||
type="checkbox"
|
||||
id="show-debug" />
|
||||
<label for="show-debug"
|
||||
class="my-auto justify-left align-top min-w-fit text-md text-nowrap">
|
||||
class="my-auto align-top justify-left min-w-fit text-md text-nowrap">
|
||||
Sh-OwO Debug
|
||||
</label>
|
||||
</div>
|
||||
@ -83,17 +87,16 @@
|
||||
</div>
|
||||
{% else %}
|
||||
<div id="no_data" />{% endif %}</div>
|
||||
<div class="p-2 flex flex-col space-y-2 max-w-full rounded-lg bg-white bg-opacity-10 shadow-lg shadow-bluelight-background-dark hidden"
|
||||
id="debug-block">
|
||||
{% comment %} <div class="flex flex-col hidden max-w-full p-2 space-y-2 bg-white rounded-lg shadow-lg bg-opacity-10 shadow-bluelight-background-dark" id="debug-block">
|
||||
<div class="px-2 text-lg">Tracker Debug</div>
|
||||
<div class="grid grid-flow-row md:grid-cols-2 xl:grid-cols-3 gap-2 space-y-2 max-w-full break-words debug-list">
|
||||
<div class="max-h-full align-bottom flex flex-col-reverse hidden">
|
||||
<div class="grid max-w-full grid-flow-row gap-2 space-y-2 break-words md:grid-cols-2 xl:grid-cols-3 debug-list">
|
||||
<div class="flex flex-col-reverse hidden max-h-full align-bottom">
|
||||
<hr class="mt-1 border-2 border-[#24242480] rounded-xl" />
|
||||
<ul class="px-2 break-all sm:break-word debug-item">
|
||||
</ul>
|
||||
</div>
|
||||
{% for name, value in debug.items %}
|
||||
<div class="max-h-full align-bottom flex flex-col-reverse">
|
||||
<div class="flex flex-col-reverse max-h-full align-bottom">
|
||||
<hr class="mt-1 border-2 border-[#24242480] rounded-xl" />
|
||||
<ul class="px-2 break-all sm:break-word debug-item">
|
||||
{{ name }}: {{ value }}
|
||||
@ -101,7 +104,7 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div> {% endcomment %}
|
||||
{% include "tracker/src/index.html" with tracker_fe_link="https://gitea.werefox.cafe/ada/tunic-tracker-redux" tracker_be_link="https://github.com/spaceglace/TunicTransitionTracker" %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
@ -5,14 +5,14 @@
|
||||
<div class="p-2 *:mr-auto *:justify-start *:text-left min-h-full flex flex-col rounded-lg bg-gradient-to-tl shadow-sm shadow-[#242424] {{ extra_classes }}">
|
||||
<div class="summary-title">{{ scene }}:</div>
|
||||
<div class="summary-checks"
|
||||
data-checks-undiscovered="{{ scene_data.Totals.Checks.Undiscovered }}"
|
||||
data-checks-total="{{ scene_data.Totals.Checks.Total }}">
|
||||
Checks: {{ scene_data.Totals.Checks.Undiscovered }}/{{ scene_data.Totals.Checks.Total }}
|
||||
data-checks-undiscovered="{{ scene_data.checks.collected }}"
|
||||
data-checks-total="{{ scene_data.checks.total }}">
|
||||
Checks: {{ scene_data.checks.collected }}/{{ scene_data.checks.total }}
|
||||
</div>
|
||||
<div class="summary-entrances"
|
||||
data-entrances-undiscovered="{{ scene_data.Totals.Entrances.Undiscovered }}"
|
||||
data-entrances-total="{{ scene_data.Totals.Entrances.Total }}">
|
||||
Entrances: {{ scene_data.Totals.Entrances.Undiscovered }}/{{ scene_data.Totals.Entrances.Total }}
|
||||
data-entrances-undiscovered="{{ scene_data.entrances.found }}"
|
||||
data-entrances-total="{{ scene_data.entrances.total }}">
|
||||
Entrances: {{ scene_data.entrances.found }}/{{ scene_data.entrances.total }}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
@ -1,21 +1,19 @@
|
||||
<div class="p-1 grid gap-2 md:grid-cols-3 xl:grid-cols-5 grid-flow-row max-h-96 rounded-xl overflow-y-scroll scrollbar scrollbar-thumb-bluelight-dark scrollbar-track-bluelight">
|
||||
<div class="grid grid-flow-row gap-2 p-1 overflow-y-scroll md:grid-cols-3 xl:grid-cols-5 max-h-96 rounded-xl scrollbar scrollbar-thumb-bluelight-dark scrollbar-track-bluelight">
|
||||
{% include "tracker/summary/block.html" with extra_classes="" is_hidden="hidden" %}
|
||||
{% for scene, scene_data in scenes.items %}
|
||||
{% if scene == current_scene.title %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="" is_hidden="hidden" %}
|
||||
{% elif scene != "Entrances" and scene != "Checks" %}
|
||||
{% if scene_data.Totals.Checks.Undiscovered > 0 and scene_data.Totals.Entrances.Undiscovered > 0 %}
|
||||
{% if scene_data.Totals.Checks.Undiscovered == scene_data.Totals.Checks.Total and scene_data.Totals.Entrances.Undiscovered == scene_data.Totals.Entrances.Total %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-undiscovered-light to-highlight-undiscovered-dark text-highlight-undiscovered-text" is_hidden="" %}
|
||||
{% else %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-both-light to-highlight-both-dark text-highlight-both-text" is_hidden="" %}
|
||||
{% endif %}
|
||||
{% elif scene_data.Totals.Checks.Undiscovered > 0 %}
|
||||
{% if scene_data.checks.collected == scene_data.checks.total and scene_data.entrances.found == scene_data.entrances.total %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-empty-light to-highlight-empty-dark text-highlight-empty-text" is_hidden="" %}
|
||||
{% elif scene_data.checks.collected <= 0 and scene_data.entrances.found <= 0 and scene_data.entrances.total > 0 %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-undiscovered-light to-highlight-undiscovered-dark text-highlight-undiscovered-text" is_hidden="" %}
|
||||
{% elif scene_data.checks.collected >= scene_data.checks.total %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-checks-light to-highlight-checks-dark text-highlight-checks-text" is_hidden="" %}
|
||||
{% elif scene_data.Totals.Entrances.Undiscovered > 0 %}
|
||||
{% elif scene_data.entrances.found >= scene_data.entrances.total %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-entrances-light to-highlight-entrances-dark text-highlight-entrances-text" is_hidden="" %}
|
||||
{% else %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-empty-light to-highlight-empty-dark text-highlight-empty-text" is_hidden="" %}
|
||||
{% include "tracker/summary/block.html" with extra_classes="from-highlight-both-light to-highlight-both-dark text-highlight-both-text" is_hidden="" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -6,6 +6,6 @@ urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("set/address/", views.set_address, name="set_address"),
|
||||
path("get/address/", views.get_address, name="get_address"),
|
||||
path("set/settings/", views.set_settings, name="set_settings"),
|
||||
path("get/settings/", views.get_settings, name="get_settings"),
|
||||
# path("set/settings/", views.set_settings, name="set_settings"),
|
||||
# path("get/settings/", views.get_settings, name="get_settings"),
|
||||
]
|
@ -4,18 +4,24 @@ from django.template import loader
|
||||
from json import loads, dumps
|
||||
from math import floor
|
||||
import requests
|
||||
from .forms import ServerAddressForm, BackendFilepathForm
|
||||
from .forms import ServerAddressForm # , BackendFilepathForm
|
||||
import logging
|
||||
|
||||
# Create your views here.
|
||||
|
||||
# Debug and defaults.
|
||||
defaults = {
|
||||
'listen_address': 'http://localhost:8000/',
|
||||
'backend_filepath': '',
|
||||
'backend_filepath_updated': False,
|
||||
"listen_address": "http://localhost:51111/",
|
||||
# 'backend_filepath': '',
|
||||
# 'backend_filepath_updated': False,
|
||||
}
|
||||
# logging.basicConfig(encoding='utf-8', level=logging.DEBUG)
|
||||
logging.basicConfig(encoding="utf-8", level=logging.DEBUG)
|
||||
|
||||
# API endpoints
|
||||
# /overview - {screne, seed, items (int), entrances (int), hints (int), codes (dict of codes in an area and how care they are, can be empty)}
|
||||
# /items - {[scene names] ({name (name of item that was received), owner (in multiworld, who received that item)})}
|
||||
# /doors - {[scene names] ({scene (name of scene the mapped entrance is in), door (name of entrance it leads to)})}
|
||||
# /hints - {[where hint was received] (raw trunic string of hint)}
|
||||
|
||||
|
||||
def session_key(session, key):
|
||||
@ -23,124 +29,248 @@ def session_key(session, key):
|
||||
session[key] = defaults[key]
|
||||
|
||||
# TODO: consider serializing user sessions for debugging in the future.
|
||||
logging.info(
|
||||
f'Session {key} set to: {session[key]}')
|
||||
logging.info(f"Session {key} set to: {session[key]}")
|
||||
return session[key]
|
||||
|
||||
|
||||
def index(request):
|
||||
request_data = None
|
||||
|
||||
listen_address = session_key(request.session, 'listen_address')
|
||||
backend_filepath = session_key(request.session, 'backend_filepath')
|
||||
listen_address = session_key(request.session, "listen_address")
|
||||
# backend_filepath = session_key(request.session, 'backend_filepath')
|
||||
|
||||
try:
|
||||
request_data = requests.get(
|
||||
f'{listen_address}spoiler', timeout=5, verify=True).text
|
||||
if (loads(request_data)['Scenes'] == None):
|
||||
with open('empty_spoiler.json', 'r') as t:
|
||||
try:
|
||||
request_data = t.read()
|
||||
request_overview_data = requests.get(
|
||||
f"{listen_address}overview", timeout=5, verify=True
|
||||
).text
|
||||
request_items_data = requests.get(
|
||||
f"{listen_address}items", timeout=5, verify=True
|
||||
).text
|
||||
request_doors_data = requests.get(
|
||||
f"{listen_address}doors", timeout=5, verify=True
|
||||
).text
|
||||
request_hints_data = requests.get(
|
||||
f"{listen_address}hints", timeout=5, verify=True
|
||||
).text
|
||||
# if (loads(request_data)['Scenes'] == None):
|
||||
# with open('empty_spoiler.json', 'r') as t:
|
||||
# try:
|
||||
# request_data = t.read()
|
||||
|
||||
except:
|
||||
return
|
||||
# except:
|
||||
# return
|
||||
except:
|
||||
with open('empty_spoiler.json', 'r') as t:
|
||||
with open("empty_spoiler.json", "r") as t:
|
||||
try:
|
||||
tracker_output = loads(t.read())
|
||||
|
||||
except:
|
||||
return
|
||||
try:
|
||||
tracker_output = loads(request_data)
|
||||
tracker_overview_data = loads(request_overview_data)
|
||||
tracker_items_data = loads(request_items_data)
|
||||
tracker_doors_data = loads(request_doors_data)
|
||||
tracker_hints_data = loads(request_hints_data)
|
||||
except:
|
||||
with open('empty_spoiler.json', 'r') as t:
|
||||
with open("empty_spoiler.json", "r") as t:
|
||||
try:
|
||||
tracker_output = loads(t.read())
|
||||
except:
|
||||
return
|
||||
with open('tracker/static/tracker/data/holy_cross_codes.json', 'r') as t:
|
||||
with open("tracker/static/tracker/data/holy_cross_codes.json", "r") as t:
|
||||
try:
|
||||
temp_codes = loads(t.read())
|
||||
cross_codes = {x: {k: l.replace('U', '⬆️').replace('D', '⬇️').replace('L', '⬅️').replace(
|
||||
'R', '➡️').strip() for k, l in temp_codes[x].items()} for x in temp_codes.keys()}
|
||||
cross_codes = {
|
||||
x: {
|
||||
k: l.replace("U", "⬆️")
|
||||
.replace("D", "⬇️")
|
||||
.replace("L", "⬅️")
|
||||
.replace("R", "➡️")
|
||||
.strip()
|
||||
for k, l in temp_codes[x].items()
|
||||
}
|
||||
for x in temp_codes.keys()
|
||||
}
|
||||
except:
|
||||
return
|
||||
|
||||
tracker_debug = tracker_output['Debug']
|
||||
tracker_totals = tracker_output['Totals']
|
||||
tracker_current_scene = tracker_output['Current']['Scene']
|
||||
tracker_current_scene_data = tracker_output['Scenes'][tracker_current_scene]
|
||||
tracker_scenes = tracker_output['Scenes']
|
||||
entered_codes = tracker_output['Codes']
|
||||
try:
|
||||
tracker_codes = cross_codes
|
||||
for scene in entered_codes:
|
||||
for k, v in cross_codes[scene].items():
|
||||
tracker_codes[scene][k] = (
|
||||
v, entered_codes[scene][k])
|
||||
except Exception as e:
|
||||
current_cross_codes = {}
|
||||
# print(e)
|
||||
template = loader.get_template('tracker/index.html')
|
||||
# tracker_debug = tracker_output['Debug']
|
||||
# tracker_totals = tracker_output['Totals']
|
||||
# tracker_current_scene = tracker_output['Current']['Scene']
|
||||
# tracker_current_scene_data = tracker_output['Scenes'][tracker_current_scene]
|
||||
# tracker_scenes = tracker_output['Scenes']
|
||||
# entered_codes = tracker_output['Codes']
|
||||
|
||||
# Data from the /overview API call
|
||||
tracker_current_scene = tracker_overview_data["scene"]
|
||||
tracker_seed = tracker_overview_data["seed"]
|
||||
tracker_hints_found_total = tracker_overview_data["hints"]
|
||||
tracker_current_scene_codes = tracker_overview_data["codes"]
|
||||
|
||||
# Data from the /doors API call
|
||||
tracker_entrances_total = tracker_doors_data["total"]
|
||||
tracker_entrances_mapped_total = tracker_doors_data["found"]
|
||||
|
||||
# Data from the /items API call
|
||||
tracker_checks_total = tracker_items_data["total"]
|
||||
tracker_checks_cleared_total = tracker_items_data["collected"]
|
||||
|
||||
active_codes = {}
|
||||
for name, distance in tracker_current_scene_codes.items():
|
||||
active_codes[name] = {
|
||||
"distance": distance,
|
||||
"code": cross_codes[tracker_current_scene][name],
|
||||
}
|
||||
logging.debug(active_codes)
|
||||
|
||||
# try:
|
||||
# tracker_codes = cross_codes
|
||||
# for scene in entered_codes:
|
||||
# for k, v in cross_codes[scene].items():
|
||||
# tracker_codes[scene][k] = (
|
||||
# v, entered_codes[scene][k])
|
||||
# except Exception as e:
|
||||
# current_cross_codes = {}
|
||||
# # print(e)
|
||||
|
||||
scene_data = {}
|
||||
for scene in tracker_doors_data["scenes"].keys():
|
||||
scene_data[scene] = {
|
||||
"entrances": tracker_doors_data["scenes"][scene],
|
||||
"checks": tracker_items_data["scenes"][scene],
|
||||
}
|
||||
|
||||
template = loader.get_template("tracker/index.html")
|
||||
server_address_form = ServerAddressForm()
|
||||
server_address_form.fields['server_address_form'].initial = listen_address
|
||||
backend_filepath_form = BackendFilepathForm()
|
||||
backend_filepath_form.fields['backend_filepath_form'].initial = backend_filepath
|
||||
logging.info(tracker_scenes)
|
||||
server_address_form.fields["server_address_form"].initial = listen_address
|
||||
# backend_filepath_form = BackendFilepathForm()
|
||||
# backend_filepath_form.fields['backend_filepath_form'].initial = backend_filepath
|
||||
logging.debug(format_overview_output(tracker_overview_data))
|
||||
context = {
|
||||
'backend_filepath': backend_filepath,
|
||||
'server_address': listen_address,
|
||||
# 'backend_filepath': backend_filepath,
|
||||
"server_address": listen_address,
|
||||
# 'is_hidden': is_hidden,
|
||||
'debug': tracker_debug,
|
||||
'default_codes': cross_codes['Default'],
|
||||
'tracked_codes': tracker_codes,
|
||||
'totals': tracker_totals,
|
||||
'scenes': tracker_scenes,
|
||||
'current_scene': {
|
||||
'title': tracker_current_scene,
|
||||
'data': tracker_current_scene_data
|
||||
"debug": {},
|
||||
"default_codes": cross_codes["Default"],
|
||||
"totals": {
|
||||
"Checks": {
|
||||
"Undiscovered": tracker_checks_cleared_total,
|
||||
"Total": tracker_checks_total,
|
||||
},
|
||||
"Entrances": {
|
||||
"Undiscovered": tracker_entrances_mapped_total,
|
||||
"Total": tracker_entrances_total,
|
||||
},
|
||||
},
|
||||
'server_address_form': server_address_form,
|
||||
'backend_filepath_form': backend_filepath_form
|
||||
"scenes": scene_data,
|
||||
"current_scene": tracker_current_scene,
|
||||
# "current_scene": {
|
||||
# "title": tracker_current_scene,
|
||||
# "data": {
|
||||
# "checks": tracker_items_data["scenes"][tracker_current_scene],
|
||||
# "entrances": tracker_doors_data["scenes"][tracker_current_scene],
|
||||
# "Totals": {
|
||||
# "Checks": {
|
||||
# "Undiscovered": tracker_items_data["scenes"][
|
||||
# tracker_current_scene
|
||||
# ]["collected"],
|
||||
# "Total": tracker_items_data["scenes"][tracker_current_scene][
|
||||
# "total"
|
||||
# ],
|
||||
# },
|
||||
# "Entrances": {
|
||||
# "Undiscovered": tracker_doors_data["scenes"][
|
||||
# tracker_current_scene
|
||||
# ]["found"],
|
||||
# "Total": tracker_doors_data["scenes"][tracker_current_scene][
|
||||
# "total"
|
||||
# ],
|
||||
# },
|
||||
# },
|
||||
# "Codes": tracker_current_scene_codes,
|
||||
# },
|
||||
"codes": active_codes,
|
||||
# },
|
||||
"server_address_form": server_address_form,
|
||||
# 'backend_filepath_form': backend_filepath_form
|
||||
}
|
||||
return HttpResponse(template.render(context, request))
|
||||
|
||||
|
||||
def get_address(request):
|
||||
if request.method == 'GET':
|
||||
session_key(request.session, 'backend_filepath_updated')
|
||||
return HttpResponse(dumps({'listen_address': request.session['listen_address'], 'backend_filepath_updated': request.session['backend_filepath_updated']}), content_type="application/json")
|
||||
if request.method == "GET":
|
||||
# session_key(request.session, 'backend_filepath_updated')
|
||||
# 'backend_filepath_updated': request.session['backend_filepath_updated']}), content_type="application/json")
|
||||
return HttpResponse(
|
||||
dumps({"listen_address": request.session["listen_address"]}),
|
||||
content_type="application/json",
|
||||
)
|
||||
else:
|
||||
return render(request, 'tracker/index.html')
|
||||
return render(request, "tracker/index.html")
|
||||
|
||||
|
||||
def set_address(request):
|
||||
if request.method == 'POST':
|
||||
if request.method == "POST":
|
||||
form = ServerAddressForm(request.POST)
|
||||
if form.is_valid():
|
||||
request.session['listen_address'] = form.cleaned_data['server_address_form']
|
||||
return HttpResponseRedirect('/')
|
||||
request.session["listen_address"] = form.cleaned_data["server_address_form"]
|
||||
return HttpResponseRedirect("/")
|
||||
else:
|
||||
form = ServerAddressForm()
|
||||
return render(request, 'tracker/index.html', {'server_address_form': form})
|
||||
return render(request, "tracker/index.html", {"server_address_form": form})
|
||||
|
||||
|
||||
def set_settings(request):
|
||||
if request.method == 'POST':
|
||||
form = BackendFilepathForm(request.POST)
|
||||
if form.is_valid():
|
||||
request.session['backend_filepath'] = form.cleaned_data['backend_filepath_form']
|
||||
request.session['backend_filepath_updated'] = True
|
||||
return HttpResponseRedirect('/')
|
||||
else:
|
||||
form = BackendFilepathForm()
|
||||
return render(request, 'tracker/index.html', {'backend_filepath_form': form})
|
||||
# def set_settings(request):
|
||||
# if request.method == 'POST':
|
||||
# form = BackendFilepathForm(request.POST)
|
||||
# if form.is_valid():
|
||||
# request.session['backend_filepath'] = form.cleaned_data['backend_filepath_form']
|
||||
# request.session['backend_filepath_updated'] = True
|
||||
# return HttpResponseRedirect('/')
|
||||
# else:
|
||||
# form = BackendFilepathForm()
|
||||
# return render(request, 'tracker/index.html', {'backend_filepath_form': form})
|
||||
|
||||
|
||||
def get_settings(request):
|
||||
if request.method == 'GET':
|
||||
request.session['backend_filepath_updated'] = False
|
||||
return HttpResponse(dumps(request.session['backend_filepath']), content_type="application/json")
|
||||
else:
|
||||
return render(request, 'tracker/index.html')
|
||||
# def get_settings(request):
|
||||
# if request.method == 'GET':
|
||||
# request.session['backend_filepath_updated'] = False
|
||||
# return HttpResponse(dumps(request.session['backend_filepath']), content_type="application/json")
|
||||
# else:
|
||||
# return render(request, 'tracker/index.html')
|
||||
|
||||
|
||||
def format_overview_output(overview):
|
||||
overview_string = "\nReceived Overview Data:\n"
|
||||
for key, value in overview.items():
|
||||
overview_string += f"\t{key}: "
|
||||
if key == "codes":
|
||||
overview_string += "\n"
|
||||
for code, distance in value.items():
|
||||
overview_string += f"\t\t{code}: {distance:.2f}\n"
|
||||
else:
|
||||
overview_string += f"{value}\n"
|
||||
return overview_string
|
||||
|
||||
|
||||
def format_items_output(items):
|
||||
items_string = "\nReceived Item Data:\n"
|
||||
for key, value in items.items():
|
||||
items_string += f"\t{key}:\n"
|
||||
for check_key, check_value in value.items():
|
||||
items_string += f"\t\t{check_key}: {check_value}\n"
|
||||
return items_string
|
||||
|
||||
|
||||
def format_doors_output(doors):
|
||||
doors_string = "\nReceived Door Data:\n"
|
||||
for key, value in doors.items():
|
||||
doors_string += f"\t{key}: "
|
||||
for entrance_key, entrance_value in value.items():
|
||||
doors_string += f"\t\t{entrance_key}: {entrance_value}\n"
|
||||
return doors_string
|
||||
|
||||
|
||||
def format_hints_output(hints):
|
||||
hints_string = "\nReceived Hint Data:\n"
|
||||
for key, value in hints.items():
|
||||
hints_string += f"\t{key}: "
|
||||
return hints_string
|
||||
|
@ -45,8 +45,8 @@ module.exports = {
|
||||
container: {
|
||||
center: true,
|
||||
padding: {
|
||||
DEFAULT: "1rem",
|
||||
xl: "0rem",
|
||||
DEFAULT: "2rem",
|
||||
xl: "4rem",
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
|
Loading…
Reference in New Issue
Block a user