From 90bf23c6bc9e0494bc5199d8a364ecbf0db497dd Mon Sep 17 00:00:00 2001 From: gre4bee Date: Sat, 29 Dec 2018 19:20:08 +0800 Subject: [PATCH] temp fix for event map hp changes --temp correspondence to new event maphp api --- ElectronicObserver/Window/FormInformation.cs | 33 +++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/ElectronicObserver/Window/FormInformation.cs b/ElectronicObserver/Window/FormInformation.cs index a140dbf88..52af46667 100644 --- a/ElectronicObserver/Window/FormInformation.cs +++ b/ElectronicObserver/Window/FormInformation.cs @@ -386,18 +386,27 @@ private string GetMapGauge(dynamic data) else if (elem.api_eventmap()) { - string difficulty = ""; - if (elem.api_eventmap.api_selected_rank()) - { - difficulty = "[" + Constants.GetDifficulty((int)elem.api_eventmap.api_selected_rank) + "] "; - } - - sb.AppendFormat("{0}-{1} {2}: {3}{4} {5}/{6}\r\n", - map.MapAreaID, map.MapInfoID, difficulty, - elem.api_eventmap.api_gauge_num() ? ("#" + (int)elem.api_eventmap.api_gauge_num + " ") : "", - elem.api_eventmap.api_gauge_type() && (int)elem.api_eventmap.api_gauge_type == 3 ? "TP" : "HP", - (int)elem.api_eventmap.api_now_maphp, (int)elem.api_eventmap.api_max_maphp); - + string difficulty = ""; + if (elem.api_eventmap.api_selected_rank()) + { + difficulty = "[" + Constants.GetDifficulty((int)elem.api_eventmap.api_selected_rank) + "] "; + } + int gauge_max_hp = 0; + int gauge_cur_hp = 0; + if (elem.api_eventmap.api_now_maphp()) + { + gauge_cur_hp = (int)elem.api_eventmap.api_now_maphp; + } + if (elem.api_eventmap.api_max_maphp()) + { + gauge_max_hp = (int)elem.api_eventmap.api_max_maphp; + } + + sb.AppendFormat("{0}-{1} {2}:{3} {4} {5}/{6}\r\n", + map.MapAreaID, map.MapInfoID, difficulty, + elem.api_gauge_num() ? ("#" + (int)elem.api_gauge_num + " ") : "", + elem.api_gauge_type() && (int)elem.api_gauge_type == 3 ? "TP" : "HP", + gauge_cur_hp, gauge_max_hp); } } }