-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d508988
commit 0afb5d4
Showing
5 changed files
with
129 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
use crate::gui::number_field_float; | ||
use crate::{gui::checkbox, json::Preset}; | ||
|
||
use dioxus::prelude::*; | ||
|
||
#[component] | ||
pub fn party_exp_bits() -> Element { | ||
let mut preset_state = use_context::<Signal<Preset>>(); | ||
let read_state = preset_state.read(); | ||
|
||
let enabled = read_state.party_exp_bits.enabled; | ||
|
||
let dv_exp_modifier = read_state.party_exp_bits.dv_exp_modifier; | ||
let exp_modifier = read_state.party_exp_bits.exp_modifier; | ||
let bits_modifier = read_state.party_exp_bits.bits_modifier; | ||
|
||
rsx! { | ||
div { | ||
class: "segment", | ||
div { | ||
class: "left", | ||
div { | ||
class: "tooltip", | ||
span { | ||
class: "tooltiptext", | ||
style: "width: 350px", | ||
"Total stats = Base stats + Stat modifier * level ± [0, Stat range]", | ||
br {}, | ||
"Total res = Base res + Res modifier * level ± [0, Stat range]" | ||
}, | ||
checkbox::checkbox { | ||
label: "Party DV Exp/Exp/Bits", | ||
id: "party_exp_bits.enabled", | ||
checked: enabled, | ||
onchange: move |x: bool| { | ||
preset_state.write().party_exp_bits.enabled = x; | ||
} | ||
}, | ||
}, | ||
} | ||
div { | ||
class: "left", | ||
number_field_float::number_field { | ||
min: 0.00, | ||
max: 100.00, | ||
id: "party_exp_bits.dv_exp_modifier", | ||
label: "DV Exp modifer", | ||
disabled: !enabled, | ||
tooltip: "Multiply DV Exp by", | ||
onchange: move |x: f64| { | ||
preset_state.write().party_exp_bits.dv_exp_modifier = x; | ||
}, | ||
value: dv_exp_modifier | ||
} | ||
} | ||
div { | ||
class: "left", | ||
number_field_float::number_field { | ||
min: 0.00, | ||
max: 100.00, | ||
id: "party_exp_bits.exp_modifier", | ||
label: "Exp modifer", | ||
disabled: !enabled, | ||
tooltip: "Multiply Exp by", | ||
onchange: move |x: f64| { | ||
preset_state.write().party_exp_bits.exp_modifier = x; | ||
}, | ||
value: exp_modifier | ||
} | ||
} | ||
div { | ||
class: "left", | ||
number_field_float::number_field { | ||
min: 0.00, | ||
max: 100.00, | ||
id: "party_exp_bits.bits_modifier", | ||
label: "Bits modifer", | ||
disabled: !enabled, | ||
tooltip: "Multiply Bits by", | ||
onchange: move |x: f64| { | ||
preset_state.write().party_exp_bits.bits_modifier = x; | ||
}, | ||
value: bits_modifier | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::{json::PartyExpBits, rand::Objects}; | ||
|
||
pub fn patch(preset: &PartyExpBits, objects: &mut Objects) -> anyhow::Result<()> { | ||
for party_exp_bits in objects.party_exp_bits.modified.iter_mut() { | ||
party_exp_bits.dv_exp = ((party_exp_bits.dv_exp as f64) * preset.dv_exp_modifier) as u32; | ||
party_exp_bits.exp = ((party_exp_bits.exp as f64) * preset.exp_modifier) as u32; | ||
party_exp_bits.bits = ((party_exp_bits.bits as f64) * preset.bits_modifier) as u32; | ||
} | ||
|
||
Ok(()) | ||
} |