Compare commits

...

8 Commits

30 changed files with 3203 additions and 4357 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
# will have compiled files and executables
debug/
target/
out/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html

View File

@ -1,12 +1,13 @@
[package]
name = "khguide"
version = "1.0.2"
version = "1.1.0"
edition = "2021"
[dependencies]
askama = "0.12.1"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.118"
toml = "0.8.19"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
itertools = "0.13.0"

4166
index.html

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,224 @@
spirit = "Fin Fatale"
order = 9
[[routes]]
id = 0
name = "Grunt"
color = "purple"
[[routes.tips]]
to = "Water Slinger"
tip = "Body"
[[routes.tips]]
to = "Charger"
tip = "Face"
[[routes.tips]]
to = "Diver"
tip = "Body"
[[routes]]
id = 1
name = "Diver"
color = "green"
[[routes.tips]]
to = "Charger"
tip = "Body"
[[routes.tips]]
to = "Water Slinger"
tip = "Face"
[[routes.tips]]
to = "Grunt"
tip = "Body"
[[routes]]
id = 2
name = "Charger"
color = "yellow"
[[routes.tips]]
to = "Diver"
tip = "Face"
[[routes.tips]]
to = "Water Slinger"
tip = "Face"
[[routes.tips]]
to = "Grunt"
tip = "Body"
[[routes]]
id = 3
name = "Water Slinger"
color = "blue"
[[routes.tips]]
to = "Grunt"
tip = "Tailfin"
[[routes.tips]]
to = "Diver"
tip = "Face"
[[routes.tips]]
to = "Charger"
tip = "Tailfin"
[[routes]]
id = 100
name = "Secret Route 1"
color = "secret1"
tips = []
[[abilities]]
name = "Start"
pos = "A1"
type = "Start"
price = ""
path = ["S"]
[[abilities]]
name = "Zero Gravity"
pos = "A2"
type = "Magic"
price = "10 LP"
path = ["N", "S"]
[[abilities]]
name = "Attack Haste"
pos = "A3"
type = "Stat"
price = "30 LP"
path = ["N", "S", "E"]
[[abilities]]
name = "Water Boost"
pos = "A4"
type = "Stat"
price = "30 LP"
path = ["N", "S"]
[[abilities]]
name = "Gravity Strike"
pos = "A5"
type = "Attack"
price = "100 LP"
path = ["N", "S"]
[[abilities]]
name = "Water Boost"
pos = "A6"
type = "Stat"
price = "100 LP"
route = 0
path = ["N", "S"]
[[abilities]]
name = "Attack Haste"
pos = "A7"
type = "Stat"
price = "100 LP"
route = 0
path = ["N"]
[[abilities]]
name = "Water Screen"
pos = "B3"
type = "Stat"
price = "20 LP"
path = ["W", "E", "S"]
[[abilities]]
name = "Attack Haste"
pos = "B4"
type = "Stat"
price = "50 LP"
path = ["N", "S"]
[[abilities]]
name = "Secret"
pos = "B5"
type = "Secret"
price = "10 LP"
path = ["N", "S"]
[[abilities]]
name = "Checkpoint"
pos = "B6"
type = "Checkpoint"
price = "Level 20"
route = 100
path = ["N", "S"]
[[abilities]]
name = "Zero Gravira"
pos = "B7"
type = "Magic"
price = "100 LP"
route = 100
path = ["N", "S"]
[[abilities]]
name = "Checkpoint"
pos = "B8"
type = "Checkpoint"
price = "Level 25"
route = 100
path = ["N", "E"]
[[abilities]]
name = "Sleep Block"
pos = "C3"
type = "Stat"
price = "30 LP"
path = ["W", "E", "S"]
[[abilities]]
name = "Water Boost"
pos = "C4"
type = "Stat"
price = "50 LP"
path = ["N", "S"]
[[abilities]]
name = "Slow Block"
pos = "C5"
type = "Stat"
price = "30 LP"
path = ["N", "S"]
[[abilities]]
name = "Attack Boost"
pos = "C6"
type = "Stat"
price = "100 LP"
path = ["N"]
[[abilities]]
name = "Zero Graviga"
pos = "C8"
type = "Magic"
price = "150 LP"
route = 100
path = ["W"]
[[abilities]]
name = "Support Boost"
pos = "D2"
type = "Spirit"
price = "200 LP"
route = 1
path = ["S"]
[[abilities]]
name = "HP Boost"
pos = "D3"
type = "Stat"
price = "30 LP"
route = 1
path = ["N", "W"]

View File

@ -0,0 +1,200 @@
spirit = "Hebby Repp"
order = 6
[[routes]]
id = 0
name = "Wheeler"
color = "purple"
[[routes.tips]]
to = "Salamander"
tip = "Head"
[[routes.tips]]
to = "Serpent"
tip = "Head"
[[routes.tips]]
to = "Hydra"
tip = "Chest"
[[routes]]
id = 1
name = "Salamander"
color = "yellow"
[[routes.tips]]
to = "Hydra"
tip = "Head"
[[routes.tips]]
to = "Serpent"
tip = "Head"
[[routes.tips]]
to = "Wheeler"
tip = "Chest"
[[routes]]
id = 2
name = "Serpent"
color = "blue"
[[routes.tips]]
to = "Wheeler"
tip = "Head"
[[routes.tips]]
to = "Hydra"
tip = "Head"
[[routes.tips]]
to = "Salamander"
tip = "Tail"
[[routes]]
id = 3
name = "Hydra"
color = "green"
[[routes.tips]]
to = "Salamander"
tip = "Head"
[[routes.tips]]
to = "Wheeler"
tip = "Head"
[[routes.tips]]
to = "Serpent"
tip = "Chest"
[[abilities]]
name = "Start"
pos = "A1"
type = "Start"
price = ""
path = ["E"]
[[abilities]]
name = "Fire Screen"
pos = "A4"
type = "Stat"
price = "60 LP"
route = 0
path = ["E", "S"]
[[abilities]]
name = "Defense Boost"
pos = "A5"
type = "Stat"
price = "100 LP"
route = 0
path = ["N"]
[[abilities]]
name = "Fire"
pos = "B1"
type = "Magic"
price = "10 LP"
path = ["W", "E"]
[[abilities]]
name = "Fire Screen"
pos = "B3"
type = "Stat"
price = "20 LP"
path = ["E", "S"]
[[abilities]]
name = "Fire Boost"
pos = "B4"
type = "Stat"
price = "50 LP"
path = ["N", "W", "S"]
[[abilities]]
name = "Fire Screen"
pos = "B5"
type = "Stat"
price = "40 LP"
path = ["N", "E"]
[[abilities]]
name = "HP Boost"
pos = "C1"
type = "Stat"
price = "30 LP"
path = ["W", "E"]
[[abilities]]
name = "Magic Boost"
pos = "C3"
type = "Stat"
price = "100 LP"
path = ["W", "E"]
[[abilities]]
name = "Fire Boost"
pos = "C5"
type = "Stat"
price = "100 LP"
path = ["W", "E"]
[[abilities]]
name = "Fire Boost"
pos = "D1"
type = "Stat"
price = "30 LP"
path = ["W", "S"]
[[abilities]]
name = "Slow Block"
pos = "D2"
type = "Stat"
price = "30 LP"
path = ["N", "S"]
[[abilities]]
name = "Magic Haste"
pos = "D3"
type = "Stat"
price = "30 LP"
path = ["N", "W", "E"]
[[abilities]]
name = "Fira"
pos = "D4"
type = "Magic"
price = "100 LP"
path = ["S"]
[[abilities]]
name = "Checkpoint"
pos = "D5"
type = "Checkpoint"
price = "Link x3"
path = ["W", "N", "S"]
[[abilities]]
name = "Fire Windmill"
pos = "D6"
type = "Attack"
price = "150 LP"
path = ["N"]
[[abilities]]
name = "HP Boost"
pos = "E3"
type = "Stat"
price = "50 LP"
route = 1
path = ["W", "E"]
[[abilities]]
name = "Magic Haste"
pos = "F3"
type = "Stat"
price = "50 LP"
route = 1
path = ["W"]

View File

@ -0,0 +1,207 @@
spirit = "Komory Bat"
order = 4
[[routes]]
id = 0
name = "Rescuer"
color = "blue"
[[routes.tips]]
to = "Aggro"
tip = "Face"
[[routes.tips]]
to = "Wingman"
tip = "Face"
[[routes.tips]]
to = "Saboteur"
tip = "Ears"
[[routes]]
id = 1
name = "Aggro"
color = "purple"
[[routes.tips]]
to = "Rescuer"
tip = "Face"
[[routes.tips]]
to = "Wingman"
tip = "Wings"
[[routes.tips]]
to = "Saboteur"
tip = "Face"
[[routes]]
id = 2
name = "Wingman"
color = "yellow"
[[routes.tips]]
to = "Rescuer"
tip = "Face"
[[routes.tips]]
to = "Aggro"
tip = "Ears"
[[routes.tips]]
to = "Saboteur"
tip = "Wings"
[[routes]]
id = 3
name = "Saboteur"
color = "green"
[[routes.tips]]
to = "Rescuer"
tip = "Face"
[[routes.tips]]
to = "Aggro"
tip = "Ears"
[[routes.tips]]
to = "Wingman"
tip = "Ears"
[[abilities]]
name = "Start"
pos = "A3"
type = "Start"
price = ""
path = ["E"]
[[abilities]]
name = "Waking Dream"
pos = "B3"
type = "Spirit"
price = "10 LP"
path = ["W", "E"]
[[abilities]]
name = "Checkpoint"
pos = "C1"
type = "Checkpoint"
price = "Link x2"
path = ["E", "S"]
[[abilities]]
name = "Zero Gravity"
pos = "C2"
type = "Magic"
price = "50 LP"
path = ["N", "E", "S"]
[[abilities]]
name = "Confuse"
pos = "C3"
type = "Magic"
price = "50 LP"
path = ["S", "N", "W", "E"]
[[abilities]]
name = "Dark Screen"
pos = "C4"
type = "Stat"
price = "20 LP"
path = ["N", "E", "S"]
[[abilities]]
name = "Magic Haste"
pos = "C5"
type = "Stat"
price = "50 LP"
route = 0
path = ["N", "E"]
[[abilities]]
name = "Zero Gravira"
pos = "D1"
type = "Magic"
price = "100 LP"
path = ["W"]
[[abilities]]
name = "Confusion Block"
pos = "D2"
type = "Stat"
price = "30 LP"
path = ["W", "S"]
[[abilities]]
name = "Drain Dive"
pos = "D3"
type = "Attack"
price = "50 LP"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Magic Boost"
pos = "D4"
type = "Stat"
price = "100 LP"
path = ["W", "N", "E"]
[[abilities]]
name = "Magic Haste"
pos = "D5"
type = "Stat"
price = "100 LP"
route = 0
path = ["W"]
[[abilities]]
name = "Attack Boost"
pos = "E2"
type = "Stat"
price = "100 LP"
path = ["S"]
[[abilities]]
name = "Magic Haste"
pos = "E3"
type = "Stat"
price = "30 LP"
path = ["W", "E", "N"]
[[abilities]]
name = "Attack Haste"
pos = "E4"
type = "Stat"
price = "30 LP"
route = 1
path = ["W", "E"]
[[abilities]]
name = "Dark Screen"
pos = "F3"
type = "Stat"
price = "40 LP"
path = ["W", "E"]
[[abilities]]
name = "Attack Haste"
pos = "F4"
type = "Stat"
price = "50 LP"
route = 1
path = ["W"]
[[abilities]]
name = "Checkpoint"
pos = "G3"
type = "Checkpoint"
price = "Link x2"
path = ["W", "E"]
[[abilities]]
name = "Confusing Strike"
pos = "H3"
type = "Attack"
price = "100 LP"
path = ["W"]

View File

@ -0,0 +1,207 @@
spirit = "Meow Wow"
order = 1
[[routes]]
color = "purple"
id = 0
name = "Stray"
[[routes.tips]]
tip = "Tail"
to = "Smart Cookie"
[[routes.tips]]
tip = "Face"
to = "Rascal"
[[routes.tips]]
tip = "Legs"
to = "Sidekick"
[[routes]]
color = "blue"
id = 1
name = "Smart Cookie"
[[routes.tips]]
tip = "Tail"
to = "Stray"
[[routes.tips]]
tip = "Tail"
to = "Rascal"
[[routes.tips]]
tip = "Face"
to = "Sidekick"
[[routes]]
color = "yellow"
id = 3
name = "Rascal"
[[routes.tips]]
tip = "Legs"
to = "Stray"
[[routes.tips]]
tip = "Face"
to = "Smart Cookie"
[[routes.tips]]
tip = "Tail"
to = "Sidekick"
[[routes]]
color = "green"
id = 4
name = "Sidekick"
[[routes.tips]]
tip = "Legs"
to = "Stray"
[[routes.tips]]
tip = "Face"
to = "Smart Cookie"
[[routes.tips]]
tip = "Tail"
to = "Rascal"
[[abilities]]
name = "Start"
path = ["E"]
pos = "A2"
price = ""
type = "Start"
[[abilities]]
name = "Link Critical"
path = ["W", "E"]
pos = "B2"
price = "10 LP"
type = "Spirit"
[[abilities]]
name = "Magic Haste"
path = ["S", "E"]
pos = "C1"
price = "30 LP"
type = "Stat"
[[abilities]]
name = "Cure"
path = ["N", "W", "E", "S"]
pos = "C2"
price = "50 LP"
type = "Magic"
[[abilities]]
name = "Item Boost"
path = ["E", "N"]
pos = "C3"
price = "30 LP"
type = "Stat"
[[abilities]]
name = "Light Screen"
path = ["E", "W"]
pos = "D1"
price = "20 LP"
type = "Stat"
[[abilities]]
name = "Checkpoint"
path = ["E", "W"]
pos = "D2"
price = "Level 10"
type = "Checkpoint"
[[abilities]]
name = "Slow"
path = ["E", "W"]
pos = "D3"
price = "50 LP"
type = "Magic"
[[abilities]]
name = "Defense Boost"
path = ["E", "W"]
pos = "E1"
price = "100 LP"
type = "Stat"
[[abilities]]
name = "Cura"
path = ["E", "W"]
pos = "E2"
price = "100 LP"
type = "Magic"
[[abilities]]
name = "Poison Block"
path = ["E", "S", "W"]
pos = "E3"
price = "30 LP"
type = "Stat"
[[abilities]]
name = "Spark"
path = ["N"]
pos = "E4"
price = "50 LP"
type = "Magic"
[[abilities]]
name = "Confusion Block"
path = ["E", "W"]
pos = "F1"
price = "30 LP"
route = 0
type = "Stat"
[[abilities]]
name = "Leaf Bracer"
path = ["E", "W"]
pos = "F2"
price = "300 LP"
type = "Support"
[[abilities]]
name = "Attack Haste"
path = ["E", "W"]
pos = "F3"
price = "30 LP"
route = 1
type = "Stat"
[[abilities]]
name = "HP Boost"
path = ["W"]
pos = "G1"
price = "30 LP"
route = 0
type = "Stat"
[[abilities]]
name = "Checkpoint"
path = ["E", "W"]
pos = "G2"
price = "Level 25"
type = "Checkpoint"
[[abilities]]
name = "Magic Boost"
path = ["W"]
pos = "G3"
price = "100 LP"
route = 1
type = "Stat"
[[abilities]]
name = "Curaga"
path = ["W"]
pos = "H2"
price = "150 LP"
type = "Magic"

View File

@ -0,0 +1,200 @@
spirit = "Necho Cat"
order = 11
[[routes]]
id = 0
name = "Diva"
color = "blue"
[[routes.tips]]
to = "Multi-Talent"
tip = "Face"
[[routes.tips]]
to = "Dancer"
tip = "Face"
[[routes.tips]]
to = "Artist"
tip = "Body"
[[routes]]
id = 1
name = "Artist"
color = "green"
[[routes.tips]]
to = "Dancer"
tip = "Face"
[[routes.tips]]
to = "Multi-Talent"
tip = "Face"
[[routes.tips]]
to = "Diva"
tip = "Legs"
[[routes]]
id = 2
name = "Multi-Talent"
color = "purple"
[[routes.tips]]
to = "Diva"
tip = "Face"
[[routes.tips]]
to = "Artist"
tip = "Face"
[[routes.tips]]
to = "Dancer"
tip = "Legs"
[[routes]]
id = 3
name = "Dancer"
color = "yellow"
[[routes.tips]]
to = "Artist"
tip = "Legs"
[[routes.tips]]
to = "Multi-Talent"
tip = "Face"
[[routes.tips]]
to = "Diva"
tip = "Legs"
[[abilities]]
name = "Magic Boost"
pos = "A4"
type = "Stat"
price = "200 LP"
route = 0
path = ["E"]
[[abilities]]
name = "Support Boost"
pos = "B1"
type = "Spirit"
price = "200 LP"
path = ["E"]
[[abilities]]
name = "HP Boost"
pos = "B3"
type = "Stat"
price = "30 LP"
path = ["E"]
[[abilities]]
name = "Confusion Block"
pos = "B4"
type = "Stat"
price = "30 LP"
route = 0
path = ["W", "E"]
[[abilities]]
name = "Thunder Boost"
pos = "B5"
type = "Stat"
price = "50 LP"
path = ["E", "S"]
[[abilities]]
name = "Magic Haste"
pos = "B6"
type = "Stat"
price = "50 LP"
path = ["E", "N"]
[[abilities]]
name = "Checkpoint"
pos = "C1"
type = "Checkpoint"
price = "Link x3"
path = ["W", "S"]
[[abilities]]
name = "Magic Boost"
pos = "C2"
type = "Stat"
price = "100 LP"
path = ["E", "N", "S"]
[[abilities]]
name = "Sleepra"
pos = "C3"
type = "Magic"
price = "100 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Magic Haste"
pos = "C4"
type = "Stat"
price = "50 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Thunder Boost"
pos = "C5"
type = "Stat"
price = "30 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Thunder"
pos = "C6"
type = "Magic"
price = "10 LP"
path = ["W", "N", "S"]
[[abilities]]
name = "Start"
pos = "C7"
type = "Start"
price = ""
path = ["N"]
[[abilities]]
name = "Thunder Boost"
pos = "D2"
type = "Stat"
price = "100 LP"
route = 1
path = ["W", "E"]
[[abilities]]
name = "Magic Haste"
pos = "D3"
type = "Stat"
price = "100 LP"
path = ["W", "S"]
[[abilities]]
name = "Time Bomb"
pos = "D4"
type = "Magic"
price = "50 LP"
path = ["W", "N"]
[[abilities]]
name = "Sleep Block"
pos = "D5"
type = "Stat"
price = "30 LP"
path = ["W"]
[[abilities]]
name = "Magic Haste"
pos = "E2"
type = "Stat"
price = "150 LP"
route = 1
path = ["W"]

View File

@ -0,0 +1,222 @@
spirit = "Pricklemane"
order = 5
[[routes]]
id = 0
name = "Intellectual"
color = "blue"
[[routes.tips]]
to = "Volcano"
tip = "Feet"
[[routes.tips]]
to = "Bouncer"
tip = "Face"
[[routes.tips]]
to = "Scrapper"
tip = "Feet"
[[routes]]
id = 1
name = "Volcano"
color = "purple"
[[routes.tips]]
to = "Intellectual"
tip = "Face"
[[routes.tips]]
to = "Bouncer"
tip = "Face"
[[routes.tips]]
to = "Scrapper"
tip = "Tail"
[[routes]]
id = 2
name = "Scrapper"
color = "yellow"
[[routes.tips]]
to = "Bouncer"
tip = "Tail"
[[routes.tips]]
to = "Volcano"
tip = "Face"
[[routes.tips]]
to = "Intellectual"
tip = "Feet"
[[routes]]
id = 3
name = "Bouncer"
color = "green"
[[routes.tips]]
to = "Scrapper"
tip = "Face"
[[routes.tips]]
to = "Volcano"
tip = "Face"
[[routes.tips]]
to = "Intellectual"
tip = "Tail"
[[routes]]
id = 100
name = "Secret Route 1"
color = "secret1"
tips = []
[[abilities]]
name = "HP Boost"
pos = "A3"
type = "Stat"
price = "30 LP"
path = ["E"]
[[abilities]]
name = "Attack Boost"
pos = "A5"
type = "Stat"
price = "100 LP"
path = ["E"]
[[abilities]]
name = "HP Boost"
pos = "A6"
type = "Stat"
price = "50 LP"
route = 100
path = ["E"]
[[abilities]]
name = "Start"
pos = "B1"
type = "Start"
price = ""
path = ["S"]
[[abilities]]
name = "Strike Raid"
pos = "B2"
type = "Attack"
price = "10 LP"
path = ["N", "S"]
[[abilities]]
name = "Item Boost"
pos = "B3"
type = "Stat"
price = "30 LP"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Time Bomb"
pos = "B4"
type = "Magic"
price = "100 LP"
path = ["N", "S", "E"]
[[abilities]]
name = "Attack Haste"
pos = "B5"
type = "Stat"
price = "30 LP"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Secret"
pos = "B6"
type = "Secret"
price = "10 LP"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Poison Block"
pos = "B7"
type = "Stat"
price = "30 LP"
route = 100
path = ["N", "S"]
[[abilities]]
name = "Circle Raid"
pos = "B8"
type = "Attack"
price = "100 LP"
route = 100
path = ["N"]
[[abilities]]
name = "Stop Block"
pos = "C2"
type = "Stat"
price = "30 LP"
route = 0
path = ["S", "E"]
[[abilities]]
name = "Sleep Block"
pos = "C3"
type = "Stat"
price = "30 LP"
path = ["W", "E", "N"]
[[abilities]]
name = "Checkpoint"
pos = "C4"
type = "Checkpoint"
price = "Level 10"
path = ["W", "E"]
[[abilities]]
name = "Fire Screen"
pos = "C5"
type = "Stat"
price = "20 LP"
path = ["W"]
[[abilities]]
name = "Attack Haste"
pos = "C6"
type = "Stat"
price = "50 LP"
route = 100
path = ["W"]
[[abilities]]
name = "Attack Haste"
pos = "D2"
type = "Stat"
price = "100 LP"
route = 0
path = ["W"]
[[abilities]]
name = "Checkpoint"
pos = "D3"
type = "Checkpoint"
price = "Link x5"
path = ["W", "E"]
[[abilities]]
name = "Defense Boost"
pos = "D4"
type = "Stat"
price = "100 LP"
path = ["W"]
[[abilities]]
name = "Combo Plus"
pos = "E3"
type = "Support"
price = "200 LP"
path = ["W"]

View File

@ -0,0 +1,207 @@
spirit = "Sir Kyroo"
order = 7
[[routes]]
id = 0
name = "Warrior"
color = "purple"
[[routes.tips]]
to = "Paladin"
tip = "Face"
[[routes.tips]]
to = "Guardian"
tip = "Face"
[[routes.tips]]
to = "Knight"
tip = "Shield"
[[routes]]
id = 1
name = "Paladin"
color = "blue"
[[routes.tips]]
to = "Warrior"
tip = "Shield"
[[routes.tips]]
to = "Guardian"
tip = "Face"
[[routes.tips]]
to = "Knight"
tip = "Wings"
[[routes]]
id = 2
name = "Knight"
color = "yellow"
[[routes.tips]]
to = "Guardian"
tip = "Shield"
[[routes.tips]]
to = "Warrior"
tip = "Face"
[[routes.tips]]
to = "Paladin"
tip = "Shield"
[[routes]]
id = 3
name = "Guardian"
color = "green"
[[routes.tips]]
to = "Knight"
tip = "Shield"
[[routes.tips]]
to = "Paladin"
tip = "Body"
[[routes.tips]]
to = "Warrior"
tip = "Shield"
[[abilities]]
name = "Start"
pos = "A2"
type = "Start"
price = ""
path = ["E"]
[[abilities]]
name = "Water Screen"
pos = "A6"
type = "Stat"
price = "60 LP"
route = 0
path = ["E"]
[[abilities]]
name = "Strike Raid"
pos = "B2"
type = "Attack"
price = "10 LP"
path = ["W", "E", "S"]
[[abilities]]
name = "Cure Boost"
pos = "B3"
type = "Stat"
price = "50 LP"
path = ["N", "S"]
[[abilities]]
name = "Water Boost"
pos = "B4"
type = "Stat"
price = "50 LP"
path = ["N", "S"]
[[abilities]]
name = "Attack Haste"
pos = "B5"
type = "Stat"
price = "30 LP"
path = ["N", "S"]
[[abilities]]
name = "Water Screen"
pos = "B6"
type = "Stat"
price = "40 LP"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Checkpoint"
pos = "B7"
type = "Checkpoint"
price = "Level 20"
path = ["N", "S"]
[[abilities]]
name = "Blitz"
pos = "B8"
type = "Attack"
price = "100 LP"
path = ["N"]
[[abilities]]
name = "Water Boost"
pos = "C2"
type = "Stat"
price = "30 LP"
path = ["W", "E"]
[[abilities]]
name = "HP Boost"
pos = "C6"
type = "Stat"
price = "30 LP"
route = 0
path = ["W"]
[[abilities]]
name = "Attack Boost"
pos = "D2"
type = "Stat"
price = "100 LP"
path = ["W", "E", "S"]
[[abilities]]
name = "Stop Block"
pos = "D3"
type = "Stat"
price = "30 LP"
route = 1
path = ["N", "S"]
[[abilities]]
name = "Cure Boost"
pos = "D4"
type = "Stat"
price = "100 LP"
route = 1
path = ["N"]
[[abilities]]
name = "Magic Boost"
pos = "E1"
type = "Stat"
price = "100 LP"
path = ["S"]
[[abilities]]
name = "Water Screen"
pos = "E2"
type = "Stat"
price = "20 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Cure Boost"
pos = "E3"
type = "Stat"
price = "100 LP"
path = ["N"]
[[abilities]]
name = "Checkpoint"
pos = "F2"
type = "Checkpoint"
price = "Link x3"
path = ["W", "E"]
[[abilities]]
name = "Combo Plus"
pos = "G2"
type = "Support"
price = "200 LP"
path = ["W"]

View File

@ -0,0 +1,223 @@
spirit = "Tama Sheep"
order = 2
[[routes]]
id = 0
name = "Mumbler"
color = "blue"
[[routes.tips]]
to = "Picker-Upper"
tip = "Face"
[[routes.tips]]
to = "Snooze Maker"
tip = "Face"
[[routes.tips]]
to = "Pillow Fluffer"
tip = "Horn"
[[routes]]
id = 1
name = "Picker-Upper"
color = "purple"
[[routes.tips]]
to = "Mumbler"
tip = "Face"
[[routes.tips]]
to = "Pillow Fluffer"
tip = "Face"
[[routes.tips]]
to = "Snooze Maker"
tip = "Horn"
[[routes]]
id = 2
name = "Snooze Maker"
color = "yellow"
[[routes.tips]]
to = "Pillow Fluffer"
tip = "Feet"
[[routes.tips]]
to = "Picker-Upper"
tip = "Face"
[[routes.tips]]
to = "Mumbler"
tip = "Feet"
[[routes]]
id = 3
name = "Pillow Fluffer"
color = "green"
[[routes.tips]]
to = "Snooze Maker"
tip = "Face"
[[routes.tips]]
to = "Picker-Upper"
tip = "Face"
[[routes.tips]]
to = "Mumbler"
tip = "Feet"
[[routes]]
id = 100
name = "Secret Route 1"
color = "secret1"
tips = []
[[abilities]]
name = "Start"
pos = "A1"
type = "Start"
price = ""
path = ["S"]
[[abilities]]
name = "Sleep"
pos = "A2"
type = "Magic"
price = "10 LP"
path = ["N", "S", "E"]
[[abilities]]
name = "Magic Boost"
pos = "A3"
type = "Stat"
price = "100 LP"
path = ["N", "S"]
[[abilities]]
name = "Sleep Block"
pos = "A4"
type = "Stat"
price = "30 LP"
path = ["N", "E"]
[[abilities]]
name = "Magic Haste"
pos = "B2"
type = "Stat"
price = "30 LP"
path = ["E", "W"]
[[abilities]]
name = "Defense Boost"
pos = "B4"
type = "Stat"
price = "100 LP"
path = ["E", "W"]
[[abilities]]
name = "Water Screen"
pos = "C2"
type = "Stat"
price = "20 LP"
path = ["E", "W"]
[[abilities]]
name = "Slow Block"
pos = "C4"
type = "Stat"
price = "30 LP"
path = ["E", "W"]
[[abilities]]
name = "Secret"
pos = "D2"
type = "Secret"
price = "10 LP"
path = ["W", "S"]
[[abilities]]
name = "Balloon"
pos = "D3"
type = "Magic"
price = "50 LP"
route = 100
path = ["N", "E"]
[[abilities]]
name = "Checkpoint"
pos = "D4"
type = "Checkpoint"
price = "Link x1"
path = ["E", "W"]
[[abilities]]
name = "Stop Block"
pos = "E2"
type = "Stat"
price = "30 LP"
route = 100
path = ["S", "E"]
[[abilities]]
name = "HP Boost"
pos = "E3"
type = "Stat"
price = "30 LP"
route = 100
path = ["W", "N"]
[[abilities]]
name = "Sleepra"
pos = "E4"
type = "Magic"
price = "100 LP"
path = ["E", "W"]
[[abilities]]
name = "Magic Haste"
pos = "F2"
type = "Stat"
price = "50 LP"
route = 100
path = ["E", "W", "S"]
[[abilities]]
name = "Water Screen"
pos = "F3"
type = "Stat"
price = "40 LP"
route = 0
path = ["N", "E"]
[[abilities]]
name = "Checkpoint"
pos = "F4"
type = "Checkpoint"
price = "Link x2"
path = ["E", "W"]
[[abilities]]
name = "Magic Haste"
pos = "G2"
type = "Stat"
price = "100 LP"
route = 100
path = ["W"]
[[abilities]]
name = "Support Boost"
pos = "G3"
type = "Support"
price = "200 LP"
route = 0
path = ["W"]
[[abilities]]
name = "Sleepga"
pos = "G4"
type = "Magic"
price = "150 LP"
path = ["W"]

View File

@ -0,0 +1,207 @@
spirit = "Tatsu Steed"
order = 10
[[routes]]
id = 0
name = "Tactician"
color = "blue"
[[routes.tips]]
to = "Scatterbrain"
tip = "Face"
[[routes.tips]]
to = "Show-off"
tip = "Face"
[[routes.tips]]
to = "Trap Jockey"
tip = "Arms"
[[routes]]
id = 1
name = "Trap Jockey"
color = "green"
[[routes.tips]]
to = "Show-off"
tip = "Face"
[[routes.tips]]
to = "Scatterbrain"
tip = "Face"
[[routes.tips]]
to = "Tactician"
tip = "Tail"
[[routes]]
id = 2
name = "Scatterbrain"
color = "purple"
[[routes.tips]]
to = "Tactician"
tip = "Face"
[[routes.tips]]
to = "Trap Jockey"
tip = "Face"
[[routes.tips]]
to = "Show-off"
tip = "Tail"
[[routes]]
id = 3
name = "Show-off"
color = "yellow"
[[routes.tips]]
to = "Trap Jockey"
tip = "Face"
[[routes.tips]]
to = "Tactician"
tip = "Face"
[[routes.tips]]
to = "Scatterbrain"
tip = "Arms"
[[abilities]]
name = "Start"
pos = "A1"
type = "Start"
price = ""
path = ["S"]
[[abilities]]
name = "Bind"
pos = "A2"
type = "Magic"
price = "10 LP"
path = ["N", "S", "E"]
[[abilities]]
name = "Magic Boost"
pos = "A3"
type = "Stat"
price = "100 LP"
path = ["N", "S"]
[[abilities]]
name = "Mini"
pos = "A4"
type = "Magic"
price = "100 LP"
path = ["N", "E"]
[[abilities]]
name = "Magic Haste"
pos = "A6"
type = "Stat"
price = "100 LP"
route = 0
path = ["E"]
[[abilities]]
name = "Checkpoint"
pos = "B2"
type = "Checkpoint"
price = "Link x1"
path = ["W", "E"]
[[abilities]]
name = "Blizzard Boost"
pos = "B4"
type = "Stat"
price = "30 LP"
path = ["W", "E"]
[[abilities]]
name = "Confusion Block"
pos = "B5"
type = "Stat"
price = "30 LP"
path = ["E", "S"]
[[abilities]]
name = "Blizzard Screen"
pos = "B6"
type = "Stat"
price = "60 LP"
route = 0
path = ["N", "W"]
[[abilities]]
name = "Blizzard Screen"
pos = "C2"
type = "Stat"
price = "20 LP"
path = ["W", "E"]
[[abilities]]
name = "Magic Haste"
pos = "C4"
type = "Stat"
price = "30 LP"
path = ["W", "S"]
[[abilities]]
name = "Magic Boost"
pos = "C5"
type = "Stat"
price = "200 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Blizzard Screen"
pos = "C6"
type = "Stat"
price = "40 LP"
path = ["N", "S"]
[[abilities]]
name = "Checkpoint"
pos = "C7"
type = "Checkpoint"
price = "Level 25"
path = ["N", "S"]
[[abilities]]
name = "Blizzaga"
pos = "C8"
type = "Magic"
price = "150 LP"
path = ["N"]
[[abilities]]
name = "Blizzara"
pos = "D2"
type = "Magic"
price = "100 LP"
path = ["W"]
[[abilities]]
name = "Bind Block"
pos = "D5"
type = "Stat"
price = "30 LP"
path = ["W", "S"]
[[abilities]]
name = "Magic Haste"
pos = "D6"
type = "Stat"
price = "50 LP"
route = 1
path = ["N", "E"]
[[abilities]]
name = "Blizzard Boost"
pos = "E6"
type = "Stat"
price = "50 LP"
route = 1
path = ["W"]

View File

@ -0,0 +1,207 @@
spirit = "Toximander"
order = 8
[[routes]]
id = 0
name = "Hunter"
color = "purple"
[[routes.tips]]
to = "Basilisk"
tip = "Tail"
[[routes.tips]]
to = "Loose Cannon"
tip = "Face"
[[routes.tips]]
to = "Bane"
tip = "Tail"
[[routes]]
id = 1
name = "Basilisk"
color = "blue"
[[routes.tips]]
to = "Hunter"
tip = "Body"
[[routes.tips]]
to = "Bane"
tip = "Face"
[[routes.tips]]
to = "Loose Cannon"
tip = "Body"
[[routes]]
id = 2
name = "Loose Cannon"
color = "yellow"
[[routes.tips]]
to = "Bane"
tip = "Legs"
[[routes.tips]]
to = "Hunter"
tip = "Face"
[[routes.tips]]
to = "Basilisk"
tip = "Body"
[[routes]]
id = 3
name = "Bane"
color = "green"
[[routes.tips]]
to = "Loose Cannon"
tip = "Body"
[[routes.tips]]
to = "Basilisk"
tip = "Face"
[[routes.tips]]
to = "Hunter"
tip = "Body"
[[abilities]]
name = "Start"
pos = "A3"
type = "Start"
price = ""
path = ["E"]
[[abilities]]
name = "Bind Block"
pos = "B2"
type = "Stat"
price = "30 LP"
path = ["S"]
[[abilities]]
name = "Poison"
pos = "B3"
type = "Magic"
price = "10 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Confusion Block"
pos = "B4"
type = "Stat"
price = "30 LP"
path = ["N"]
[[abilities]]
name = "Treasure Magnet"
pos = "C1"
type = "Support"
price = "50 LP"
path = ["S"]
[[abilities]]
name = "Checkpoint"
pos = "C2"
type = "Checkpoint"
price = "Link x2"
path = ["N", "S"]
[[abilities]]
name = "Blindness Block"
pos = "C3"
type = "Stat"
price = "30 LP"
path = ["W", "E", "N", "S"]
[[abilities]]
name = "Attack Haste"
pos = "C4"
type = "Stat"
price = "30 LP"
route = 0
path = ["N", "S"]
[[abilities]]
name = "Attack Boost"
pos = "C5"
type = "Stat"
price = "100 LP"
route = 0
path = ["N"]
[[abilities]]
name = "HP Boost"
pos = "D2"
type = "Stat"
price = "30 LP"
path = ["S", "E"]
[[abilities]]
name = "Poison Block"
pos = "D3"
type = "Stat"
price = "30 LP"
path = ["W", "N", "S"]
[[abilities]]
name = "Dark Screen"
pos = "D4"
type = "Stat"
price = "20 LP"
path = ["N", "E"]
[[abilities]]
name = "Dark Screen"
pos = "E2"
type = "Stat"
price = "40 LP"
path = ["W", "E"]
[[abilities]]
name = "Gravity Strike"
pos = "E4"
type = "Attack"
price = "100 LP"
path = ["W", "E"]
[[abilities]]
name = "Checkpoint"
pos = "F2"
type = "Checkpoint"
price = "Level 15"
path = ["W", "E"]
[[abilities]]
name = "Mini Block"
pos = "F4"
type = "Stat"
price = "30 LP"
path = ["W", "E"]
[[abilities]]
name = "Poison Dive"
pos = "G2"
type = "Attack"
price = "200 LP"
path = ["W"]
[[abilities]]
name = "Magic Haste"
pos = "G4"
type = "Stat"
price = "30 LP"
route = 1
path = ["W", "E"]
[[abilities]]
name = "HP Boost"
pos = "H4"
type = "Stat"
price = "50 LP"
route = 1
path = ["W"]

View File

@ -0,0 +1,214 @@
spirit = "Yoggy Ram"
order = 3
[[routes]]
id = 0
name = "Trailblazer"
color = "yellow"
[[routes.tips]]
to = "Jumper"
tip = "Face"
[[routes.tips]]
to = "Leader"
tip = "Face"
[[routes.tips]]
to = "Powerhouse"
tip = "Chest"
[[routes]]
id = 1
name = "Powerhouse"
color = "purple"
[[routes.tips]]
to = "Leader"
tip = "Chest"
[[routes.tips]]
to = "Trailblazer"
tip = "Face"
[[routes.tips]]
to = "Jumper"
tip = "Chest"
[[routes]]
id = 2
name = "Leader"
color = "blue"
[[routes.tips]]
to = "Powerhouse"
tip = "Hind Legs"
[[routes.tips]]
to = "Jumper"
tip = "Face"
[[routes.tips]]
to = "Trailblazer"
tip = "Hind Legs"
[[routes]]
id = 3
name = "Jumper"
color = "green"
[[routes.tips]]
to = "Trailblazer"
tip = "Face"
[[routes.tips]]
to = "Powerhouse"
tip = "Face"
[[routes.tips]]
to = "Leader"
tip = "Tail"
[[abilities]]
name = "Fire Screen"
pos = "A3"
type = "Stat"
price = "80 LP"
route = 0
path = ["E", "S"]
[[abilities]]
name = "Defense Boost"
pos = "A4"
type = "Stat"
price = "200 LP"
route = 0
path = ["N"]
[[abilities]]
name = "Start"
pos = "B2"
type = "Start"
price = ""
path = ["S", "E"]
[[abilities]]
name = "Esuna"
pos = "B3"
type = "Magic"
price = "10 LP"
path = ["N", "S", "E", "W"]
[[abilities]]
name = "Fire Screen"
pos = "B4"
type = "Stat"
price = "20 LP"
path = ["N", "S"]
[[abilities]]
name = "Bind Block"
pos = "B5"
type = "Stat"
price = "30 LP"
path = ["N", "S"]
[[abilities]]
name = "Fire Screen"
pos = "B6"
type = "Stat"
price = "40 LP"
path = ["N", "S"]
[[abilities]]
name = "Fire Screen"
pos = "B7"
type = "Stat"
price = "60 LP"
path = ["N", "S"]
[[abilities]]
name = "Defense Boost"
pos = "B8"
type = "Stat"
price = "100 LP"
path = ["N"]
[[abilities]]
name = "HP Boost"
pos = "C1"
type = "Stat"
price = "30 LP"
route = 1
path = ["S", "E"]
[[abilities]]
name = "Fire"
pos = "C2"
type = "Magic"
price = "10 LP"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Checkpoint"
pos = "C3"
type = "Checkpoint"
price = "Link x4"
path = ["N", "S", "W", "E"]
[[abilities]]
name = "Treasure Magnet"
pos = "C4"
type = "Support"
price = "50 LP"
path = ["N"]
[[abilities]]
name = "Fire Screen"
pos = "D1"
type = "Stat"
price = "100 LP"
route = 1
path = ["W"]
[[abilities]]
name = "Fire Boost"
pos = "D2"
type = "Stat"
price = "30 LP"
path = ["W", "E"]
[[abilities]]
name = "Fire Windmill"
pos = "D3"
type = "Attack"
price = "150 LP"
path = ["W"]
[[abilities]]
name = "Checkpoint"
pos = "E2"
type = "Checkpoint"
price = "Level 10"
path = ["W", "E"]
[[abilities]]
name = "Fira"
pos = "F2"
type = "Magic"
price = "100 LP"
path = ["W", "E"]
[[abilities]]
name = "Checkpoint"
pos = "G2"
type = "Checkpoint"
price = "Level 20"
path = ["W", "E"]
[[abilities]]
name = "Firaga"
pos = "H2"
type = "Magic"
price = "150 LP"
path = ["W"]

164
src/bbs.rs 100644
View File

@ -0,0 +1,164 @@
use std::collections::HashMap;
use askama::Template;
use itertools::Itertools;
use serde::Deserialize;
#[derive(Debug, Deserialize, PartialEq, Eq)]
enum Character {
#[serde(alias = "A")]
Aqua,
#[serde(alias = "V")]
Ventus,
#[serde(alias = "T")]
Terra,
}
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord)]
struct Ability {
name: String,
from: String,
category: String,
max: u8,
types: Vec<char>,
}
#[derive(Debug, Deserialize)]
struct Command {
name: String,
category: String,
char: Vec<char>,
#[serde(default)]
starting: Option<bool>,
#[serde(default)]
info: Option<String>,
#[serde(default)]
recipes: Vec<CommandRecipe>,
}
impl Command {}
#[derive(Debug, Deserialize)]
struct CommandRecipe {
char: Vec<Character>,
r#type: char,
ingredients: (String, String),
chance: u8,
#[serde(skip_deserializing)]
abilities: Vec<(String, Ability)>,
}
impl CommandRecipe {
pub fn get_ability(&self, crystal: &str) -> Option<Ability> {
if self.r#type == '-' {
return None;
}
for ability in self.abilities.iter() {
if ability.0 == crystal {
return Some(ability.1.clone());
}
}
// This should never happen unless the json files are wrong
panic!(
"No ability found for {} + {} and {}",
self.ingredients.0, self.ingredients.1, crystal
);
}
pub fn can_unlock(&self, char: Character) -> bool {
self.char.contains(&char)
}
pub fn get_unlock_chars(&self) -> String {
let mut id = String::new();
if self.can_unlock(Character::Terra) {
id += "T"
}
if self.can_unlock(Character::Ventus) {
if !id.is_empty() {
id += " ";
}
id += "V";
}
if self.can_unlock(Character::Aqua) {
if !id.is_empty() {
id += " ";
}
id += "A";
}
id
}
pub fn set_abilities(&mut self, abilities: &[Ability]) {
let mut vec: Vec<(String, Ability)> = vec![];
for ability in abilities.iter() {
if ability.types.contains(&self.r#type) {
vec.push((ability.from.clone(), ability.clone()));
}
}
vec.sort();
self.abilities = vec;
}
}
#[derive(Debug, Deserialize)]
struct Finisher {
name: String,
char: Vec<Character>,
level: u8,
#[serde(default)]
follows: Vec<String>,
goal: String,
color: String,
}
#[derive(Template)]
#[template(path = "pages/bbs-commands.html", whitespace = "suppress")]
struct CommandsTemplate {
pub commands: Vec<Command>,
pub crystals: Vec<String>,
}
const ABILITIES_PATH: &str = "./input/bbs/abilities.json";
const FINISHERS_PATH: &str = "./input/bbs/finish-commands.json";
const COMMANDS_PATH: &str = "./input/bbs/commands.json";
pub fn init() {
tracing::info!("Loading abilities json data from {}", ABILITIES_PATH);
let abilities_str = std::fs::read_to_string(ABILITIES_PATH).unwrap();
let abilities = serde_json::from_str::<Vec<Ability>>(&abilities_str).unwrap();
tracing::info!("Loading finishers json data from {}", ABILITIES_PATH);
let finishers_str = std::fs::read_to_string(FINISHERS_PATH).unwrap();
let finishers = serde_json::from_str::<HashMap<String, Finisher>>(&finishers_str).unwrap();
tracing::info!("Loading commands json data from {}", ABILITIES_PATH);
let commands_str = std::fs::read_to_string(COMMANDS_PATH).unwrap();
let mut commands = serde_json::from_str::<Vec<Command>>(&commands_str).unwrap();
// Create a vec with all the crystal variants found in abilities
let crystals = abilities
.iter()
.map(|x| x.from.clone())
.unique()
.sorted()
.collect();
// Create a vec of crystals and what ability they give for each recipe
for cmd in commands.iter_mut() {
for recipe in cmd.recipes.iter_mut() {
recipe.set_abilities(&abilities);
}
}
tracing::info!("Generating the BBS commands table template");
let template = CommandsTemplate { commands, crystals };
std::fs::write("./out/bbs-commands.html", template.render().unwrap()).unwrap();
}

364
src/ddd.rs 100644
View File

@ -0,0 +1,364 @@
use std::{fmt::Display, panic, path::PathBuf};
use askama::Template;
use itertools::Itertools;
use serde::{Deserialize, Deserializer};
#[derive(Debug, Deserialize, PartialEq, Eq)]
struct Board {
order: u32,
spirit: String,
routes: Vec<Route>,
abilities: Vec<Ability>,
#[serde(skip_deserializing)]
total_lp: u32,
#[serde(skip_deserializing)]
max_level: u32,
#[serde(skip_deserializing)]
stats: Vec<(usize, String)>,
}
impl Board {
pub fn init_routes(&mut self) {
self.routes.iter_mut().for_each(|r| {
r.interaction = match r.color {
Color::Blue => Interaction::Poke,
Color::Purple => Interaction::Poke,
Color::Yellow => Interaction::Rub,
Color::Green => Interaction::Rub,
_ => Interaction::None,
}
});
let routes = self
.routes
.clone()
.into_iter()
.filter(|r| r.id < 100)
.collect_vec();
self.routes.iter_mut().filter(|r| r.id < 100).for_each(|r| {
r.tips.iter_mut().for_each(|t| {
let route = routes.iter().find(|r| r.name == t.to);
if let Some(route) = route {
t.to_color = route.color.clone();
t.tip = format!("{} {}", route.interaction, t.tip);
}
});
});
}
pub fn init_stats(&mut self) {
let v = self
.abilities
.iter()
.filter(|&ability| ability.r#type == AbilityType::Stat)
.sorted_by(|a, b| Ord::cmp(&a.name, &b.name))
.collect_vec();
let mut stats: Vec<(usize, String)> = vec![];
for (key, chunk) in &v.into_iter().chunk_by(|k| k.name.clone()) {
let grouped = chunk.collect_vec();
stats.push((grouped.len(), key));
}
self.stats = stats;
}
pub fn init_total_lp(&mut self) {
self.total_lp = self
.abilities
.iter()
.filter(|&ability| ability.price.contains("LP"))
.map(|ability| {
let mut split = ability.price.split_whitespace();
split.next().unwrap_or("0").parse::<u32>().unwrap_or(0)
})
.sum::<u32>();
}
pub fn init_max_level(&mut self) {
self.max_level = self
.abilities
.iter()
.filter(|&ability| ability.price.starts_with("Level"))
.map(|ability| {
let mut split = ability.price.split_whitespace();
split.nth(1).unwrap_or("0").parse::<u32>().unwrap_or(0)
})
.sorted()
.last()
.unwrap_or(0);
}
pub fn get_size(&self) -> BoardPosition {
let mut x = 1;
let mut y = 1;
for ability in &self.abilities {
if ability.pos.0 > x {
x = ability.pos.0;
}
if ability.pos.1 > y {
y = ability.pos.1;
}
}
(x, y)
}
pub fn get_ability_at(&self, x: &u32, y: &u32) -> Option<&Ability> {
self.abilities
.iter()
.find(|&ability| ability.pos == (*x, *y))
}
pub fn get_char(&self, i: &u32) -> char {
char::from_u32(64 + *i).unwrap_or('0')
}
pub fn get_dispositions(&self) -> Vec<&Route> {
self.routes.iter().filter(|r| r.id < 100).collect_vec()
}
pub fn get_supports(&self) -> Vec<&Ability> {
self.abilities
.iter()
.filter(|&ability| ability.r#type == AbilityType::Support)
.collect_vec()
}
pub fn get_commands(&self) -> Vec<&Ability> {
self.abilities
.iter()
.filter(|&ability| {
ability.r#type == AbilityType::Magic
|| ability.r#type == AbilityType::Attack
|| ability.r#type == AbilityType::Reprisal
|| ability.r#type == AbilityType::Defense
})
.collect_vec()
}
pub fn get_spirits(&self) -> Vec<&Ability> {
self.abilities
.iter()
.filter(|&ability| ability.r#type == AbilityType::Spirit)
.collect_vec()
}
}
#[derive(Debug, Deserialize, PartialEq, Eq, Clone)]
struct Route {
id: u32,
name: String,
color: Color,
tips: Vec<Tip>,
#[serde(skip_deserializing)]
interaction: Interaction,
}
#[derive(Debug, Deserialize, PartialEq, Eq, Clone)]
enum Color {
#[serde(alias = "blue")]
Blue,
#[serde(alias = "purple")]
Purple,
#[serde(alias = "yellow")]
Yellow,
#[serde(alias = "green")]
Green,
#[serde(alias = "secret1")]
SecretGreen,
#[serde(alias = "secret2")]
SecretRed,
}
impl Display for Color {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Color::Blue => f.write_str("blue"),
Color::Purple => f.write_str("purple"),
Color::Yellow => f.write_str("yellow"),
Color::Green => f.write_str("green"),
Color::SecretGreen => f.write_str("secret1"),
Color::SecretRed => f.write_str("secret2"),
}
}
}
#[derive(Debug, Deserialize, PartialEq, Eq, Clone)]
struct Tip {
to: String,
#[serde(skip_deserializing, default = "default_disposition_color")]
to_color: Color,
tip: String,
}
fn default_disposition_color() -> Color {
Color::Blue
}
#[derive(Debug, Deserialize, PartialEq, Eq)]
enum AbilityType {
Start,
Checkpoint,
Secret,
Stat,
Spirit,
Support,
Attack,
Magic,
Reprisal,
Defense,
}
type BoardPosition = (u32, u32);
#[derive(Debug, Deserialize, PartialEq, Eq)]
struct ParseBoardPositionError;
fn deserialize_position<'de, D>(deserializer: D) -> Result<BoardPosition, D::Error>
where
D: Deserializer<'de>,
{
let str = match String::deserialize(deserializer) {
Ok(v) => v,
Err(e) => {
panic!("Tried deserializing a non-string type\nerror: {}", e);
}
};
let str = str.to_uppercase();
let mut chars = str.chars();
let a = chars.next().unwrap_or('A');
let b = chars.next().unwrap_or('1');
let a = (a.to_ascii_uppercase() as u32).saturating_sub(64);
if a == 0 {
panic!("Second position parameter {} is 0 or lower!", str);
}
let b = b.to_digit(10).unwrap_or(0);
Ok((a, b))
}
#[derive(Debug, Deserialize, PartialEq, Eq)]
struct Ability {
name: String,
#[serde(deserialize_with = "deserialize_position")]
pos: BoardPosition,
r#type: AbilityType,
price: String,
route: Option<u32>,
path: Vec<Direction>,
}
impl Ability {
pub fn get_slot_details(&self, board: &Board) -> String {
let mut details = String::new();
if let Some(route) = self.route {
for broute in &board.routes {
if broute.id == route {
details += &format!("{} ", broute.color);
break;
}
}
}
for path in &self.path {
match path {
Direction::North => details += "north ",
Direction::South => details += "south ",
Direction::East => details += "east ",
Direction::West => details += "west ",
}
}
if self.r#type == AbilityType::Start {
details += "start ";
}
details
}
}
#[derive(Debug, Deserialize, PartialEq, Eq)]
enum Direction {
#[serde(alias = "N")]
North,
#[serde(alias = "S")]
South,
#[serde(alias = "E")]
East,
#[serde(alias = "W")]
West,
}
#[derive(Debug, Default, Deserialize, PartialEq, Eq, Clone)]
enum Interaction {
#[default]
None,
Poke,
Rub,
}
impl Display for Interaction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Interaction::Poke => f.write_str("Poke"),
Interaction::Rub => f.write_str("Rub"),
_ => f.write_str(""),
}
}
}
#[derive(Template)]
#[template(path = "pages/ddd-abilities.html", whitespace = "suppress")]
struct AbilitiesTemplate {
pub boards: Vec<Board>,
}
const ABILITIES_PATH: &str = "./input/ddd/abilities";
pub fn init() {
tracing::info!("Loading ability links json data from {}", ABILITIES_PATH);
let mut boards: Vec<Board> = vec![];
// Loading multiple files into one vector due to the size of each board
let paths = std::fs::read_dir(ABILITIES_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 board_str = std::fs::read_to_string(path).unwrap();
let mut board = toml::from_str::<Board>(&board_str).unwrap();
board.init_routes();
board.init_total_lp();
board.init_max_level();
board.init_stats();
// dbg!(&board);
boards.push(board);
}
boards.sort_by(|a, b| a.order.cmp(&b.order));
tracing::info!("Generating the DDD ability boards template");
let template = AbilitiesTemplate { boards };
std::fs::write("./out/ddd-abilities.html", template.render().unwrap()).unwrap();
}

View File

@ -1,136 +1,10 @@
#![allow(dead_code)]
use std::collections::HashMap;
use askama::Template;
use itertools::Itertools;
use serde::Deserialize;
use tracing_subscriber::EnvFilter;
#[derive(Debug, Deserialize, PartialEq, Eq)]
enum Character {
#[serde(alias = "A")]
Aqua,
#[serde(alias = "V")]
Ventus,
#[serde(alias = "T")]
Terra,
}
mod bbs;
mod ddd;
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord)]
struct Ability {
name: String,
from: String,
category: String,
max: u8,
types: Vec<char>,
}
#[derive(Debug, Deserialize)]
struct Command {
name: String,
category: String,
char: Vec<char>,
#[serde(default)]
starting: Option<bool>,
#[serde(default)]
info: Option<String>,
#[serde(default)]
recipes: Vec<CommandRecipe>,
}
impl Command {}
#[derive(Debug, Deserialize)]
struct CommandRecipe {
char: Vec<Character>,
r#type: char,
ingredients: (String, String),
chance: u8,
#[serde(skip_deserializing)]
abilities: Vec<(String, Ability)>,
}
impl CommandRecipe {
pub fn get_ability(&self, crystal: &str) -> Option<Ability> {
if self.r#type == '-' {
return None;
}
for ability in self.abilities.iter() {
if ability.0 == crystal {
return Some(ability.1.clone());
}
}
// This should never happen unless the json files are wrong
panic!(
"No ability found for {} + {} and {}",
self.ingredients.0, self.ingredients.1, crystal
);
}
pub fn can_unlock(&self, char: Character) -> bool {
self.char.contains(&char)
}
pub fn get_unlock_chars(&self) -> String {
let mut id = String::new();
if self.can_unlock(Character::Terra) {
id += "T"
}
if self.can_unlock(Character::Ventus) {
if !id.is_empty() {
id += " ";
}
id += "V";
}
if self.can_unlock(Character::Aqua) {
if !id.is_empty() {
id += " ";
}
id += "A";
}
id
}
pub fn set_abilities(&mut self, abilities: &[Ability]) {
let mut vec: Vec<(String, Ability)> = vec![];
for ability in abilities.iter() {
if ability.types.contains(&self.r#type) {
vec.push((ability.from.clone(), ability.clone()));
}
}
vec.sort();
self.abilities = vec;
}
}
#[derive(Debug, Deserialize)]
struct Finisher {
name: String,
char: Vec<Character>,
level: u8,
#[serde(default)]
follows: Vec<String>,
goal: String,
color: String,
}
#[derive(Template)]
#[template(path = "pages/commands.html", whitespace = "suppress")]
struct CommandsTemplate {
pub commands: Vec<Command>,
pub crystals: Vec<String>,
}
const ABILITIES_PATH: &str = "./input/abilities.json";
const FINISHERS_PATH: &str = "./input/finish-commands.json";
const COMMANDS_PATH: &str = "./input/commands.json";
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
fn main() {
@ -140,35 +14,6 @@ fn main() {
.event_format(tracing_subscriber::fmt::format().with_source_location(true))
.init();
tracing::info!("Loading abilities json data from {}", ABILITIES_PATH);
let abilities_str = std::fs::read_to_string(ABILITIES_PATH).unwrap();
let abilities = serde_json::from_str::<Vec<Ability>>(&abilities_str).unwrap();
tracing::info!("Loading finishers json data from {}", ABILITIES_PATH);
let finishers_str = std::fs::read_to_string(FINISHERS_PATH).unwrap();
let finishers = serde_json::from_str::<HashMap<String, Finisher>>(&finishers_str).unwrap();
tracing::info!("Loading commands json data from {}", ABILITIES_PATH);
let commands_str = std::fs::read_to_string(COMMANDS_PATH).unwrap();
let mut commands = serde_json::from_str::<Vec<Command>>(&commands_str).unwrap();
// Create a vec with all the crystal variants found in abilities
let crystals = abilities
.iter()
.map(|x| x.from.clone())
.unique()
.sorted()
.collect();
// Create a vec of crystals and what ability they give for each recipe
for cmd in commands.iter_mut() {
for recipe in cmd.recipes.iter_mut() {
recipe.set_abilities(&abilities);
}
}
tracing::info!("Generating the commands table template");
let template = CommandsTemplate { commands, crystals };
std::fs::write("./index.html", template.render().unwrap()).unwrap();
bbs::init();
ddd::init();
}

View File

@ -0,0 +1,48 @@
<div class="abilities">
<div>
<h2>Stats</h2>
<ul>
{% for val in board.stats %}
{% if val.0 > 1 %}
<li>x{{+ val.0 +}} {{+ val.1 +}}</li>
{% else %}
<li>{{+ val.1 +}}</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% let supports = board.get_supports() %}
{% if supports.len() > 0 %}
<div>
<h2>Support</h2>
<ul>
{% for ability in supports %}
<li>{{ ability.name }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% let spirits = board.get_spirits() %}
{% if spirits.len() > 0 %}
<div>
<h2>Spirit</h2>
<ul>
{% for ability in spirits %}
<li>{{ ability.name }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% let commands = board.get_commands() %}
{% if commands.len() > 0 %}
<div>
<h2>Commands</h2>
<ul>
{% for ability in commands %}
<li>{{ ability.name }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>

View File

@ -0,0 +1,23 @@
<tr>
<td class="slot-h">{{ y }}</td>
{% for x in 1..board.get_size().0 + 1 %}
{% let ability = board.get_ability_at(x, y) %}
{% match ability %}
{% when Some with (val) %}
<td colspan="1" class="{{ val.get_slot_details(board) }}">
<div class="slot">
<span>{{ val.name }}</span>
{% match val.type %}
{% when AbilityType::Checkpoint %}
<br />
<span>{{ val.price }}</span>
{% when _ %}
{% endmatch %}
</div>
<div class="path"></div>
</td>
{% when None %}
<td colspan="1"></td>
{% endmatch %}
{% endfor %}
</tr>

View File

@ -0,0 +1,20 @@
<h2>Board</h2>
<ul>
<li>Total LP Needed: {{+ board.total_lp +}}</li>
<li>Max Level Needed: {{+ board.max_level +}}</li>
</ul>
<table class="board">
<tbody>
<tr>
<td class="slot-w slot-h"></td>
{% for x in 1..board.get_size().0 + 1 %}
<td class="slot-w">{{ board.get_char(x) }}</td>
{% endfor %}
</tr>
{% for y in 1..board.get_size().1 + 1 %}
{% include "components/ddd/board-row.html" %}
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,18 @@
<h2>Dispositions</h2>
{% for route in board.get_dispositions() %}
<div class="route">
<div>
<div class="disposition {{+ route.color +}}"></div>
<span>{{ route.name }}</span>
</div>
<ul>
{% for tip in route.tips %}
<li>
<div class="disposition {{+ tip.to_color +}}"></div>
{{+ tip.to +}} ➔ {{+ tip.tip +}}
</li>
{% endfor %}
</ul>
</div>
{% endfor %}

View File

@ -35,35 +35,10 @@
thead th {
background-color: #252525;
}
}
tbody tr:hover {
background-color: #4f4f4f;
}
& tr,
th,
td {
border: 1px solid #fff;
padding: 7px;
}
.charlist {
display: inline-grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
.aqua {
color: #97c8ff;
}
.ventus {
color: #26ff62;
}
.terra {
color: #ff7400;
}
}
ul {
line-height: 1.5;
}
</style>

View File

@ -3,6 +3,38 @@
{% block title %}Commands{% endblock %}
{% block head %}
<style>
table {
.charlist {
display: inline-grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
.aqua {
color: #97c8ff;
}
.ventus {
color: #26ff62;
}
.terra {
color: #ff7400;
}
}
tbody tr:hover {
background-color: #4f4f4f;
}
& tr,
th,
td {
border: 1px solid #fff;
padding: 7px;
}
}
</style>
<script>
let charFilter = "";
let typeFilter = "";
@ -141,11 +173,11 @@
{% endblock %}
{% block content %}
{% include "components/search.html" %}
{% include "components/bbs/search.html" %}
<br />
{% include "components/type-filters.html" %}
{% include "components/bbs/type-filters.html" %}
<br />
{% include "components/char-filters.html" %}
{% include "components/bbs/char-filters.html" %}
<table>
<thead>

View File

@ -0,0 +1,203 @@
{% extends "layouts/base.html" %}
{% block title %}Abilities{% endblock %}
{% block head %}
<style>
.blue {
background-color: #35a0a8;
}
.purple {
background-color: #992a9b;
}
.green {
background-color: #7ecf50;
}
.yellow {
background-color: #d3c949;
}
.secret1 {
background-color: #497331;
}
.secret2 {
background-color: #881a22;
}
div.abilities {
display: flex;
& div {
margin-right: 60px;
}
}
div.route {
display: flex;
align-items: center;
& div {
display: flex;
align-items: center;
}
& .disposition {
width: 32px;
height: 32px;
margin-right: 5px;
display: inline-block;
vertical-align: middle;
}
& span {
font-size: 18px;
}
& ul {
list-style: disclosure-closed;
line-height: 2.5;
& li {
display: list-item;
}
}
}
table.board {
width: inherit;
td {
width: 120px;
height: 100px;
position: relative;
overflow: hidden;
& span {
position: inherit;
z-index: 10;
color: black;
}
& .slot {
width: 70%;
height: 70%;
position: relative;
left: 15px;
background-color: #cbf;
z-index: 10;
align-content: center;
font-size: 14px;
box-shadow: 1px 1px 5px black;
}
&.slot-w {
height: 20px;
}
&.slot-h {
width: 20px;
}
&.start .slot {
background-color: #dcbf7e;
}
&.north.east.south.west .path::after {
content: "┼";
}
&.east.south.west .path::after {
content: "┬";
}
&.east.north.west .path::after {
content: "┴";
}
&.north.south.west .path::after {
content: "┤";
}
&.north.south.east .path::after {
content: "├";
}
&.south.east .path::after {
content: "┌";
}
&.south.west .path::after {
content: "┐";
}
&.north.west .path::after {
content: "┘";
}
&.north.east .path::after {
content: "└";
}
&.east.west .path::after {
content: "─";
}
&.north.south .path::after {
content: "│";
}
&.west .path::after {
content: "╴";
}
&.east .path::after {
content: "╶";
}
&.south .path::after {
content: "╷";
}
&.north .path::after {
content: "╵";
}
}
}
.path {
position: absolute;
top: -70px;
left: 0;
font-size: 200px;
width: 100%;
height: 100%;
z-index: 0;
/*color: #3c3c3c;*/
color: #ccbbff;
}
</style>
<script>
function debounce(callback, wait = 300) {
let timeoutId = null;
return (...args) => {
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => {
callback(...args);
}, wait);
};
}
</script>
{% endblock %}
{% block content %}
{% for board in boards %}
<h1>{{+ board.spirit +}}</h1>
{% include "components/ddd/abilities.html" %}
{% include "components/ddd/dispositions.html" %}
{% include "components/ddd/board.html" %}
{% endfor %}
{% endblock %}