Some more organization and splits
parent
fb7509ec14
commit
1d1b3c02dd
|
@ -84,6 +84,10 @@ input[type="checkbox"] {
|
||||||
height: 24px;
|
height: 24px;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
|
|
||||||
|
& + label {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -89,11 +89,11 @@
|
||||||
.material-filters {
|
.material-filters {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
width: 25%;
|
width: 40%;
|
||||||
row-gap: 20px;
|
row-gap: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
}
|
||||||
div {
|
|
||||||
flex-basis: 25%;
|
.tracked-filter {
|
||||||
}
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
24
src/kh1.rs
24
src/kh1.rs
|
@ -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();
|
||||||
|
|
||||||
|
|
20
src/kh2.rs
20
src/kh2.rs
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
20
src/kh3.rs
20
src/kh3.rs
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
<input
|
<div class="tracked-filter">
|
||||||
type="checkbox"
|
<input
|
||||||
id="onlyTracked"
|
type="checkbox"
|
||||||
name="onlyTracked"
|
id="onlyTracked"
|
||||||
autocomplete="off"
|
name="onlyTracked"
|
||||||
value=""
|
autocomplete="off"
|
||||||
/>
|
value=""
|
||||||
<label for="onlyTracked">Show only tracked</label>
|
/>
|
||||||
<br />
|
<label for="onlyTracked">Show only tracked</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="material-filters">
|
<div class="material-filters">
|
||||||
{% for kind in material_kinds %}
|
{% for kind in data.material_kinds %}
|
||||||
<div>
|
<div style="flex: 0 1 {{+ data.get_filter_len() }}px;">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="{{ kind }}Filter"
|
id="{{ kind }}Filter"
|
||||||
|
@ -20,14 +21,11 @@
|
||||||
/>
|
/>
|
||||||
<label for="{{ kind }}Filter">{{ kind|capitalize }}</label>
|
<label for="{{ kind }}Filter">{{ kind|capitalize }}</label>
|
||||||
</div>
|
</div>
|
||||||
{#{% if loop.index0 == 6 %}
|
|
||||||
<br />
|
|
||||||
{% endif %}#}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</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") %}
|
||||||
|
|
|
@ -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"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue