Compare commits

...

3 Commits

65 changed files with 298 additions and 128 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "khguide" name = "khguide"
version = "1.3.0" version = "1.3.2"
edition = "2024" edition = "2024"
[dependencies] [dependencies]

View File

@ -2,6 +2,7 @@ name = "Air Pirate"
[[world]] [[world]]
name = "Neverland" name = "Neverland"
rooms = ["Pirate Ship"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -2,6 +2,11 @@ name = "Air Soldier"
[[world]] [[world]]
name = "Wonderland" name = "Wonderland"
rooms = ["Lotus Forest"]
[[world]]
name = "End of the World"
rooms = ["World Terminus | Olympus Coliseum"]
[[drops]] [[drops]]
name = "Potion" name = "Potion"

View File

@ -2,6 +2,7 @@ name = "Angel Star"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["Linked Worlds"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -3,6 +3,10 @@ name = "Aquatank"
[[world]] [[world]]
name = "Atlantica" name = "Atlantica"
[[world]]
name = "End of the World"
rooms = ["World Terminus | Atlantica"]
[[drops]] [[drops]]
name = "Mega-Potion" name = "Mega-Potion"
kind = "item" kind = "item"

View File

@ -9,6 +9,7 @@ name = "Monstro"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Agrabah"]
[[drops]] [[drops]]
name = "Potion" name = "Potion"

View File

@ -8,6 +8,7 @@ name = "Neverland"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Neverland"]
[[drops]] [[drops]]
name = "Camping Set" name = "Camping Set"

View File

@ -2,6 +2,7 @@ name = "Battleship"
[[world]] [[world]]
name = "Neverland" name = "Neverland"
rooms = ["Pirate Ship"]
[[drops]] [[drops]]
name = "Elixir" name = "Elixir"

View File

@ -2,6 +2,7 @@ name = "Black Ballade"
[[world]] [[world]]
name = "Deep Jungle" name = "Deep Jungle"
rooms = ["Bamboo Thicket"]
[[drops]] [[drops]]
name = "Lightning Stone" name = "Lightning Stone"

View File

@ -5,15 +5,18 @@ name = "Traverse Town"
[[world]] [[world]]
name = "Wonderland" name = "Wonderland"
rooms = ["Lotus Forest"]
[[world]] [[world]]
name = "Monstro" name = "Monstro"
[[world]] [[world]]
name = "Hollow Bastion" name = "Hollow Bastion"
rooms = ["Entrance Hall"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Wonderland"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -9,6 +9,7 @@ rooms = ["Bowels", "Stomach"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Deep Jungle"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -2,6 +2,7 @@ name = "Chimera"
[[world]] [[world]]
name = "Halloween Town" name = "Halloween Town"
rooms = ["Manor Ruins"]
[[drops]] [[drops]]
name = "Blazing Stone" name = "Blazing Stone"

View File

@ -2,12 +2,24 @@ name = "Darkball"
[[world]] [[world]]
name = "Traverse Town" name = "Traverse Town"
rooms = ["3rd District", "Gizmo Shop"] rooms = ["3rd District", "Gizmo Shop", "Alleyway"]
[[world]] [[world]]
name = "Agrabah" name = "Agrabah"
rooms = ["Bazaar", "Palace Gates"] rooms = ["Bazaar", "Palace Gates"]
[[world]]
name = "Deep Jungle"
rooms = ["Bamboo Thicket"]
[[world]]
name = "Wonderland"
rooms = ["Lotus Forest"]
[[world]]
name = "Halloween Town"
rooms = ["Moonlight Hill"]
[[world]] [[world]]
name = "Hollow Bastion" name = "Hollow Bastion"

View File

@ -6,9 +6,11 @@ rooms = ["3rd District", "Hotel Hallway", "Gizmo Shop"]
[[world]] [[world]]
name = "Hollow Bastion" name = "Hollow Bastion"
rooms = ["Entrance Hall"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Olympus Coliseum"]
[[drops]] [[drops]]
name = "Elixir" name = "Elixir"

View File

@ -8,6 +8,7 @@ name = "Monstro"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Agrabah"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -1,10 +1,12 @@
name = "Gargoyle" name = "Gargoyle"
[[world]] [[world]]
name = "Holloween Town" name = "Halloween Town"
rooms = ["Graveyard"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Halloween Town"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -2,6 +2,7 @@ name = "Gigas Shadow"
[[world]] [[world]]
name = "Wonderland" name = "Wonderland"
rooms = ["Bizzare Room"]
[[drops]] [[drops]]
name = "Lucid Shard" name = "Lucid Shard"

View File

@ -11,13 +11,14 @@ name = "Monstro"
[[world]] [[world]]
name = "Deep Jungle" name = "Deep Jungle"
rooms = ["Jungle: Cliff"] rooms = ["Cliff"]
[[world]] [[world]]
name = "Hollow Bastion" name = "Hollow Bastion"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Wonderland"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -2,6 +2,7 @@ name = "Invisible"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["Linked Worlds"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -2,6 +2,7 @@ name = "Jet Balloon"
[[world]] [[world]]
name = "Neverland" name = "Neverland"
rooms = ["Pirate Ship"]
[[drops]] [[drops]]
name = "Dazzling Stone" name = "Dazzling Stone"

View File

@ -15,9 +15,11 @@ name = "Monstro"
[[world]] [[world]]
name = "Hollow Bastion" name = "Hollow Bastion"
rooms = ["Entrance Hall", "Grand Hall"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Traverse Town"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -2,6 +2,7 @@ name = "Neoshadow"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["Linked Worlds"]
[[drops]] [[drops]]
name = "Stormy Stone" name = "Stormy Stone"

View File

@ -9,6 +9,7 @@ name = "Monstro"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Neverland"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -2,6 +2,7 @@ name = "Powerwild"
[[world]] [[world]]
name = "Deep Jungle" name = "Deep Jungle"
rooms = ["Camp", "Cliff"]
[[world]] [[world]]
name = "Monstro" name = "Monstro"
@ -9,6 +10,7 @@ rooms = ["Chamber 5", "Chamber 6"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Deep Jungle"]
[[drops]] [[drops]]
name = "Potion" name = "Potion"

View File

@ -4,8 +4,13 @@ name = "Red Nocturne"
name = "Monstro" name = "Monstro"
rooms = ["Chamber 6"] rooms = ["Chamber 6"]
[[world]]
name = "Hollow Bastion"
rooms = ["Castle Gates"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Wonderland"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -5,6 +5,7 @@ name = "Atlantica"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Atlantica"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -5,6 +5,7 @@ name = "Atlantica"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Atlantica"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -8,12 +8,14 @@ name = "Monstro"
[[world]] [[world]]
name = "Traverse Town" name = "Traverse Town"
rooms = ["2nd District"]
[[world]] [[world]]
name = "Atlantica" name = "Atlantica"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Halloween Town"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -5,6 +5,7 @@ name = "Atlantica"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Atlantica"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -2,6 +2,7 @@ name = "Sniperwild"
[[world]] [[world]]
name = "Traverse Town" name = "Traverse Town"
rooms = ["2nd District"]
[[drops]] [[drops]]
name = "Power Stone" name = "Power Stone"

View File

@ -4,6 +4,10 @@ name = "Soldier"
name = "Agrabah" name = "Agrabah"
rooms = ["Main Street"] rooms = ["Main Street"]
[[world]]
name = "End of the World"
rooms = ["World Terminus | Traverse Town"]
[[drops]] [[drops]]
name = "Spirit Shard" name = "Spirit Shard"
kind = "material" kind = "material"

View File

@ -2,6 +2,7 @@ name = "Stealth Soldier"
[[world]] [[world]]
name = "Hollow Bastion" name = "Hollow Bastion"
rooms = ["Entrance Hall", "Grand Hall"]
[[drops]] [[drops]]
name = "Energy Stone" name = "Energy Stone"

View File

@ -1,10 +1,12 @@
name = "Wight Knight" name = "Wight Knight"
[[world]] [[world]]
name = "Holloween Town" name = "Halloween Town"
rooms = ["Graveyard", "Manor Ruins"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Halloween Town"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -1,22 +1,29 @@
name = "Wizard" name = "Wizard"
[[world]] [[world]]
name = "Holloween Town" name = "Halloween Town"
[[world]] [[world]]
name = "Traverse Town" name = "Traverse Town"
rooms = ["Alleyway", "Hotel Hallway"]
[[world]] [[world]]
name = "Wonderland" name = "Wonderland"
[[world]] [[world]]
name = "Deep Jungle" name = "Deep Jungle"
rooms = ["Camp", "Bamboo Thicket"]
[[world]] [[world]]
name = "Agrabah" name = "Agrabah"
[[world]]
name = "Hollow Bastion"
rooms = ["Castle Gates", "Entrance Hall", "Grand Hall"]
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Wonderland"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

View File

@ -5,15 +5,18 @@ name = "Hollow Bastion"
[[world]] [[world]]
name = "Traverse Town" name = "Traverse Town"
rooms = ["2nd District"]
[[world]] [[world]]
name = "Deep Jungle" name = "Deep Jungle"
rooms = ["Camp", "Cliff"]
[[world]] [[world]]
name = "Agrabah" name = "Agrabah"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Olympus Coliseum"]
[[drops]] [[drops]]
name = "Hi-Potion" name = "Hi-Potion"

View File

@ -4,7 +4,8 @@ name = "Yellow Opera"
name = "Traverse Town" name = "Traverse Town"
[[world]] [[world]]
name = "Neverland" name = "Wonderland"
rooms = ["Lotus Forest"]
[[world]] [[world]]
name = "Agrabah" name = "Agrabah"
@ -17,6 +18,7 @@ name = "Monstro"
[[world]] [[world]]
name = "End of the World" name = "End of the World"
rooms = ["World Terminus | Wonderland"]
[[drops]] [[drops]]
name = "Ether" name = "Ether"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 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: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -14,26 +14,35 @@ function toggleWorldDisplay(display) {
const enemyWorlds = display.querySelector(".worlds"); const enemyWorlds = display.querySelector(".worlds");
const worldsWrapper = display.querySelectorAll(".worlds > div"); const worldsWrapper = display.querySelectorAll(".worlds > div");
const worldsIcons = display.querySelectorAll(".worlds > div > img"); const worldsIcons = display.querySelectorAll(".worlds > div > .icon");
const worldsNames = display.querySelectorAll(".worlds > div > .info");
if (!showWorlds) { if (!showWorlds) {
enemyWorlds.style.width = "32px"; enemyWorlds.style.width = "32px";
for (const wrapper of worldsWrapper) { for (const wrapper of worldsWrapper) {
wrapper.style.height = "32px"; wrapper.style.height = "32px";
wrapper.style["margin-bottom"] = "16px";
} }
for (const icon of worldsIcons) { for (const icon of worldsIcons) {
icon.width = "32"; icon.width = "32";
icon.height = "32"; icon.height = "32";
} }
for (const name of worldsNames) {
name.style.display = "none";
}
} else { } else {
enemyWorlds.style.width = "256px"; enemyWorlds.style.width = "256px";
for (const wrapper of worldsWrapper) { for (const wrapper of worldsWrapper) {
wrapper.style.height = "auto"; wrapper.style.height = "auto";
wrapper.style["margin-bottom"] = "0px";
} }
for (const icon of worldsIcons) { for (const icon of worldsIcons) {
icon.width = "64"; icon.width = "64";
icon.height = "64"; icon.height = "64";
} }
for (const name of worldsNames) {
name.style.display = "block";
}
} }
display.dataset["showWorlds"] = !showWorlds; display.dataset["showWorlds"] = !showWorlds;

View File

@ -30,7 +30,7 @@ table {
margin-top: 10px; margin-top: 10px;
thead th { thead th {
background-color: #252525; background-color: var(--bg-dark-color);
} }
} }
@ -39,39 +39,34 @@ ul {
} }
a { a {
color: #00ff00; color: var(--link-color);
text-decoration: none; text-decoration: none;
&:hover { &:visited {
color: #9dff9d; color: var(--link-visited-color);
} }
&:visited { &:hover {
color: #00a200; color: var(--link-hover-color);
&:hover {
color: #65a565;
}
} }
} }
button { button {
margin-left: 16px; margin-left: 16px;
background: #444; background: var(--button-bg-color);
color: #fff; color: var(--text-color);
padding: 8px; padding: 8px;
border-color: #555; border-color: var(--button-border-color);
border-bottom-color: rgb(85, 85, 85);
border-style: groove; border-style: groove;
border-bottom-color: #0a0; border-bottom-color: var(--primary-color);
transition-duration: 0.1s; transition-duration: 0.1s;
&:hover { &:hover {
background: #4f4f4f; background: var(--button-hover-bg-color);
} }
&:active { &:active {
background: #3f3f3f; background: var(--button-active-bg-color);
transform: translateY(1px); transform: translateY(1px);
} }
@ -80,3 +75,46 @@ button {
cursor: not-allowed; cursor: not-allowed;
} }
} }
input[type="checkbox"] {
appearance: none;
position: relative;
cursor: pointer;
width: 24px;
height: 24px;
padding-top: 8px;
& + label {
cursor: pointer;
}
&::before {
position: absolute;
width: 100%;
height: 100%;
content: "";
background-color: var(--bg-dark-color);
border: 1px solid var(--button-border-color);
border-radius: 5px;
}
&:hover::before {
background-color: var(--bg-light-color);
}
&:checked::after {
position: absolute;
content: "\2713";
color: var(--primary-color);
font-size: 48px;
top: -10px;
left: -4px;
align-content: center;
text-align: center;
white-space: pre;
}
&:checked:hover::after {
color: var(--primary-light-color);
}
}

View File

@ -1,4 +1,18 @@
:root { :root {
--bg-color: #333; --bg-color: #333;
--bg-dark-color: #252525;
--bg-light-color: #545454;
--text-color: #fff; --text-color: #fff;
--link-color: #0f0;
--link-hover-color: #9dff9d;
--link-visited-color: #00a200;
--button-bg-color: #444;
--button-hover-bg-color: #4f4f4f;
--button-active-bg-color: #3f3f3f;
--button-border-color: #555;
--primary-color: #00aa00;
--primary-light-color: #60de60;
} }

View File

@ -55,15 +55,45 @@
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
:first-child {
margin-top: 16px;
}
div { div {
display: inline-flex; display: inline-flex;
margin-bottom: 16px; margin-bottom: 16px;
font-size: 14px; font-size: 14px;
align-items: center; align-items: center;
p { .icon {
background-repeat: no-repeat;
background-position: center;
background-size: contain;
width: 64px;
height: 64px;
}
.info {
margin-left: 8px; margin-left: 8px;
margin-bottom: 0px;
ul {
padding-left: 24px;
margin-bottom: 0;
}
} }
} }
} }
} }
.material-filters {
display: flex;
flex-wrap: wrap;
width: 40%;
row-gap: 20px;
position: relative;
}
.tracked-filter {
margin-bottom: 16px;
}

View File

@ -1,6 +1,7 @@
use serde::Deserialize; use serde::Deserialize;
pub mod direction; pub mod direction;
pub mod drops;
pub mod enemy; pub mod enemy;
pub mod materials; pub mod materials;
pub mod synthesis; pub mod synthesis;

View File

@ -0,0 +1,45 @@
use itertools::Itertools;
use super::{Game, enemy::Enemy, materials::MaterialDrops};
#[derive(Debug, PartialEq, Eq)]
pub struct Drops {
pub game: Game,
pub drops: Vec<MaterialDrops>,
pub material_kinds: Vec<String>,
filter_max_len: usize,
}
impl Drops {
pub fn new(game: Game, enemies: Vec<Enemy>) -> Self {
let drops = MaterialDrops::new(enemies);
let material_kinds = drops
.iter()
.map(|d| d.category.get_category(&Game::Kh1))
.dedup()
.collect::<Vec<_>>();
let mut filter_max_len: usize = 0;
for kind in &material_kinds {
if kind.len() > filter_max_len {
filter_max_len = kind.len();
}
}
filter_max_len *= 10;
filter_max_len += 60;
Self {
game,
drops,
material_kinds,
filter_max_len,
}
}
pub fn get_filter_len(&self) -> usize {
self.filter_max_len
}
}

View File

@ -3,15 +3,15 @@ use std::collections::HashMap;
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq)] #[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq)]
pub struct SynthesisData { pub struct Synthesis {
pub sets: Vec<SynthesisSet>, pub sets: Vec<SynthesisSet>,
pub recipes: Vec<SynthesisRecipe>, pub recipes: Vec<SynthesisRecipe>,
} }
impl SynthesisData { impl Synthesis {
pub fn new(path: &str) -> SynthesisData { pub fn new(path: &str) -> Synthesis {
let str = std::fs::read_to_string(path).unwrap(); let str = std::fs::read_to_string(path).unwrap();
let mut data = toml::from_str::<SynthesisData>(&str).unwrap(); let mut data = toml::from_str::<Synthesis>(&str).unwrap();
for recipe in &mut data.recipes { for recipe in &mut data.recipes {
for set in &data.sets { for set in &data.sets {

View File

@ -1,9 +1,8 @@
use askama::Template; use askama::Template;
use itertools::Itertools;
use crate::{ use crate::{
RuntimeModule, RuntimeModule,
common::{Game, enemy::Enemy, materials::MaterialDrops, synthesis::SynthesisData}, common::{Game, drops::Drops, enemy::Enemy, synthesis::Synthesis},
create_file, create_file,
}; };
@ -13,15 +12,13 @@ const SYNTHESIS_PATH: &str = "./input/kh1/synthesis.toml";
#[derive(Template)] #[derive(Template)]
#[template(path = "pages/kh1/drops.html")] #[template(path = "pages/kh1/drops.html")]
struct DropsTemplate { struct DropsTemplate {
pub game: Game, pub data: Drops,
pub drops: Vec<MaterialDrops>,
pub material_kinds: Vec<String>,
} }
#[derive(Template)] #[derive(Template)]
#[template(path = "pages/kh1/synth.html")] #[template(path = "pages/kh1/synth.html")]
struct SynthTemplate { struct SynthTemplate {
pub data: SynthesisData, pub data: Synthesis,
} }
pub struct Module; pub struct Module;
@ -31,22 +28,13 @@ impl RuntimeModule for Module {
tracing::info!("Loading enemy data from {}", ENEMIES_PATH); tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
let enemies = Enemy::import(ENEMIES_PATH); let enemies = Enemy::import(ENEMIES_PATH);
let drops = MaterialDrops::new(enemies); let drops = Drops::new(Game::Kh1, enemies);
let material_kinds = drops
.iter()
.map(|d| d.category.get_category(&Game::Kh1))
.dedup()
.collect();
tracing::info!("Loading synthesis data from {}", SYNTHESIS_PATH); tracing::info!("Loading synthesis data from {}", SYNTHESIS_PATH);
let synth = SynthesisData::new(SYNTHESIS_PATH); let synth = Synthesis::new(SYNTHESIS_PATH);
tracing::info!("Generating the KH1 drops template"); tracing::info!("Generating the KH1 drops template");
let drops_template = DropsTemplate { let drops_template = DropsTemplate { data: drops };
game: Game::Kh1,
drops,
material_kinds,
};
create_file("./out/kh1", "drops", drops_template).unwrap(); create_file("./out/kh1", "drops", drops_template).unwrap();

View File

@ -1,9 +1,8 @@
use askama::Template; use askama::Template;
use itertools::Itertools;
use crate::{ use crate::{
RuntimeModule, RuntimeModule,
common::{Game, enemy::Enemy, materials::MaterialDrops}, common::{Game, drops::Drops, enemy::Enemy},
create_file, create_file,
}; };
@ -12,9 +11,7 @@ const ENEMIES_PATH: &str = "./input/kh2/enemies";
#[derive(Template)] #[derive(Template)]
#[template(path = "pages/kh2/drops.html")] #[template(path = "pages/kh2/drops.html")]
struct DropsTemplate { struct DropsTemplate {
pub game: Game, pub data: Drops,
pub drops: Vec<MaterialDrops>,
pub material_kinds: Vec<String>,
} }
pub struct Module; pub struct Module;
@ -24,19 +21,10 @@ impl RuntimeModule for Module {
tracing::info!("Loading enemy data from {}", ENEMIES_PATH); tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
let enemies = Enemy::import(ENEMIES_PATH); let enemies = Enemy::import(ENEMIES_PATH);
let drops = MaterialDrops::new(enemies); let drops = Drops::new(Game::Kh2, enemies);
let material_kinds = drops
.iter()
.map(|d| d.category.get_category(&Game::Kh2))
.dedup()
.collect();
tracing::info!("Generating the KH2 drops template"); tracing::info!("Generating the KH2 drops template");
let drops_template = DropsTemplate { let drops_template = DropsTemplate { data: drops };
game: Game::Kh2,
drops,
material_kinds,
};
create_file("./out/kh2", "drops", drops_template).unwrap(); create_file("./out/kh2", "drops", drops_template).unwrap();
} }

View File

@ -1,10 +1,9 @@
use askama::Template; use askama::Template;
use food::Recipes; use food::Recipes;
use itertools::Itertools;
use crate::{ use crate::{
RuntimeModule, RuntimeModule,
common::{Game, enemy::Enemy, materials::MaterialDrops}, common::{Game, drops::Drops, enemy::Enemy},
create_file, create_file,
}; };
@ -16,9 +15,7 @@ const RECIPES_PATH: &str = "./input/kh3/recipes.toml";
#[derive(Template)] #[derive(Template)]
#[template(path = "pages/kh3/drops.html")] #[template(path = "pages/kh3/drops.html")]
struct DropsTemplate { struct DropsTemplate {
pub game: Game, pub data: Drops,
pub drops: Vec<MaterialDrops>,
pub material_kinds: Vec<String>,
} }
#[derive(Template)] #[derive(Template)]
@ -34,23 +31,14 @@ impl RuntimeModule for Module {
tracing::info!("Loading enemy data from {}", ENEMIES_PATH); tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
let enemies = Enemy::import(ENEMIES_PATH); let enemies = Enemy::import(ENEMIES_PATH);
let drops = MaterialDrops::new(enemies); let drops = Drops::new(Game::Kh3, enemies);
let material_kinds = drops
.iter()
.map(|d| d.category.get_category(&Game::Kh3))
.dedup()
.collect();
tracing::info!("Loading recipes data from {}", RECIPES_PATH); tracing::info!("Loading recipes data from {}", RECIPES_PATH);
let recipes_str = std::fs::read_to_string(RECIPES_PATH).unwrap(); let recipes_str = std::fs::read_to_string(RECIPES_PATH).unwrap();
let recipes = toml::from_str::<Recipes>(&recipes_str).unwrap(); let recipes = toml::from_str::<Recipes>(&recipes_str).unwrap();
tracing::info!("Generating the KH3 drops template"); tracing::info!("Generating the KH3 drops template");
let drops_template = DropsTemplate { let drops_template = DropsTemplate { data: drops };
game: Game::Kh3,
drops,
material_kinds,
};
create_file("./out/kh3", "drops", drops_template).unwrap(); create_file("./out/kh3", "drops", drops_template).unwrap();

View File

@ -1,9 +1,31 @@
{% include "components/common/only-tracked-filter.html" %} <div class="tracked-filter">
<br /> <input
{% include "components/common/kind-filters.html" %} type="checkbox"
id="onlyTracked"
name="onlyTracked"
autocomplete="off"
value=""
/>
<label for="onlyTracked">Show only tracked</label>
</div>
<div class="material-filters">
{% for kind in data.material_kinds %}
<div style="flex: 0 1 {{+ data.get_filter_len() }}px;">
<input
type="checkbox"
id="{{ kind }}Filter"
name="kindFilter"
autocomplete="off"
value="{{ kind }}"
/>
<label for="{{ kind }}Filter">{{ kind|capitalize }}</label>
</div>
{% endfor %}
</div>
<br /> <br />
{% for drop in drops %} {% for drop in data.drops %}
{% call macros::drop("shard") %} {% call macros::drop("shard") %}
{% call macros::drop("stone") %} {% call macros::drop("stone") %}
{% call macros::drop("gem") %} {% call macros::drop("gem") %}

View File

@ -1,13 +0,0 @@
{% for kind in material_kinds %}
<input
type="checkbox"
id="{{ kind }}Filter"
name="kindFilter"
autocomplete="off"
value="{{ kind }}"
/>
<label for="{{ kind }}Filter">{{ kind|capitalize }}</label>
{% if loop.index0 == 6 %}
<br />
{% endif %}
{% endfor %}

View File

@ -1,8 +0,0 @@
<input
type="checkbox"
id="onlyTracked"
name="onlyTracked"
autocomplete="off"
value=""
/>
<label for="onlyTracked">Show only tracked</label>

View File

@ -3,12 +3,12 @@
{% if drops.len() > 0 %} {% if drops.len() > 0 %}
<div <div
class="category-wrapper" class="category-wrapper"
data-mat-kind="{{ drop.category.get_category(game) }}" data-mat-kind="{{ drop.category.get_category(data.game) }}"
data-mat-type="{{ label }}" data-mat-type="{{ label }}"
> >
<div class="category"> <div class="category">
<img <img
src="../public/assets/materials/{{ drop.texture(game) }}.webp" src="../public/assets/materials/{{ drop.texture(data.game) }}.webp"
width="64" width="64"
height="64" height="64"
/> />
@ -27,29 +27,20 @@
</div> </div>
<div class="worlds"> <div class="worlds">
{% for spawn in drop.spawns %} {% for spawn in drop.spawns %}
{% if spawn.rooms.len() > 0 %} <div>
{% for room in spawn.rooms %} <div
<div> class="icon"
<img style="background-image: url('../public/assets/worlds/{{ spawn.texture() }}.webp');"
src="../public/assets/worlds/{{ spawn.texture() }}.webp" ></div>
width="64" <div class="info">
height="64"
/>
<p>
{{ spawn.name +}} - {{+ room }}
</p>
</div>
{% endfor %}
{% else %}
<div>
<img
src="../public/assets/worlds/{{ spawn.texture() }}.webp"
width="64"
height="64"
/>
<p>{{ spawn.name }}</p> <p>{{ spawn.name }}</p>
<ul>
{% for room in spawn.rooms %}
<li>{{+ room }}</li>
{% endfor %}
</ul>
</div> </div>
{% endif %} </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>