diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c6182091..df589277 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -33,7 +33,7 @@ fn main() { let meter_window = app.get_window("main").unwrap(); meter_window.set_always_on_top(true) .expect("failed to set windows always on top"); - #[cfg(debug_assertions)] // only include this code on debug builds + #[cfg(debug_assertions)] { meter_window.open_devtools(); } @@ -103,7 +103,7 @@ fn main() { .build() .expect("failed to create log window"); logs_window.set_size(Size::Logical(LogicalSize { width: 800.0, height: 500.0 })).unwrap(); - #[cfg(debug_assertions)] // only include this code on debug builds + #[cfg(debug_assertions)] { logs_window.open_devtools(); } diff --git a/src-tauri/src/parser/mod.rs b/src-tauri/src/parser/mod.rs index d770e0f2..b6f3842f 100644 --- a/src-tauri/src/parser/mod.rs +++ b/src-tauri/src/parser/mod.rs @@ -15,7 +15,8 @@ use tokio::task; pub struct Parser<'a> { pub window: &'a Window, pub encounter: Encounter, - pub raid_end: bool + pub raid_end: bool, + pub saved: bool } impl Parser<'_> { @@ -23,12 +24,17 @@ impl Parser<'_> { Parser { window, encounter: Encounter::default(), - raid_end: false + raid_end: false, + saved: false } } pub fn parse_line(&mut self, line: String) { - // println!("{}", line); + #[cfg(debug_assertions)] + { + println!("{}", line); + } + if line.is_empty() { return; } @@ -63,6 +69,7 @@ impl Parser<'_> { if self.raid_end { self.raid_end = false; self.soft_reset(); + self.saved = false; } match log_type { @@ -169,6 +176,11 @@ impl Parser<'_> { v.name == self.encounter.local_player || (v.damage_stats.damage_dealt > 0 && v.max_hp > 0) }); + + if !self.saved && !self.encounter.current_boss_name.is_empty() { + self.save_to_db(); + } + self.window .emit("zone-change", Some(self.encounter.clone())) .expect("failed to emit zone-change"); @@ -196,6 +208,7 @@ impl Parser<'_> { { self.save_to_db(); self.raid_end = true; + self.saved = true; } } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 8c93a866..b37f5d99 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "LOA Logs", - "version": "0.4.0" + "version": "0.5.0" }, "tauri": { "allowlist": { diff --git a/src/lib/components/DamageMeter.svelte b/src/lib/components/DamageMeter.svelte index dfcd08f2..6f421192 100644 --- a/src/lib/components/DamageMeter.svelte +++ b/src/lib/components/DamageMeter.svelte @@ -53,14 +53,12 @@ }); let phaseTransitionEvent = await listen('phase-transition', (event) => { console.log("phase transition event: ", event.payload) - // phaseTransitionAlert = true; - // setTimeout(() => { - // phaseTransitionAlert = false; - // }, 3000); + active = false; }); let raidEndEvent = await listen('raid-end', (event: EncounterEvent) => { console.log("raid-end, updating encounter") encounter = event.payload; + active = false; raidEndAlert = true; setTimeout(() => { raidEndAlert = false;