flatland_client_ui/
rotation_editor.rs1use flatland_protocol::RotationPreset;
4
5pub const EDITOR_ABILITIES: &[&str] = &[
7 "unarmed",
8 "short_sword_slash",
9 "iron_sword_slash",
10 "bow_shot",
11 "arrow_shot",
12 "fireball",
13 "cone_frost",
14 "frost_nova",
15 "poison_dart",
16 "heal_touch",
17];
18
19const BUILTIN_PRESET_IDS: &[&str] = &["melee", "ranged", "spells"];
20
21pub fn preset_deletable(id: &str) -> bool {
22 !BUILTIN_PRESET_IDS.contains(&id)
23}
24
25pub fn next_custom_preset(presets: &[RotationPreset]) -> RotationPreset {
26 let mut n = 1u32;
27 loop {
28 let id = format!("custom_{n}");
29 if !presets.iter().any(|p| p.id == id) {
30 return RotationPreset {
31 id,
32 label: format!("Custom {n}"),
33 abilities: Vec::new(),
34 };
35 }
36 n += 1;
37 }
38}