update
This commit is contained in:
parent
603dd5c5eb
commit
ee88df72ec
@ -28,3 +28,4 @@ serde_json = "1.0.133"
|
||||
thiserror = "2.0.8"
|
||||
directories = "5.0.1"
|
||||
indoc = "2.0.5"
|
||||
open = "5.3.1"
|
||||
|
||||
@ -65,6 +65,11 @@ fn get_config(state: State<'_, Mutex<AppState>>) -> POE2FilterConfig {
|
||||
state.lock().unwrap().config.clone()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn open_config_folder(state: State<'_, Mutex<AppState>>) {
|
||||
let _ = open::that(state.lock().unwrap().config_dir.clone());
|
||||
}
|
||||
|
||||
fn generate_filter(config: &POE2FilterConfig) -> String {
|
||||
let mut rules: Vec<String> = vec![];
|
||||
let weapons_to_hide = config
|
||||
@ -75,9 +80,12 @@ fn generate_filter(config: &POE2FilterConfig) -> String {
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ");
|
||||
let max_level = config.settings.max_level;
|
||||
rules.push(with_leveling_setting(formatdoc! {"
|
||||
rules.push(with_leveling_setting(
|
||||
formatdoc! {"
|
||||
Hide
|
||||
Class {weapons_to_hide}"}, max_level));
|
||||
Class {weapons_to_hide}"},
|
||||
max_level,
|
||||
));
|
||||
|
||||
config
|
||||
.armours
|
||||
@ -124,10 +132,13 @@ fn generate_filter(config: &POE2FilterConfig) -> String {
|
||||
armour_rules
|
||||
.iter()
|
||||
.map(|rule| {
|
||||
with_leveling_setting(formatdoc! {"
|
||||
with_leveling_setting(
|
||||
formatdoc! {"
|
||||
Show
|
||||
Class {kind}
|
||||
{rule}"}, max_level)
|
||||
{rule}"},
|
||||
max_level,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
})
|
||||
@ -138,9 +149,12 @@ fn generate_filter(config: &POE2FilterConfig) -> String {
|
||||
.map(|filter| format!(r#""{}""#, filter.kind.to_string()))
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ");
|
||||
rules.push(with_leveling_setting(formatdoc! {"
|
||||
rules.push(with_leveling_setting(
|
||||
formatdoc! {"
|
||||
Hide
|
||||
Class {all_armours}"}, max_level));
|
||||
Class {all_armours}"},
|
||||
max_level,
|
||||
));
|
||||
|
||||
(11..max_level)
|
||||
.map(|i| {
|
||||
@ -219,9 +233,7 @@ fn init() -> AppState {
|
||||
})
|
||||
.collect(),
|
||||
accessories: vec![],
|
||||
settings: FilterSettings {
|
||||
max_level: 80
|
||||
}
|
||||
settings: FilterSettings { max_level: 80 },
|
||||
};
|
||||
write_config(config_dir.join(CONFIG_PATH), &config);
|
||||
config
|
||||
@ -257,7 +269,11 @@ pub fn run() {
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.invoke_handler(tauri::generate_handler![update, get_config])
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
update,
|
||||
get_config,
|
||||
open_config_folder
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
@ -271,7 +287,7 @@ struct POE2FilterConfig {
|
||||
}
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
struct FilterSettings {
|
||||
max_level: u32
|
||||
max_level: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, strum_macros::Display, EnumIter, Serialize, Deserialize)]
|
||||
|
||||
70
src/app.rs
70
src/app.rs
@ -119,8 +119,20 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
let max_level = store.settings().max_level();
|
||||
view! {
|
||||
<main class="container p-4 prose max-w-none">
|
||||
<ul class="list-disc pl-4 pb-2">
|
||||
<li>"Config folder: %appdata%\\LeonLiu\\POE2 Loot Filter\\config"</li>
|
||||
<ul>
|
||||
<li class="not-prose">
|
||||
"Config folder: "
|
||||
<button
|
||||
class="btn btn-xs btn-link"
|
||||
on:click=move |_| {
|
||||
spawn_local(async move {
|
||||
invoke_without_args("open_config_folder").await;
|
||||
});
|
||||
}
|
||||
>
|
||||
"%appdata%\\LeonLiu\\POE2 Loot Filter\\config"
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
"Changes on the UI will immediately write the new filter file into POE2's config folder. Reload the filter in-game after changes on the UI."
|
||||
</li>
|
||||
@ -128,7 +140,6 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
<li>
|
||||
"Based on "
|
||||
<a
|
||||
class="text-blue-600 visited:text-purple-600"
|
||||
target="_blank"
|
||||
href="https://github.com/NeverSinkDev/NeverSink-PoE2litefilter"
|
||||
>
|
||||
@ -142,7 +153,7 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
<li class="not-prose">
|
||||
"In areas lower than level"
|
||||
<input
|
||||
class="mx-1 h-8"
|
||||
class="input input-xs w-12 input-bordered"
|
||||
type="number"
|
||||
min="60"
|
||||
max="100"
|
||||
@ -153,14 +164,14 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
/> ",hide normal or magic items, unless turned on in configurations below."
|
||||
</li>
|
||||
</ul>
|
||||
<h2 class="text-2xl font-bold">Weapons</h2>
|
||||
<p class="my-2">
|
||||
<h2>Weapons</h2>
|
||||
<p>
|
||||
{format!(
|
||||
"In areas lower than level {}, only show normal or magic weapons selected.",
|
||||
max_level.get(),
|
||||
)}
|
||||
</p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="flex flex-wrap">
|
||||
<For
|
||||
each=move || store.weapons()
|
||||
key=|row| row.read().kind.to_string()
|
||||
@ -168,29 +179,30 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
let kind = child.clone().kind().get().to_string();
|
||||
let show = child.show();
|
||||
view! {
|
||||
<label class="inline-flex items-center">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
prop:checked=show.get()
|
||||
on:change:target=move |ev| {
|
||||
*show.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">{kind.clone()}</span>
|
||||
<span class="ml-1 label-text">{kind.clone()}</span>
|
||||
</label>
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<h2 class="text-2xl font-bold">Armours</h2>
|
||||
<p class="my-2">
|
||||
<h2>Armours</h2>
|
||||
<p>
|
||||
{format!(
|
||||
"In areas lower than level {}, only show normal or magic armours with selected base defence types.",
|
||||
max_level.get(),
|
||||
)}
|
||||
</p>
|
||||
<div class="">
|
||||
<div>
|
||||
<For
|
||||
each=move || store.armours()
|
||||
key=|row| row.read().kind.to_string()
|
||||
@ -203,11 +215,12 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
let armour_energy_shield = child.clone().armour_energy_shield();
|
||||
let evasion_energy_shield = child.clone().evasion_energy_shield();
|
||||
view! {
|
||||
<h2 class="text-xl">{kind.clone()}</h2>
|
||||
<div class="flex gap-2">
|
||||
<label class="inline-flex items-center">
|
||||
<h3>{kind.clone()}</h3>
|
||||
<div class="flex flex-wrap">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
id=kind.clone() + "Armour"
|
||||
name=kind.clone() + "Armour"
|
||||
prop:checked=armour.get()
|
||||
@ -215,11 +228,12 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
*armour.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">"Armour"</span>
|
||||
<span class="ml-1 label-text">"Armour"</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
id=kind.clone() + "Evasion"
|
||||
name=kind.clone() + "Evasion"
|
||||
prop:checked=evasion.get()
|
||||
@ -227,11 +241,12 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
*evasion.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">"Evasion"</span>
|
||||
<span class="ml-1 label-text">"Evasion"</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
id=kind.clone() + "EnergyShield"
|
||||
name=kind.clone() + "EnergyShield"
|
||||
prop:checked=energy_shield.get()
|
||||
@ -239,11 +254,12 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
*energy_shield.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">"Energy Shield"</span>
|
||||
<span class="ml-1 label-text">"Energy Shield"</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
id=kind.clone() + "ArmourEvasion"
|
||||
name=kind.clone() + "ArmourEvasion"
|
||||
prop:checked=armour_evasion.get()
|
||||
@ -251,11 +267,12 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
*armour_evasion.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">"Armour + Evasion"</span>
|
||||
<span class="ml-1 label-text">"Armour + Evasion"</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
id=kind.clone() + "ArmourEnergyShield"
|
||||
name=kind.clone() + "ArmourEnergyShield"
|
||||
prop:checked=armour_energy_shield.get()
|
||||
@ -263,11 +280,12 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
*armour_energy_shield.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">"Armour + Energy Shield"</span>
|
||||
<span class="ml-1 label-text">"Armour + Energy Shield"</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<label class="label cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
id=kind.clone() + "EvasionEnergyShield"
|
||||
name=kind.clone() + "EvasionEnergyShield"
|
||||
prop:checked=evasion_energy_shield.get()
|
||||
@ -275,7 +293,7 @@ fn Main(config: POE2FilterConfig) -> impl IntoView {
|
||||
*evasion_energy_shield.write() = event_target_checked(&ev);
|
||||
}
|
||||
/>
|
||||
<span class="ml-2">"Evasion + Energy Shield"</span>
|
||||
<span class="ml-1 label-text">"Evasion + Energy Shield"</span>
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user