Compare commits

...

3 Commits

55 changed files with 214 additions and 33 deletions

View File

@ -6,6 +6,7 @@ name = "Arendelle"
[[world]] [[world]]
name = "The Caribbean" name = "The Caribbean"
rooms = [""]
[[drops]] [[drops]]
name = "Twilight Stone" name = "Twilight Stone"

View File

@ -3,6 +3,10 @@ name = "Gold Beat"
[[world]] [[world]]
name = "Toy Box" name = "Toy Box"
[[world]]
name = "The Caribbean"
rooms = ["Exile Island"]
[[drops]] [[drops]]
name = "Lightning Stone" name = "Lightning Stone"
kind = "material" kind = "material"

View File

@ -5,6 +5,7 @@ name = "Arendelle"
[[world]] [[world]]
name = "San Fransokyo" name = "San Fransokyo"
rooms = ["Battlegate 11"]
[[drops]] [[drops]]
name = "Writhing Gem" name = "Writhing Gem"

View File

@ -2,6 +2,7 @@ name = "High Soldier"
[[world]] [[world]]
name = "San Fransokyo" name = "San Fransokyo"
rooms = ["Battlegate 12", "North District (Night)"]
[[drops]] [[drops]]
name = "Wellspring Gem" name = "Wellspring Gem"

View File

@ -2,6 +2,7 @@ name = "Mechanitaur"
[[world]] [[world]]
name = "San Fransokyo" name = "San Fransokyo"
rooms = ["Battlegate 12"]
[[drops]] [[drops]]
name = "Wellspring Gem" name = "Wellspring Gem"

View File

@ -2,6 +2,7 @@ name = "Metal Troll"
[[world]] [[world]]
name = "San Fransokyo" name = "San Fransokyo"
rooms = ["Battlegate 11", "North District (Night)"]
[[drops]] [[drops]]
name = "Wellspring Stone" name = "Wellspring Stone"

View File

@ -2,6 +2,7 @@ name = "Spear Lizard"
[[world]] [[world]]
name = "The Caribbean" name = "The Caribbean"
rooms = ["Battlegate 10", "Isla de los Mastiles"]
[[drops]] [[drops]]
name = "Soothing Stone" name = "Soothing Stone"

View File

@ -10,3 +10,8 @@ note = "Spawn in Thoroughfare and go back to The Forest around the trees"
world = "Toy Box" world = "Toy Box"
room = "Andy's House" room = "Andy's House"
note = "Outside the house in the garden" note = "Outside the house in the garden"
[[locations]]
world = "The Carribean"
room = "Isla de los Mastiles"
note = "On a rock to the right of the spawn point"

View File

@ -5,3 +5,12 @@ group = "herb"
world = "Monstropolis" world = "Monstropolis"
room = "Lobby & Offices" room = "Lobby & Offices"
note = "Vending Machine at the Laugh Floor's entrance" note = "Vending Machine at the Laugh Floor's entrance"
[[locations]]
world = "The Carribean"
room = "Isla de los Mastiles"
note = "Climb the walls and traverse the platforms"
[[locations]]
world = "The Carribean"
room = "Forsaken Isle"

View File

@ -9,4 +9,4 @@ note = "Laugh Floor on the desk in the very back"
[[locations]] [[locations]]
world = "The Carribean" world = "The Carribean"
room = "Fort" room = "Fort"
note = "In a box on the front terrace from the spawn" note = "In an yellow box on the front terrace from the spawn"

View File

@ -1,2 +1,10 @@
name = "Portobello" name = "Portobello"
group = "mushroom" group = "mushroom"
[[locations]]
world = "The Carribean"
room = "Horseshoe Island"
[[locations]]
world = "The Carribean"
room = "Ship's End"

View File

@ -1,2 +1,7 @@
name = "Quail" name = "Quail"
group = "meat" group = "meat"
[[locations]]
world = "The Carribean"
room = "Docks"
note = "Inside the building on the right side in a yellow box"

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -1,7 +1,19 @@
const TRACKED_STORAGE_NAME = "/drops/tracked/";
let gameName;
export let showOnlyTracked = false; export let showOnlyTracked = false;
export let kindFilter = new Set(); export let kindFilter = new Set();
export function init() { export function init() {
const url = window.location.href;
const firstPoint = url.indexOf("/", 8);
const subUrl = url.substring(firstPoint + 1);
const finalPoint = subUrl.indexOf("/");
gameName = subUrl.substring(0, finalPoint);
loadTracked();
const onlyTrackedFilter = document.querySelector( const onlyTrackedFilter = document.querySelector(
'input[name="onlyTracked"]', 'input[name="onlyTracked"]',
); );
@ -49,12 +61,49 @@ function filter() {
} }
} }
export function track(element) { function loadTracked() {
let parent = element.parentElement.parentElement; const categories = document.querySelectorAll(".category-wrapper");
let isTracked = parent.dataset["isTracked"] ?? false; let updates = 0;
isTracked = isTracked === "true" ? false : true;
parent.dataset["isTracked"] = isTracked; for (const category of categories) {
element.innerHTML = isTracked ? "Stop tracking" : "Start tracking"; let id =
element.style["border-bottom-color"] = isTracked ? "#a00" : "#0a0"; category.dataset["matKind"] + "-" + category.dataset["matType"];
id = gameName + TRACKED_STORAGE_NAME + id;
let isTracked = localStorage.getItem(id) === "true";
if (isTracked) {
category.dataset["isTracked"] = true;
let trackButton = category.querySelector(".category button");
updateTrackedState(trackButton, isTracked);
updates += 1;
}
}
if (updates > 0) {
filter(); filter();
} }
}
export function track(element) {
let parent = element.parentElement.parentElement;
let id = parent.dataset["matKind"] + "-" + parent.dataset["matType"];
id = gameName + TRACKED_STORAGE_NAME + id;
let isTracked = parent.dataset["isTracked"] ?? false;
isTracked = isTracked === "true" ? false : true;
if (isTracked) {
localStorage.setItem(id, true);
} else {
localStorage.removeItem(id);
}
parent.dataset["isTracked"] = isTracked;
updateTrackedState(element, isTracked);
filter();
}
function updateTrackedState(element, isTracked) {
element.innerHTML = isTracked ? "Stop tracking" : "Start tracking";
element.style["border-bottom-color"] = isTracked ? "#a00" : "#0a0";
}

View File

@ -1,7 +1,7 @@
import "../common/prototypes.js"; import "../common/prototypes.js";
const RECIPE_STORAGE_NAME = "kh1/synth/recipe."; const RECIPE_STORAGE_NAME = "kh1/synth/";
const LIST_STORAGE_NAME = "kh1/synth/needed-maths"; const LIST_STORAGE_NAME = "kh1/synth/needed-mats";
let markedNeededMaterials = []; let markedNeededMaterials = [];

View File

@ -107,8 +107,6 @@ function selectRecipe(item, index) {
} }
let recipeName = item.querySelector(".title").innerText; let recipeName = item.querySelector(".title").innerText;
console.log(item);
console.log(item.querySelectorAll(".title"));
localStorage.setItem(STORAGE_NAME + index, recipeName); localStorage.setItem(STORAGE_NAME + index, recipeName);
let stats = JSON.parse(item.dataset["stats"]); let stats = JSON.parse(item.dataset["stats"]);

View File

@ -16,15 +16,4 @@ table {
color: #ff7400; color: #ff7400;
} }
} }
tbody tr:hover {
background-color: #4f4f4f;
}
& tr,
th,
td {
border: 1px solid #fff;
padding: 7px;
}
} }

View File

@ -32,6 +32,17 @@ table {
thead th { thead th {
background-color: var(--bg-dark-color); background-color: var(--bg-dark-color);
} }
tbody tr:hover {
background-color: #4f4f4f;
}
& tr,
th,
td {
border: 1px solid #515151;
padding: 7px;
}
} }
ul { ul {
@ -118,3 +129,37 @@ input[type="checkbox"] {
color: var(--primary-light-color); color: var(--primary-light-color);
} }
} }
.help {
display: inline-block;
vertical-align: middle;
padding: 0px 8px;
&:after {
content: "?";
font-size: 24px;
}
}
.tooltip-wrapper {
position: relative;
.tooltip {
visibility: hidden;
background-color: var(--bg-light-color);
position: absolute;
top: -42px;
color: var(--text-color);
text-align: center;
border-radius: 6px;
padding: 8px;
opacity: 0;
transition: opacity 0.3s;
z-index: 1;
}
&:hover .tooltip {
visibility: visible;
opacity: 1;
}
}

View File

@ -0,0 +1,5 @@
li {
max-height: 3rem;
min-height: 3rem;
align-content: center;
}

View File

@ -1,3 +1,5 @@
use std::fmt::Display;
use serde::Deserialize; use serde::Deserialize;
pub mod direction; pub mod direction;
@ -14,3 +16,17 @@ pub enum Game {
Bbs, Bbs,
Ddd, Ddd,
} }
impl Display for Game {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let str = match self {
Game::Kh1 => "kh1",
Game::Kh2 => "kh2",
Game::Kh3 => "kh3",
Game::Bbs => "bbs",
Game::Ddd => "ddd",
};
f.write_str(str)
}
}

View File

@ -2,7 +2,7 @@ use std::{fmt::Display, path::PathBuf};
use serde::Deserialize; use serde::Deserialize;
use super::materials::MaterialDetails; use super::{Game, materials::MaterialDetails};
#[derive(Default, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone)] #[derive(Default, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone)]
pub struct Enemy { pub struct Enemy {
@ -94,7 +94,11 @@ pub struct SpawnLocation {
} }
impl SpawnLocation { impl SpawnLocation {
pub fn texture(&self) -> String { pub fn texture(&self, game: &Game) -> String {
self.name.replace(" ", "-").to_lowercase() format!(
"{}/{}",
game,
self.name.replace(" ", "-").replace("'", "").to_lowercase()
)
} }
} }

View File

@ -1,8 +1,8 @@
use std::path::PathBuf; use std::{fmt::Display, path::PathBuf};
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize, PartialEq, Eq)] #[derive(Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum IngredientGroup { pub enum IngredientGroup {
Meat, Meat,
@ -15,6 +15,23 @@ pub enum IngredientGroup {
Special, Special,
} }
impl Display for IngredientGroup {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let str = match self {
IngredientGroup::Meat => "Meat",
IngredientGroup::Seafood => "Seafood",
IngredientGroup::Vegetable => "Vegetable",
IngredientGroup::Mushroom => "Mushroom",
IngredientGroup::Herb => "Herb",
IngredientGroup::Fruit => "Fruit",
IngredientGroup::Other => "Other",
IngredientGroup::Special => "Special",
};
f.write_str(str)
}
}
#[derive(Debug, Deserialize, PartialEq, Eq)] #[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Ingredient { pub struct Ingredient {
pub name: String, pub name: String,
@ -23,13 +40,6 @@ pub struct Ingredient {
pub locations: Vec<Location>, pub locations: Vec<Location>,
} }
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Location {
pub world: String,
pub room: String,
pub note: Option<String>,
}
impl Ingredient { impl Ingredient {
pub fn import(path: &str) -> Vec<Ingredient> { pub fn import(path: &str) -> Vec<Ingredient> {
let mut ingredients: Vec<Ingredient> = vec![]; let mut ingredients: Vec<Ingredient> = vec![];
@ -53,6 +63,15 @@ impl Ingredient {
} }
} }
ingredients.sort_by(|a, b| a.group.cmp(&b.group));
ingredients ingredients
} }
} }
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Location {
pub world: String,
pub room: String,
pub note: Option<String>,
}

View File

@ -30,7 +30,7 @@
<div> <div>
<div <div
class="icon" class="icon"
style="background-image: url('../public/assets/worlds/{{ spawn.texture() }}.webp');" style="background-image: url('../public/assets/worlds/{{ spawn.texture(data.game) }}.webp');"
></div> ></div>
<div class="info"> <div class="info">
<p>{{ spawn.name }}</p> <p>{{ spawn.name }}</p>

View File

@ -24,6 +24,7 @@
<h1>Kingdom Hearts III</h1> <h1>Kingdom Hearts III</h1>
<ul> <ul>
<li><a href="./kh3/drops.html">Material Drops</a></li> <li><a href="./kh3/drops.html">Material Drops</a></li>
<li><a href="./kh3/ingredients.html">Ingredients</a></li>
<li><a href="./kh3/food-sim.html">Food Simulator</a></li> <li><a href="./kh3/food-sim.html">Food Simulator</a></li>
</ul> </ul>
{% endif %} {% endif %}

View File

@ -3,12 +3,30 @@
{% block title %}KH3 - Ingredients{% endblock %} {% block title %}KH3 - Ingredients{% endblock %}
{% block head %} {% block head %}
<link rel="stylesheet" href="{{ crate::find_hash("/public/styles/common/ingredients.css") }}"></link> <link rel="stylesheet" href="{{ crate::find_hash("/public/styles/kh3/ingredients.css") }}"></link>
<script <script
type="module" type="module"
src="{{ crate::find_hash("/public/scripts/common/ingredients.js") }}" src="{{ crate::find_hash("/public/scripts/kh3/ingredients.js") }}"
></script> ></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% for ingredient in ingredients %}
<div>
<h1>{{ingredient.name}}</h1>
<ul>
{% for location in ingredient.locations %}
<li class="tooltip-wrapper" {% if location.note.is_some() %}style="cursor: help"{% endif %}>
{{location.world+}} - {{+location.room}}
{% match location.note %}
{% when Some with (val) %}
<div class="help"></div>
<div class="tooltip">{{ val }}</div>
{% when None %}
{% endmatch %}
</li>
{% endfor %}
</ul>
</div>
{% endfor %}
{% endblock %} {% endblock %}