Some initial work on the layout for DDD's ability link boards
parent
0968bfc157
commit
b03e80e279
|
@ -0,0 +1,335 @@
|
|||
[
|
||||
{
|
||||
"spirit": "Meow Wow",
|
||||
"routes": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Stray",
|
||||
"color": "#17CBD8"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Smart Cookie",
|
||||
"color": "#992A9B"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "Start",
|
||||
"pos": "A2",
|
||||
"type": "Start",
|
||||
"price": "",
|
||||
"path": ["E"]
|
||||
},
|
||||
{
|
||||
"name": "Link Critical",
|
||||
"pos": "B2",
|
||||
"type": "Spirit",
|
||||
"price": "10 LP",
|
||||
"path": ["W", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Magic Haste",
|
||||
"pos": "C1",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"path": ["S", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Cure",
|
||||
"pos": "C2",
|
||||
"type": "Magic",
|
||||
"price": "50 LP",
|
||||
"path": ["N", "W", "E", "S"]
|
||||
},
|
||||
{
|
||||
"name": "Item Boost",
|
||||
"pos": "C3",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"path": ["E", "N"]
|
||||
},
|
||||
{
|
||||
"name": "Light Screen",
|
||||
"pos": "D1",
|
||||
"type": "Stat",
|
||||
"price": "20 LP",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Checkpoint",
|
||||
"pos": "D2",
|
||||
"type": "Checkpoint",
|
||||
"price": "Level 10",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Slow",
|
||||
"pos": "D3",
|
||||
"type": "Magic",
|
||||
"price": "50 LP",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Defense Boost",
|
||||
"pos": "E1",
|
||||
"type": "Stat",
|
||||
"price": "100 LP",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Cura",
|
||||
"pos": "E2",
|
||||
"type": "Magic",
|
||||
"price": "100 LP",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Poison Block",
|
||||
"pos": "E3",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"path": ["E", "S", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Spark",
|
||||
"pos": "E4",
|
||||
"type": "Magic",
|
||||
"price": "50 LP",
|
||||
"path": ["N"]
|
||||
},
|
||||
{
|
||||
"name": "Confusion Block",
|
||||
"pos": "F1",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"route": 0,
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Leaf Bracer",
|
||||
"pos": "F2",
|
||||
"type": "Support",
|
||||
"price": "300 LP",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Attack Haste",
|
||||
"pos": "F3",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"route": 1,
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "HP Boost",
|
||||
"pos": "G1",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"route": 0,
|
||||
"path": ["W"]
|
||||
},
|
||||
{
|
||||
"name": "Checkpoint",
|
||||
"pos": "G2",
|
||||
"type": "Checkpoint",
|
||||
"price": "Level 25",
|
||||
"path": ["E", "W"]
|
||||
},
|
||||
{
|
||||
"name": "Magic Boost",
|
||||
"pos": "G3",
|
||||
"type": "Stat",
|
||||
"price": "100 LP",
|
||||
"route": 1,
|
||||
"path": ["W"]
|
||||
},
|
||||
{
|
||||
"name": "Curaga",
|
||||
"pos": "H2",
|
||||
"type": "Magic",
|
||||
"price": "150 LP",
|
||||
"path": ["W"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"spirit": "Komory Bat",
|
||||
"routes": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Rescuer",
|
||||
"color": "#3FE4D1"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Aggro",
|
||||
"color": "#992A9B"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "Start",
|
||||
"pos": "A3",
|
||||
"type": "Start",
|
||||
"price": "",
|
||||
"path": ["E"]
|
||||
},
|
||||
{
|
||||
"name": "Waking Dream",
|
||||
"pos": "B3",
|
||||
"type": "Spirit",
|
||||
"price": "10 LP",
|
||||
"path": ["E"]
|
||||
},
|
||||
{
|
||||
"name": "Checkpoint",
|
||||
"pos": "C1",
|
||||
"type": "Checkpoint",
|
||||
"price": "Link x2",
|
||||
"path": ["E", "S"]
|
||||
},
|
||||
{
|
||||
"name": "Zero Gravity",
|
||||
"pos": "C2",
|
||||
"type": "Magic",
|
||||
"price": "50 LP",
|
||||
"path": ["N", "E", "S"]
|
||||
},
|
||||
{
|
||||
"name": "Confuse",
|
||||
"pos": "C3",
|
||||
"type": "Magic",
|
||||
"price": "50 LP",
|
||||
"path": ["S", "N", "W", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Dark Screen",
|
||||
"pos": "C4",
|
||||
"type": "Stat",
|
||||
"price": "20 LP",
|
||||
"path": ["N", "E", "S"]
|
||||
},
|
||||
{
|
||||
"name": "Magic Haste",
|
||||
"pos": "C5",
|
||||
"type": "Stat",
|
||||
"price": "50 LP",
|
||||
"route": 0,
|
||||
"path": ["N", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Zero Gravira",
|
||||
"pos": "D1",
|
||||
"type": "Magic",
|
||||
"price": "100 LP",
|
||||
"path": ["W"]
|
||||
},
|
||||
{
|
||||
"name": "Confusion Block",
|
||||
"pos": "D2",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"path": ["W", "S"]
|
||||
},
|
||||
{
|
||||
"name": "Drain Dive",
|
||||
"pos": "D3",
|
||||
"type": "Attack",
|
||||
"price": "50 LP",
|
||||
"path": ["N", "S", "W", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Magic Boost",
|
||||
"pos": "D4",
|
||||
"type": "Stat",
|
||||
"price": "100 LP",
|
||||
"path": ["W", "N", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Magic Haste",
|
||||
"pos": "D5",
|
||||
"type": "Stat",
|
||||
"price": "100 LP",
|
||||
"route": 0,
|
||||
"path": ["W"]
|
||||
},
|
||||
{
|
||||
"name": "Attack Boost",
|
||||
"pos": "E2",
|
||||
"type": "Stat",
|
||||
"price": "100 LP",
|
||||
"path": ["S"]
|
||||
},
|
||||
{
|
||||
"name": "Magic Haste",
|
||||
"pos": "E3",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"path": ["W", "E", "N"]
|
||||
},
|
||||
{
|
||||
"name": "Attack Haste",
|
||||
"pos": "E4",
|
||||
"type": "Stat",
|
||||
"price": "30 LP",
|
||||
"route": 1,
|
||||
"path": ["W"]
|
||||
},
|
||||
{
|
||||
"name": "Dark Screen",
|
||||
"pos": "F3",
|
||||
"type": "Stat",
|
||||
"price": "40 LP",
|
||||
"path": ["W", "E"]
|
||||
},
|
||||
{
|
||||
"name": "Attack Haste",
|
||||
"pos": "F4",
|
||||
"type": "Stat",
|
||||
"price": "50 LP",
|
||||
"route": 1,
|
||||
"path": ["W"]
|
||||
},
|
||||
{
|
||||
"name": "Checkpoint",
|
||||
"pos": "G3",
|
||||
"type": "Checkpoint",
|
||||
"price": "Link x2",
|
||||
"path": ["W", "E"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"spirit": "Necho Cat",
|
||||
"routes": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Diva",
|
||||
"color": "#3FE4D1"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Artist",
|
||||
"color": "#7AE43F"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "Magic Boost",
|
||||
"pos": "A4",
|
||||
"type": "Stat",
|
||||
"price": "200 LP",
|
||||
"route": 0,
|
||||
"path": ["E"]
|
||||
},
|
||||
{
|
||||
"name": "Support Boost",
|
||||
"pos": "B1",
|
||||
"type": "Spirit",
|
||||
"price": "200 LP",
|
||||
"path": ["E"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -157,8 +157,8 @@ pub fn init() {
|
|||
}
|
||||
}
|
||||
|
||||
tracing::info!("Generating the commands table template");
|
||||
tracing::info!("Generating the BBS commands table template");
|
||||
let template = CommandsTemplate { commands, crystals };
|
||||
|
||||
std::fs::write("./out/index.html", template.render().unwrap()).unwrap();
|
||||
std::fs::write("./out/bbs-commands.html", template.render().unwrap()).unwrap();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
use std::panic;
|
||||
|
||||
use askama::Template;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
struct Board {
|
||||
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_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_supports(&self) -> Vec<&Ability> {
|
||||
self.abilities
|
||||
.iter()
|
||||
.filter(|&ability| ability.r#type == AbilityType::Support)
|
||||
.collect_vec()
|
||||
}
|
||||
|
||||
pub fn get_magics(&self) -> Vec<&Ability> {
|
||||
self.abilities
|
||||
.iter()
|
||||
.filter(|&ability| ability.r#type == AbilityType::Magic)
|
||||
.collect_vec()
|
||||
}
|
||||
|
||||
pub fn get_spirit(&self) -> Vec<&Ability> {
|
||||
self.abilities
|
||||
.iter()
|
||||
.filter(|&ability| ability.r#type == AbilityType::Spirit)
|
||||
.collect_vec()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
struct Route {
|
||||
id: u32,
|
||||
name: String,
|
||||
color: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
enum AbilityType {
|
||||
Start,
|
||||
Checkpoint,
|
||||
Stat,
|
||||
Spirit,
|
||||
Support,
|
||||
Attack,
|
||||
Magic,
|
||||
}
|
||||
|
||||
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>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
enum Direction {
|
||||
#[serde(alias = "N")]
|
||||
North,
|
||||
#[serde(alias = "S")]
|
||||
South,
|
||||
#[serde(alias = "E")]
|
||||
East,
|
||||
#[serde(alias = "W")]
|
||||
West,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "pages/ddd-abilities.html", whitespace = "suppress")]
|
||||
struct AbilitiesTemplate {
|
||||
pub boards: Vec<Board>,
|
||||
}
|
||||
|
||||
const ABILITIES_PATH: &str = "./input/ddd/abilities.json";
|
||||
|
||||
pub fn init() {
|
||||
tracing::info!("Loading ability links json data from {}", ABILITIES_PATH);
|
||||
let boards_str = std::fs::read_to_string(ABILITIES_PATH).unwrap();
|
||||
let mut boards = serde_json::from_str::<Vec<Board>>(&boards_str).unwrap();
|
||||
|
||||
for board in &mut boards {
|
||||
board.init_total_lp();
|
||||
board.init_max_level();
|
||||
board.init_stats();
|
||||
}
|
||||
|
||||
tracing::info!("Generating the DDD ability boards template");
|
||||
let template = AbilitiesTemplate { boards };
|
||||
|
||||
std::fs::write("./out/ddd-abilities.html", template.render().unwrap()).unwrap();
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
mod bbs;
|
||||
mod ddd;
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
|
@ -14,4 +15,5 @@ fn main() {
|
|||
.init();
|
||||
|
||||
bbs::init();
|
||||
ddd::init();
|
||||
}
|
||||
|
|
|
@ -35,35 +35,6 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
|
@ -1,205 +0,0 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
|
||||
{% block title %}Commands{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<script>
|
||||
let charFilter = "";
|
||||
let typeFilter = "";
|
||||
let searchType = "commands";
|
||||
|
||||
document.addEventListener("DOMContentLoaded", (event) => {
|
||||
const searchFilter = document.getElementById("filter");
|
||||
let filterHandler = debounce(() => filter());
|
||||
searchFilter.addEventListener("keyup", filterHandler);
|
||||
searchFilter.placeholder = "Search commands...";
|
||||
|
||||
const searchInputs = document.querySelectorAll(
|
||||
'input[type="radio"][name="search"]',
|
||||
);
|
||||
|
||||
searchInputs.forEach(function (item, index) {
|
||||
item.addEventListener("input", function () {
|
||||
searchType = this.checked ? this.value : "";
|
||||
searchFilter.placeholder = "Search " + this.value + "...";
|
||||
filter();
|
||||
});
|
||||
});
|
||||
|
||||
const charFilters = document.querySelectorAll(
|
||||
'input[type="radio"][name="charFilter"]',
|
||||
);
|
||||
|
||||
charFilters.forEach(function (item, index) {
|
||||
item.addEventListener("input", function () {
|
||||
charFilter = this.checked ? this.value : "";
|
||||
filter();
|
||||
});
|
||||
});
|
||||
|
||||
const typeFilters = document.querySelectorAll(
|
||||
'input[type="radio"][name="typeFilter"]',
|
||||
);
|
||||
|
||||
typeFilters.forEach(function (item, index) {
|
||||
item.addEventListener("input", function () {
|
||||
typeFilter = this.checked ? this.value : "";
|
||||
filter();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function debounce(callback, wait = 300) {
|
||||
let timeoutId = null;
|
||||
return (...args) => {
|
||||
window.clearTimeout(timeoutId);
|
||||
timeoutId = window.setTimeout(() => {
|
||||
callback(...args);
|
||||
}, wait);
|
||||
};
|
||||
}
|
||||
|
||||
function filter() {
|
||||
const table = document.querySelector("table tbody");
|
||||
const search = document
|
||||
.getElementById("filter")
|
||||
.value.toLowerCase();
|
||||
|
||||
for (const child of table.children) {
|
||||
const tds = child.children;
|
||||
resetStyle(child, tds);
|
||||
|
||||
if (search.length > 0) {
|
||||
if (searchType === "commands") {
|
||||
// Check for command name
|
||||
if (!tds[1].innerText.toLowerCase().includes(search)) {
|
||||
child.style.display = "none";
|
||||
} else {
|
||||
applyStyle(tds[1]);
|
||||
}
|
||||
} else if (searchType === "ingredients") {
|
||||
// Ingredients
|
||||
if (!tds[2].innerText.toLowerCase().includes(search)) {
|
||||
if (
|
||||
!tds[3].innerText.toLowerCase().includes(search)
|
||||
) {
|
||||
child.style.display = "none";
|
||||
} else {
|
||||
applyStyle(tds[3]);
|
||||
}
|
||||
} else {
|
||||
applyStyle(tds[2]);
|
||||
if (
|
||||
tds[3].innerText.toLowerCase().includes(search)
|
||||
) {
|
||||
applyStyle(tds[3]);
|
||||
}
|
||||
}
|
||||
} else if (searchType === "abilities") {
|
||||
// Abilities
|
||||
hasLine = false;
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const id = i + 6;
|
||||
const ablName = tds[id].innerText.toLowerCase();
|
||||
if (ablName.includes(search)) {
|
||||
applyStyle(tds[id]);
|
||||
hasLine = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasLine) {
|
||||
child.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const typeCheck =
|
||||
typeFilter === "" || tds[1].className === typeFilter;
|
||||
const charCheck =
|
||||
charFilter === "" || child.className.includes(charFilter);
|
||||
|
||||
if (child.style.display == "" && (!typeCheck || !charCheck)) {
|
||||
child.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetStyle(child, tds) {
|
||||
child.style.display = "";
|
||||
for (const td of tds) {
|
||||
td.style.fontWeight = "inherit";
|
||||
td.style.color = "#fff";
|
||||
}
|
||||
}
|
||||
|
||||
function applyStyle(el) {
|
||||
el.style.fontWeight = "bold";
|
||||
el.style.color = "red";
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "components/search.html" %}
|
||||
<br />
|
||||
{% include "components/type-filters.html" %}
|
||||
<br />
|
||||
{% include "components/char-filters.html" %}
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">Character</th>
|
||||
<th rowspan="2">Command</th>
|
||||
<th rowspan="2">Ingredient A</th>
|
||||
<th rowspan="2">Ingredient B</th>
|
||||
<th rowspan="2">Type</th>
|
||||
<th rowspan="2">Chance</th>
|
||||
<th colspan="7">Abilities</th>
|
||||
</tr>
|
||||
<tr>
|
||||
{% for crystal in crystals %}
|
||||
<th>{{ crystal }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for cmd in commands %}
|
||||
{% for recipe in cmd.recipes %}
|
||||
<tr class="{{ recipe.get_unlock_chars() }}">
|
||||
<td>
|
||||
<div class="charlist">
|
||||
<!-- RGB moment -->
|
||||
<span class="terra">
|
||||
{% if recipe.can_unlock(Character::Terra) %}T{% endif %}
|
||||
</span>
|
||||
<span class="ventus">
|
||||
{% if recipe.can_unlock(Character::Ventus) %}V{% endif %}
|
||||
</span>
|
||||
<span class="aqua">
|
||||
{% if recipe.can_unlock(Character::Aqua) %}A{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="{{ cmd.category }}">{{ cmd.name }}</td>
|
||||
<td>{{ recipe.ingredients.0 }}</td>
|
||||
<td>{{ recipe.ingredients.1 }}</td>
|
||||
<td>{{ recipe.type }}</td>
|
||||
<td>{{ recipe.chance }}%</td>
|
||||
{% for crystal in crystals %}
|
||||
{% let ability = recipe.get_ability(crystal) %}
|
||||
<td>
|
||||
{% if ability.is_some() %}
|
||||
{{ ability.unwrap().name }}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
|
@ -0,0 +1,82 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
|
||||
{% block title %}Abilities{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
table {
|
||||
width: inherit;
|
||||
|
||||
td {
|
||||
width: 120px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
td.slot-w {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
td.slot-h {
|
||||
width: 20px;
|
||||
}
|
||||
}
|
||||
</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 %}
|
||||
Total LP Needed: {{+ board.total_lp +}}
|
||||
<br>
|
||||
Max Level Needed: {{+ board.max_level +}}
|
||||
<br><br>
|
||||
Stats:
|
||||
<ul>
|
||||
{% for val in board.stats %}
|
||||
<li>x{{+ val.0 +}} {{+ val.1 +}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Support:
|
||||
<ul>
|
||||
{% for support in board.get_supports() %}
|
||||
<li>{{ support.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<table>
|
||||
<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 %}
|
||||
<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">{{ val.name }}</td>
|
||||
{% when None %}
|
||||
<td colspan="1"></td>
|
||||
{% endmatch %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue