KH2 material drops
parent
c5738bf038
commit
7cfc5c41a1
|
@ -10,3 +10,4 @@ Cargo.lock
|
|||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
assets/
|
||||
|
|
|
@ -13,7 +13,8 @@ tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
|||
itertools = "0.13.0"
|
||||
|
||||
[features]
|
||||
default = ["bbs", "ddd", "kh3"]
|
||||
default = ["bbs", "ddd", "kh3", "kh2"]
|
||||
kh2 = []
|
||||
kh3 = []
|
||||
bbs = []
|
||||
ddd = []
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
kind = "blazing"
|
||||
|
||||
[[shard]]
|
||||
from = "Hammer Frame"
|
||||
chance = 10
|
||||
|
||||
[[shard]]
|
||||
from = "Minute Bomb"
|
||||
chance = 6
|
||||
|
||||
[[stone]]
|
||||
from = "Cannon Gun"
|
||||
chance = 6
|
||||
|
||||
[[stone]]
|
||||
from = "Tornado Step"
|
||||
chance = 8
|
||||
|
||||
[[gem]]
|
||||
from = "Fat Bandit"
|
||||
chance = 12
|
||||
|
||||
[[gem]]
|
||||
from = "Fiery Globe"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Crescendo"
|
||||
chance = 6
|
||||
|
||||
[[crystal]]
|
||||
from = "Crimson Jazz"
|
||||
chance = 12
|
|
@ -0,0 +1,77 @@
|
|||
kind = "bright"
|
||||
|
||||
[[shard]]
|
||||
from = "Creeper Plant"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Hook Bat"
|
||||
chance = 3
|
||||
|
||||
[[shard]]
|
||||
from = "Minute Bomb"
|
||||
chance = 3
|
||||
|
||||
[[shard]]
|
||||
from = "Rabid Dog"
|
||||
chance = 3
|
||||
|
||||
[[shard]]
|
||||
from = "Soldier"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Aeroplane"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Cannon Gun"
|
||||
chance = 3
|
||||
|
||||
[[stone]]
|
||||
from = "Drilelr Mole"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Luna Bandit"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Silver Rock"
|
||||
chance = 3
|
||||
|
||||
[[stone]]
|
||||
from = "Tornado Step"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Wight Knight"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Aerial Knocker"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Magnum Loader"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Surveillance Robot"
|
||||
chance = 3
|
||||
|
||||
[[crystal]]
|
||||
from = "Air Pirate"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Crescendo"
|
||||
chance = 3
|
||||
|
||||
[[crystal]]
|
||||
from = "Neoshadow"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Strafer"
|
||||
chance = 4
|
|
@ -0,0 +1,29 @@
|
|||
kind = "dark"
|
||||
|
||||
[[shard]]
|
||||
from = "Shadow"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Soldier"
|
||||
chance = 8
|
||||
|
||||
[[stone]]
|
||||
from = "Assault Rider"
|
||||
chance = 12
|
||||
|
||||
[[stone]]
|
||||
from = "Nightwalker"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Gargoyle Knight"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Gargoyle Warrior"
|
||||
chance = 8
|
||||
|
||||
[[crystal]]
|
||||
from = "Air Pirate"
|
||||
chance = 8
|
|
@ -0,0 +1,21 @@
|
|||
kind = "dense"
|
||||
|
||||
[[shard]]
|
||||
from = "Creeper"
|
||||
chance = 8
|
||||
|
||||
[[shard]]
|
||||
from = "Dragoon"
|
||||
chance = 12
|
||||
|
||||
[[stone]]
|
||||
from = "Sniper"
|
||||
chance = 12
|
||||
|
||||
[[gem]]
|
||||
from = "Samurai"
|
||||
chance = 12
|
||||
|
||||
[[crystal]]
|
||||
from = "Berserker"
|
||||
chance = 12
|
|
@ -0,0 +1,45 @@
|
|||
kind = "energy"
|
||||
|
||||
[[shard]]
|
||||
from = "Bolt Tower"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Gargoyle Knight"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Gargoyle Warrior"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Nightwalker"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Hammer Frame"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Lance Soldier"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Trick Ghost"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Emerald Blues"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Fortuneteller"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Bookmaster"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Shaman"
|
||||
chance = 4
|
|
@ -0,0 +1,29 @@
|
|||
kind = "frost"
|
||||
|
||||
[[shard]]
|
||||
from = "Hook Bat"
|
||||
chance = 6
|
||||
|
||||
[[shard]]
|
||||
from = "Lance Solider"
|
||||
chance = 10
|
||||
|
||||
[[stone]]
|
||||
from = "Aeroplane"
|
||||
chance = 8
|
||||
|
||||
[[stone]]
|
||||
from = "Hot Rod"
|
||||
chance = 12
|
||||
|
||||
[[gem]]
|
||||
from = "Fortuneteller"
|
||||
chance = 8
|
||||
|
||||
[[gem]]
|
||||
from = "Icy Cube"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Living Bone"
|
||||
chance = 12
|
|
@ -0,0 +1,33 @@
|
|||
kind = "lightning"
|
||||
|
||||
[[shard]]
|
||||
from = "Bolt Tower"
|
||||
chance = 10
|
||||
|
||||
[[shard]]
|
||||
from = "Rapid Thruster"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Driller Mole"
|
||||
chance = 6
|
||||
|
||||
[[stone]]
|
||||
from = "Emerald Blues"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Armored Knight"
|
||||
chance = 12
|
||||
|
||||
[[gem]]
|
||||
from = "Surveillance Robot"
|
||||
chance = 8
|
||||
|
||||
[[crystal]]
|
||||
from = "Devastator"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Strafer"
|
||||
chance = 6
|
|
@ -0,0 +1,33 @@
|
|||
kind = "lucid"
|
||||
|
||||
[[shard]]
|
||||
from = "Rabid Dog"
|
||||
chance = 6
|
||||
|
||||
[[shard]]
|
||||
from = "Trick Ghost"
|
||||
chance = 10
|
||||
|
||||
[[stone]]
|
||||
from = "Graveyard"
|
||||
chance = 12
|
||||
|
||||
[[stone]]
|
||||
from = "Toy Soldier"
|
||||
chance = 12
|
||||
|
||||
[[stone]]
|
||||
from = "Wight Knight"
|
||||
chance = 8
|
||||
|
||||
[[gem]]
|
||||
from = "Bookmaster"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Magnum Loader"
|
||||
chance = 8
|
||||
|
||||
[[crystal]]
|
||||
from = "Neoshadow"
|
||||
chance = 8
|
|
@ -0,0 +1,29 @@
|
|||
kind = "power"
|
||||
|
||||
[[shard]]
|
||||
from = "Creeper Plant"
|
||||
chance = 8
|
||||
|
||||
[[shard]]
|
||||
from = "Large Body"
|
||||
chance = 12
|
||||
|
||||
[[stone]]
|
||||
from = "Luna Bandit"
|
||||
chance = 8
|
||||
|
||||
[[stone]]
|
||||
from = "Silver Rock"
|
||||
chance = 8
|
||||
|
||||
[[gem]]
|
||||
from = "Aerial Knocker"
|
||||
chance = 8
|
||||
|
||||
[[gem]]
|
||||
from = "Shaman"
|
||||
chance = 10
|
||||
|
||||
[[crystal]]
|
||||
from = "Morning Star"
|
||||
chance = 12
|
|
@ -0,0 +1,45 @@
|
|||
kind = "remembrance"
|
||||
|
||||
[[shard]]
|
||||
from = "Beffudler"
|
||||
chance = 6
|
||||
|
||||
[[shard]]
|
||||
from = "Iron Hammer"
|
||||
chance = 10
|
||||
|
||||
[[shard]]
|
||||
from = "Camo Cannon"
|
||||
chance = 6
|
||||
|
||||
[[stone]]
|
||||
from = "Aerial Viking"
|
||||
chance = 6
|
||||
|
||||
[[stone]]
|
||||
from = "Magic Phantom"
|
||||
chance = 10
|
||||
|
||||
[[stone]]
|
||||
from = "Lance Warrior"
|
||||
chance = 10
|
||||
|
||||
[[stone]]
|
||||
from = "Necromancer"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Spring Metal"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Runemaster"
|
||||
chance = 10
|
||||
|
||||
[[gem]]
|
||||
from = "Mad Ride"
|
||||
chance = 12
|
||||
|
||||
[[crystal]]
|
||||
from = "Reckless"
|
||||
chance = 12
|
|
@ -0,0 +1,81 @@
|
|||
kind = "serenity"
|
||||
|
||||
[[shard]]
|
||||
from = "Assault Rider"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Creeper"
|
||||
chance = 2
|
||||
|
||||
[[shard]]
|
||||
from = "Fat Bandit"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Graveyard"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Hot Rod"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Large Body"
|
||||
chance = 4
|
||||
|
||||
[[shard]]
|
||||
from = "Toy Soldier"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Crimson Jazz"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Devastator"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Dusk"
|
||||
chance = 2
|
||||
|
||||
[[stone]]
|
||||
from = "Living Bone"
|
||||
chance = 4
|
||||
|
||||
[[stone]]
|
||||
from = "Morning Star"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Dancer"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Dragoon"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Gambler"
|
||||
chance = 4
|
||||
|
||||
[[gem]]
|
||||
from = "Sniper"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Assassin"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Berserker"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Samurai"
|
||||
chance = 4
|
||||
|
||||
[[crystal]]
|
||||
from = "Sorcerer"
|
||||
chance = 4
|
|
@ -0,0 +1,21 @@
|
|||
kind = "twilight"
|
||||
|
||||
[[shard]]
|
||||
from = "Dusk"
|
||||
chance = 10
|
||||
|
||||
[[shard]]
|
||||
from = "Gambler"
|
||||
chance = 12
|
||||
|
||||
[[stone]]
|
||||
from = "Dancer"
|
||||
chance = 12
|
||||
|
||||
[[gem]]
|
||||
from = "Assassin"
|
||||
chance = 12
|
||||
|
||||
[[crystal]]
|
||||
from = "Sorcerer"
|
||||
chance = 12
|
|
@ -0,0 +1,68 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use rinja::Template;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::create_file;
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
pub struct MaterialDrops {
|
||||
kind: String,
|
||||
shard: Vec<EnemyDrop>,
|
||||
stone: Vec<EnemyDrop>,
|
||||
gem: Vec<EnemyDrop>,
|
||||
crystal: Vec<EnemyDrop>,
|
||||
}
|
||||
|
||||
impl MaterialDrops {
|
||||
fn drops(&self, kind: &str) -> &[EnemyDrop] {
|
||||
match kind {
|
||||
x if x == "shard" => &self.shard,
|
||||
x if x == "stone" => &self.stone,
|
||||
x if x == "gem" => &self.gem,
|
||||
x if x == "crystal" => &self.crystal,
|
||||
_ => &self.shard,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
pub struct EnemyDrop {
|
||||
from: String,
|
||||
chance: u8,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "pages/kh2/drops.html")]
|
||||
struct DropsTemplate {
|
||||
pub drops: Vec<MaterialDrops>,
|
||||
}
|
||||
|
||||
const DROPS_PATH: &str = "./input/kh2/drops";
|
||||
|
||||
pub fn init() {
|
||||
tracing::info!("Loading enemy drops data from {}", DROPS_PATH);
|
||||
let mut drops: Vec<MaterialDrops> = vec![];
|
||||
// Loading multiple files into one vector due to the size of each board
|
||||
let paths = std::fs::read_dir(DROPS_PATH)
|
||||
.unwrap()
|
||||
.filter_map(|f| f.ok())
|
||||
.map(|f| f.path())
|
||||
.filter_map(|p| match p.extension().map_or(false, |e| e == "toml") {
|
||||
true => Some(p),
|
||||
false => None,
|
||||
})
|
||||
.collect::<Vec<PathBuf>>();
|
||||
|
||||
for path in paths {
|
||||
let drops_str = std::fs::read_to_string(path).unwrap();
|
||||
let enemy_drops = toml::from_str::<MaterialDrops>(&drops_str).unwrap();
|
||||
drops.push(enemy_drops);
|
||||
}
|
||||
drops.sort_by(|a, b| a.kind.cmp(&b.kind));
|
||||
|
||||
tracing::info!("Generating the KH2 drops template");
|
||||
let drops_template = DropsTemplate { drops };
|
||||
|
||||
create_file("./out/kh2", "drops", drops_template.render().unwrap()).unwrap();
|
||||
}
|
|
@ -9,6 +9,9 @@ mod bbs;
|
|||
#[cfg(feature = "ddd")]
|
||||
mod ddd;
|
||||
|
||||
#[cfg(feature = "kh2")]
|
||||
mod kh2;
|
||||
|
||||
#[cfg(feature = "kh3")]
|
||||
mod kh3;
|
||||
|
||||
|
@ -36,6 +39,9 @@ fn main() {
|
|||
#[cfg(feature = "ddd")]
|
||||
ddd::init();
|
||||
|
||||
#[cfg(feature = "kh2")]
|
||||
kh2::init();
|
||||
|
||||
#[cfg(feature = "kh3")]
|
||||
kh3::init();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{% macro drop(label) %}
|
||||
<div class="category">
|
||||
<img
|
||||
src="../assets/materials/{{ category.kind }}/{{ label }}.webp"
|
||||
width="64"
|
||||
height="64"
|
||||
/>
|
||||
<h1>{{ category.kind|capitalize +}} {{+ label|capitalize }}</h1>
|
||||
</div>
|
||||
<div class="enemies">
|
||||
{% for drop in category.drops(label) %}
|
||||
<div class="drop">
|
||||
<img
|
||||
src="../assets/enemies/{{ drop.from|lower }}.webp"
|
||||
width="256"
|
||||
height="256"
|
||||
onerror="this.src = '../assets/enemies/unknown.webp'"
|
||||
/>
|
||||
<span>{{ drop.from +}}</span>
|
||||
<span>{{+ drop.chance }}%</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
|
@ -0,0 +1,38 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% import "macros/kh2/macros.html" as macros %}
|
||||
|
||||
{% block title %}KH2 - Drops{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
.category {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.enemies {
|
||||
display: flex;
|
||||
|
||||
.drop {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
margin-right: 8px;
|
||||
|
||||
span {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% for category in drops %}
|
||||
{% call macros::drop("shard") %}
|
||||
{% call macros::drop("stone") %}
|
||||
{% call macros::drop("gem") %}
|
||||
{% call macros::drop("crystal") %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue