From c2531b77a21cea99fb5b2b32bb9fbb3c7762f9d3 Mon Sep 17 00:00:00 2001 From: GreenComfyTea Date: Mon, 6 Mar 2023 13:48:55 +0200 Subject: [PATCH] Add option to filter parts based on current state --- .../autorun/MHR_Overlay/Misc/config.lua | 3 ++ .../autorun/MHR_Overlay/Misc/language.lua | 6 ++- .../MHR_Overlay/Monsters/body_part.lua | 10 ++++ .../body_parts_customization.lua | 12 ++++- .../MHR_Overlay/UI/customization_menu.lua | 47 +++++++++++-------- .../data/MHR Overlay/languages/en-us.json | 3 ++ .../data/MHR Overlay/languages/ja-jp.json | 3 ++ .../data/MHR Overlay/languages/ko-kr.json | 3 ++ .../data/MHR Overlay/languages/ru-ru.json | 3 ++ .../data/MHR Overlay/languages/zh-cn.json | 3 ++ .../data/MHR Overlay/languages/zh-tw.json | 3 ++ 11 files changed, 75 insertions(+), 21 deletions(-) diff --git a/reframework/autorun/MHR_Overlay/Misc/config.lua b/reframework/autorun/MHR_Overlay/Misc/config.lua index 2415f40..f2fa1be 100644 --- a/reframework/autorun/MHR_Overlay/Misc/config.lua +++ b/reframework/autorun/MHR_Overlay/Misc/config.lua @@ -1260,6 +1260,7 @@ function config.init_default() }, settings = { + filter_mode = "Current State", hide_undamaged_parts = true, time_limit = 15 }, @@ -2444,6 +2445,7 @@ function config.init_default() }, settings = { + filter_mode = "Current State", hide_undamaged_parts = true, time_limit = 15 }, @@ -3615,6 +3617,7 @@ function config.init_default() }, settings = { + filter_mode = "Current State", hide_undamaged_parts = true, time_limit = 15 }, diff --git a/reframework/autorun/MHR_Overlay/Misc/language.lua b/reframework/autorun/MHR_Overlay/Misc/language.lua index a984cdc..ae3ae8c 100644 --- a/reframework/autorun/MHR_Overlay/Misc/language.lua +++ b/reframework/autorun/MHR_Overlay/Misc/language.lua @@ -496,7 +496,11 @@ language.default_language = { hide_timer_for_infinite_buffs = "Hide Timer for infinite Buffs", current_value = "Current Value", - max_value = "Max Value" + max_value = "Max Value", + + filter_mode = "Filter Mode", + current_state = "Current State", + default_state = "Default State" } }; diff --git a/reframework/autorun/MHR_Overlay/Monsters/body_part.lua b/reframework/autorun/MHR_Overlay/Monsters/body_part.lua index 685da52..ab441a4 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/body_part.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/body_part.lua @@ -155,6 +155,16 @@ function body_part.draw(monster, part_UI, cached_config, parts_position_on_scree local break_supported = part.break_max_health > 0; local severe_supported = part.loss_max_health > 0; + if cached_config.settings.filter_mode == "Current State" then + if break_supported and part.break_count >= part.break_max_count then + break_supported = false; + end + + if severe_supported and part.is_severed then + severe_supported = false; + end + end + if health_supported then if break_supported then if severe_supported then diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua index 6741612..4df6479 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua @@ -87,6 +87,16 @@ function body_parts_customization.draw(cached_config) config_changed = config_changed or changed; + changed, index = imgui.combo(language.current_language.customization_menu.filter_mode, + table_helpers.find_index(customization_menu.large_monster_UI_parts_filter_types, cached_config.settings.filter_mode), + customization_menu.displayed_large_monster_UI_parts_filter_types); + + config_changed = config_changed or changed; + + if changed then + cached_config.settings.filter_mode = customization_menu.large_monster_UI_parts_filter_types[index]; + end + changed, cached_config.settings.time_limit = imgui.drag_float( language.current_language.customization_menu.time_limit, cached_config.settings.time_limit, 0.1, 0, 99999, "%.1f"); @@ -99,7 +109,7 @@ function body_parts_customization.draw(cached_config) changed, index = imgui.combo( language.current_language.customization_menu.type, table_helpers.find_index(customization_menu.large_monster_UI_parts_sorting_types, cached_config.sorting.type), - customization_menu.displayed_monster_UI_parts_sorting_types); + customization_menu.displayed_large_monster_UI_parts_sorting_types); config_changed = config_changed or changed; diff --git a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua index b69e6e9..219ca44 100644 --- a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua +++ b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua @@ -75,7 +75,8 @@ customization_menu.displayed_anchor_types = {}; customization_menu.displayed_outline_styles = {}; customization_menu.displayed_monster_UI_sorting_types = {}; -customization_menu.displayed_monster_UI_parts_sorting_types = {}; +customization_menu.displayed_large_monster_UI_parts_sorting_types = {}; +customization_menu.displayed_large_monster_UI_parts_filter_types = {}; customization_menu.displayed_ailments_sorting_types = {}; customization_menu.displayed_ailment_buildups_sorting_types = {}; customization_menu.displayed_highlighted_buildup_bar_types = {}; @@ -96,6 +97,8 @@ customization_menu.anchor_types = {}; customization_menu.outline_styles = {}; customization_menu.monster_UI_sorting_types = {}; +customization_menu.large_monster_UI_parts_sorting_types = {}; +customization_menu.large_monster_UI_parts_filter_types = {}; customization_menu.ailments_sorting_types = {}; customization_menu.ailment_buildups_sorting_types = {}; customization_menu.highlighted_buildup_bar_types = {}; @@ -188,25 +191,31 @@ function customization_menu.init() default.health_percentage, default.distance}; - customization_menu.displayed_monster_UI_parts_sorting_types = { current.normal, - current.health, - current.health_percentage, - current.flinch_count, - current.break_health, - current.break_health_percentage, - current.break_count, - current.loss_health, - current.loss_health_percentage}; + customization_menu.displayed_large_monster_UI_parts_sorting_types = { current.normal, + current.health, + current.health_percentage, + current.flinch_count, + current.break_health, + current.break_health_percentage, + current.break_count, + current.loss_health, + current.loss_health_percentage}; - customization_menu.large_monster_UI_parts_sorting_types = { default.normal, - default.health, - default.health_percentage, - default.flinch_count, - default.break_health, - default.break_health_percentage, - default.break_count, - default.loss_health, - default.loss_health_percentage}; + customization_menu.large_monster_UI_parts_sorting_types = { default.normal, + default.health, + default.health_percentage, + default.flinch_count, + default.break_health, + default.break_health_percentage, + default.break_count, + default.loss_health, + default.loss_health_percentage}; + + customization_menu.displayed_large_monster_UI_parts_filter_types = { current.current_state, + current.default_state}; + + customization_menu.large_monster_UI_parts_filter_types = { default.current_state, + default.default_state}; customization_menu.displayed_ailments_sorting_types = { current.normal, current.buildup, diff --git a/reframework/data/MHR Overlay/languages/en-us.json b/reframework/data/MHR Overlay/languages/en-us.json index 1b95982..224ad5e 100644 --- a/reframework/data/MHR Overlay/languages/en-us.json +++ b/reframework/data/MHR Overlay/languages/en-us.json @@ -83,6 +83,7 @@ "creature_name_label": "Creature Name Label", "crown": "Crown", "crown_thresholds": "Crown Thresholds", + "current_state": "Current State", "current_value": "Current Value", "cutscene": "Cutscene", "damage": "Damage", @@ -91,6 +92,7 @@ "damage_meter_UI": "Damage Meter UI", "damage_percentage_label": "Damage Percentage Label", "damage_value_label": "Damage Value Label", + "default_state": "Default State", "delete": "Delete", "distance": "Distance", "dps": "DPS", @@ -108,6 +110,7 @@ "farthest": "Farthest", "fight_time": "Fight Time", "filter": "Filter", + "filter_mode": "Filter Mode", "first": "First", "first_hit": "First Hit", "flinch_count": "Flinch Count", diff --git a/reframework/data/MHR Overlay/languages/ja-jp.json b/reframework/data/MHR Overlay/languages/ja-jp.json index a3e13dd..3b4a069 100644 --- a/reframework/data/MHR Overlay/languages/ja-jp.json +++ b/reframework/data/MHR Overlay/languages/ja-jp.json @@ -83,6 +83,7 @@ "creature_name_label": "モンスターの名前ラベル", "crown": "王冠", "crown_thresholds": "王冠の閾値", + "current_state": "Current State", "current_value": "Current Value", "cutscene": "Cutscene", "damage": "ダメージ", @@ -91,6 +92,7 @@ "damage_meter_UI": "ダメージメーターUI", "damage_percentage_label": "ダメージ割合(%)ラベル", "damage_value_label": "ダメージラベル", + "default_state": "Default State", "delete": "Delete", "distance": "距離", "dps": "DPS", @@ -108,6 +110,7 @@ "farthest": "Farthest", "fight_time": "戦闘時間", "filter": "フィルター", + "filter_mode": "Filter Mode", "first": "最初", "first_hit": "初撃", "flinch_count": "ひるみ回数", diff --git a/reframework/data/MHR Overlay/languages/ko-kr.json b/reframework/data/MHR Overlay/languages/ko-kr.json index 9c310aa..a09c492 100644 --- a/reframework/data/MHR Overlay/languages/ko-kr.json +++ b/reframework/data/MHR Overlay/languages/ko-kr.json @@ -83,6 +83,7 @@ "creature_name_label": "환경생물 이름 정보", "crown": "금관", "crown_thresholds": "금관 판정값", + "current_state": "Current State", "current_value": "Current Value", "cutscene": "컷신", "damage": "대미지", @@ -91,6 +92,7 @@ "damage_meter_UI": "대미지 미터 UI", "damage_percentage_label": "대미지 비율 정보", "damage_value_label": "대미지 값 정보", + "default_state": "Default State", "delete": "삭제하기", "distance": "간격", "dps": "DPS", @@ -108,6 +110,7 @@ "farthest": "가장 멀리있는", "fight_time": "전투 시간", "filter": "필터", + "filter_mode": "Filter Mode", "first": "맨 앞", "first_hit": "첫 공격", "flinch_count": "경직 횟수", diff --git a/reframework/data/MHR Overlay/languages/ru-ru.json b/reframework/data/MHR Overlay/languages/ru-ru.json index e964d11..41d33d3 100644 --- a/reframework/data/MHR Overlay/languages/ru-ru.json +++ b/reframework/data/MHR Overlay/languages/ru-ru.json @@ -83,6 +83,7 @@ "creature_name_label": "Метка имени существа", "crown": "Корона", "crown_thresholds": "Лимиты корон", + "current_state": "Current State", "current_value": "Current Value", "cutscene": "Катсцена", "damage": "Урон", @@ -91,6 +92,7 @@ "damage_meter_UI": "Интерфейс модуля урона", "damage_percentage_label": "Метка урона в процентах", "damage_value_label": "Метка значений урона", + "default_state": "Default State", "delete": "Удалить", "distance": "Расстояние", "dps": "Урон в секунду", @@ -108,6 +110,7 @@ "farthest": "Самый дальний", "fight_time": "Время в бою", "filter": "Фильтр", + "filter_mode": "Filter Mode", "first": "Первый", "first_hit": "Первый удар", "flinch_count": "Кол-во вздрагиваний", diff --git a/reframework/data/MHR Overlay/languages/zh-cn.json b/reframework/data/MHR Overlay/languages/zh-cn.json index 4ff4aaf..dd82591 100644 --- a/reframework/data/MHR Overlay/languages/zh-cn.json +++ b/reframework/data/MHR Overlay/languages/zh-cn.json @@ -83,6 +83,7 @@ "creature_name_label": "生物名标签", "crown": "皇冠", "crown_thresholds": "皇冠阈值", + "current_state": "Current State", "current_value": "Current Value", "cutscene": "Cutscene", "damage": "伤害", @@ -91,6 +92,7 @@ "damage_meter_UI": "伤害统计UI", "damage_percentage_label": "伤害百分比标签", "damage_value_label": "伤害量标签", + "default_state": "Default State", "delete": "Delete", "distance": "距离", "dps": "DPS", @@ -108,6 +110,7 @@ "farthest": "Farthest", "fight_time": "战斗时间", "filter": "筛选器", + "filter_mode": "Filter Mode", "first": "第一", "first_hit": "第一击", "flinch_count": "胆怯次数", diff --git a/reframework/data/MHR Overlay/languages/zh-tw.json b/reframework/data/MHR Overlay/languages/zh-tw.json index 79bee35..75d676d 100644 --- a/reframework/data/MHR Overlay/languages/zh-tw.json +++ b/reframework/data/MHR Overlay/languages/zh-tw.json @@ -83,6 +83,7 @@ "creature_name_label": "環境生物名稱", "crown": "皇冠", "crown_thresholds": "皇冠的大小判定範圍", + "current_state": "Current State", "current_value": "Current Value", "cutscene": "Cutscene", "damage": "傷害", @@ -91,6 +92,7 @@ "damage_meter_UI": "傷害量計算 UI", "damage_percentage_label": "傷害量百分比", "damage_value_label": "傷害量", + "default_state": "Default State", "delete": "Delete", "distance": "距離", "dps": "DPS", @@ -108,6 +110,7 @@ "farthest": "最遠的", "fight_time": "戰鬥時間", "filter": "篩選器", + "filter_mode": "Filter Mode", "first": "第一", "first_hit": "第一擊", "flinch_count": "膽怯次數",