From e2354eedcc42f0b0f2ef1b58ffd80a385f085023 Mon Sep 17 00:00:00 2001 From: GreenComfyTea Date: Fri, 26 May 2023 13:07:40 +0300 Subject: [PATCH] Move combo types into their respective UI elements --- .../ailment_buildups_customization.lua | 73 +++- .../Customizations/ailments_customization.lua | 27 +- .../UI/Customizations/bar_customization.lua | 100 +++-- .../MHR_Overlay/UI/customization_menu.lua | 356 ++++++++++-------- 4 files changed, 360 insertions(+), 196 deletions(-) diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua index 751757a..9634fb3 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua @@ -47,6 +47,61 @@ local os = os; local ValueType = ValueType; local package = package; +this.ailment_buildups_sorting_types = {}; +this.displayed_ailment_buildups_sorting_types = {}; + +this.highlighted_buildup_bar_types = {}; +this.displayed_highlighted_buildup_bar_types = {}; + +this.buildup_bar_relative_types = {}; +this.displayed_buildup_bar_relative_types = {}; + +function this.init() + local default = language.default_language.customization_menu; + local current = language.current_language.customization_menu; + + this.ailment_buildups_sorting_types = + { + default.normal, + default.buildup, + default.buildup_percentage + }; + + this.displayed_ailment_buildups_sorting_types = + { + current.normal, + current.buildup, + current.buildup_percentage + }; + + this.highlighted_buildup_bar_types = + { + default.me, + default.top_buildup, + default.none + }; + + this.displayed_highlighted_buildup_bar_types = + { + current.me, + current.top_buildup, + current.none + }; + + this.buildup_bar_relative_types = + { + default.total_buildup, + default.top_buildup + }; + + + this.displayed_buildup_bar_relative_types = + { + current.total_buildup, + current.top_buildup + }; +end + function this.draw(cached_config) local changed = false; local config_changed = false; @@ -103,24 +158,24 @@ function this.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.settings) then changed, index = imgui.combo( language.current_language.customization_menu.highlighted_bar, - utils.table.find_index(customization_menu.highlighted_buildup_bar_types, cached_config.settings.highlighted_bar), - customization_menu.displayed_highlighted_buildup_bar_types); + utils.table.find_index(this.highlighted_buildup_bar_types, cached_config.settings.highlighted_bar), + this.displayed_highlighted_buildup_bar_types); config_changed = config_changed or changed; if changed then - cached_config.settings.highlighted_bar = customization_menu.highlighted_buildup_bar_types[index]; + cached_config.settings.highlighted_bar = this.highlighted_buildup_bar_types[index]; end changed, index = imgui.combo( language.current_language.customization_menu.buildup_bars_are_relative_to, - utils.table.find_index(customization_menu.displayed_buildup_bar_relative_types, cached_config.settings.buildup_bar_relative_to), - customization_menu.displayed_buildup_bar_relative_types); + utils.table.find_index(this.displayed_buildup_bar_relative_types, cached_config.settings.buildup_bar_relative_to), + this.displayed_buildup_bar_relative_types); config_changed = config_changed or changed; if changed then - cached_config.settings.buildup_bar_relative_to = customization_menu.displayed_buildup_bar_relative_types[index]; + cached_config.settings.buildup_bar_relative_to = this.displayed_buildup_bar_relative_types[index]; end changed, cached_config.settings.time_limit = imgui.drag_float( @@ -134,13 +189,13 @@ function this.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - utils.table.find_index(customization_menu.ailment_buildups_sorting_types, cached_config.sorting.type), - customization_menu.displayed_ailment_buildups_sorting_types); + utils.table.find_index(this.ailment_buildups_sorting_types, cached_config.sorting.type), + this.displayed_ailment_buildups_sorting_types); config_changed = config_changed or changed; if changed then - cached_config.sorting.type = customization_menu.ailment_buildups_sorting_types[index]; + cached_config.sorting.type = this.ailment_buildups_sorting_types[index]; end changed, cached_config.sorting.reversed_order = imgui.checkbox( diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua index 1535907..64d256d 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua @@ -47,6 +47,27 @@ local os = os; local ValueType = ValueType; local package = package; +this.ailments_sorting_types = {}; +this.displayed_ailments_sorting_types = {}; + + +function this.init() + local default = language.default_language.customization_menu; + local current = language.current_language.customization_menu; + + this.ailments_sorting_types = { + default.normal, + default.buildup, + default.buildup_percentage + }; + + this.displayed_ailments_sorting_types = { + current.normal, + current.buildup, + current.buildup_percentage + }; +end + function this.draw(cached_config) local changed = false; local config_changed = false; @@ -143,13 +164,13 @@ function this.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - utils.table.find_index(customization_menu.ailments_sorting_types, cached_config.sorting.type), - customization_menu.displayed_ailments_sorting_types); + utils.table.find_index(this.ailments_sorting_types, cached_config.sorting.type), + this.displayed_ailments_sorting_types); config_changed = config_changed or changed; if changed then - cached_config.sorting.type = customization_menu.ailments_sorting_types[index]; + cached_config.sorting.type = this.ailments_sorting_types[index]; end changed, cached_config.sorting.reversed_order = imgui.checkbox( diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua index b697262..065df65 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua @@ -46,72 +46,124 @@ local os = os; local ValueType = ValueType; local package = package; +local outline_styles = {}; +local displayed_outline_styles = {}; + +local directions = {}; +local displayed_directions = {}; + +function this.init() + local default = language.default_language.customization_menu; + local current = language.current_language.customization_menu; + + outline_styles = { + default.inside, + default.center, + default.outside + }; + + displayed_outline_styles = { + current.inside, + current.center, + current.outside + }; + + directions = { + default.left_to_right, + default.right_to_left, + default.top_to_bottom, + default.bottom_to_top + }; + + displayed_directions = { + current.left_to_right, + current.right_to_left, + current.top_to_bottom, + current.bottom_to_top + }; +end + function this.draw(bar_name, bar) if bar == nil then return false; end + local cached_language = language.current_language.customization_menu; + local bar_changed = false; local changed = false; local index = 1; if imgui.tree_node(bar_name) then - changed, bar.visibility = imgui.checkbox(language.current_language.customization_menu.visible + changed, bar.visibility = imgui.checkbox(cached_language.visible , bar.visibility); bar_changed = bar_changed or changed; - if imgui.tree_node(language.current_language.customization_menu.offset) then - changed, bar.offset.x = imgui.drag_float(language.current_language.customization_menu.x, + if imgui.tree_node(cached_language.settings) then + local fill_direction_index = utils.table.find_index(directions, bar.settings.fill_direction); + changed, fill_direction_index = imgui.combo(cached_language.fill_direction, fill_direction_index, displayed_directions); + + bar_changed = bar_changed or changed; + + if changed then + bar.settings.fill_direction = directions[fill_direction_index]; + end + + imgui.tree_pop(); + end + + if imgui.tree_node(cached_language.offset) then + changed, bar.offset.x = imgui.drag_float(cached_language.x, bar.offset.x, 0.1, -screen.width, screen.width, "%.1f"); bar_changed = bar_changed or changed; - changed, bar.offset.y = imgui.drag_float(language.current_language.customization_menu.y, + changed, bar.offset.y = imgui.drag_float(cached_language.y, bar.offset.y, 0.1, -screen.height, screen.height, "%.1f"); bar_changed = bar_changed or changed; imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.size) then - changed, bar.size.width = imgui.drag_float(language.current_language.customization_menu.width, + if imgui.tree_node(cached_language.size) then + changed, bar.size.width = imgui.drag_float(cached_language.width, bar.size.width, 0.1, 0, screen.width, "%.1f"); bar_changed = bar_changed or changed; - changed, bar.size.height = imgui.drag_float(language.current_language.customization_menu.height, + changed, bar.size.height = imgui.drag_float(cached_language.height, bar.size.height, 0.1, 0, screen.height, "%.1f"); bar_changed = bar_changed or changed; imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.outline) then - changed, bar.outline.visibility = imgui.checkbox(language.current_language.customization_menu.visible + if imgui.tree_node(cached_language.outline) then + changed, bar.outline.visibility = imgui.checkbox(cached_language.visible , bar.outline.visibility); bar_changed = bar_changed or changed; - changed, bar.outline.thickness = imgui.drag_float(language.current_language.customization_menu.thickness, + changed, bar.outline.thickness = imgui.drag_float(cached_language.thickness, bar.outline.thickness, 0.1, 0, screen.width, "%.1f"); bar_changed = bar_changed or changed; - changed, bar.outline.offset = imgui.drag_float(language.current_language.customization_menu.offset, + changed, bar.outline.offset = imgui.drag_float(cached_language.offset, bar.outline.offset, 0.1, -screen.height, screen.height, "%.1f"); bar_changed = bar_changed or changed; - changed, index = imgui.combo(language.current_language.customization_menu.style, - utils.table.find_index(customization_menu.outline_styles, + changed, index = imgui.combo(cached_language.style, + utils.table.find_index(this.outline_styles, bar.outline.style), - customization_menu.displayed_outline_styles); + this.displayed_outline_styles); bar_changed = bar_changed or changed; if changed then - bar.outline.style = customization_menu.outline_styles[index]; + bar.outline.style = this.outline_styles[index]; end imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.colors) then + if imgui.tree_node(cached_language.colors) then local colors = nil; if bar.colors ~= nil then colors = bar.colors; @@ -119,7 +171,7 @@ function this.draw(bar_name, bar) colors = bar.normal_colors; end - if imgui.tree_node(language.current_language.customization_menu.foreground) then + if imgui.tree_node(cached_language.foreground) then changed, colors.foreground = imgui.color_picker_argb("", colors.foreground, customization_menu.color_picker_flags); bar_changed = bar_changed or changed; @@ -127,7 +179,7 @@ function this.draw(bar_name, bar) imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.background) then + if imgui.tree_node(cached_language.background) then changed, colors.background = imgui.color_picker_argb("", colors.background, customization_menu.color_picker_flags); bar_changed = bar_changed or changed; @@ -135,7 +187,7 @@ function this.draw(bar_name, bar) imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.outline) then + if imgui.tree_node(cached_language.outline) then changed, colors.outline = imgui.color_picker_argb("", colors.outline, customization_menu.color_picker_flags); bar_changed = bar_changed or changed; @@ -144,8 +196,8 @@ function this.draw(bar_name, bar) end if bar.capture_colors ~= nil then - if imgui.tree_node(language.current_language.customization_menu.monster_can_be_captured) then - if imgui.tree_node(language.current_language.customization_menu.foreground) then + if imgui.tree_node(cached_language.monster_can_be_captured) then + if imgui.tree_node(cached_language.foreground) then changed, bar.capture_colors.foreground = imgui.color_picker_argb("", bar.capture_colors.foreground , @@ -155,7 +207,7 @@ function this.draw(bar_name, bar) imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.background) then + if imgui.tree_node(cached_language.background) then changed, bar.capture_colors.background = imgui.color_picker_argb("", bar.capture_colors.background , @@ -165,7 +217,7 @@ function this.draw(bar_name, bar) imgui.tree_pop(); end - if imgui.tree_node(language.current_language.customization_menu.outline) then + if imgui.tree_node(cached_language.outline) then changed, bar.capture_colors.outline = imgui.color_picker_argb("", bar.capture_colors.outline , @@ -182,7 +234,7 @@ function this.draw(bar_name, bar) imgui.tree_pop(); end - changed = line_customization.draw(language.current_language.customization_menu.capture_line, bar.capture_line); + changed = line_customization.draw(cached_language.capture_line, bar.capture_line); bar_changed = bar_changed or changed; imgui.tree_pop(); diff --git a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua index 100aa03..528172a 100644 --- a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua +++ b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua @@ -73,51 +73,44 @@ this.window_flags = 0x10120; this.color_picker_flags = 327680; this.decimal_input_flags = 33; -this.displayed_orientation_types = {}; -this.displayed_anchor_types = {}; -this.displayed_outline_styles = {}; - -this.displayed_monster_UI_sorting_types = {}; -this.displayed_large_monster_UI_parts_sorting_types = {}; -this.displayed_large_monster_UI_parts_filter_types = {}; -this.displayed_ailments_sorting_types = {}; -this.displayed_ailment_buildups_sorting_types = {}; -this.displayed_highlighted_buildup_bar_types = {}; -this.displayed_buildup_bar_relative_types = {}; -this.displayed_buff_UI_sorting_types = {}; - -this.displayed_damage_meter_UI_highlighted_entity_types = {}; -this.displayed_damage_meter_UI_damage_bar_relative_types = {}; -this.displayed_damage_meter_UI_my_damage_bar_location_types = {}; -this.displayed_damage_meter_UI_total_damage_location_types = {}; -this.displayed_damage_meter_UI_sorting_types = {}; -this.displayed_damage_meter_UI_dps_modes = {}; - -this.displayed_auto_highlight_modes = {}; - this.orientation_types = {}; +this.displayed_orientation_types = {}; + this.anchor_types = {}; -this.outline_styles = {}; +this.displayed_anchor_types = {}; this.monster_UI_sorting_types = {}; +this.displayed_monster_UI_sorting_types = {}; + this.large_monster_UI_parts_sorting_types = {}; +this.displayed_large_monster_UI_parts_sorting_types = {}; + this.large_monster_UI_parts_filter_types = {}; -this.ailments_sorting_types = {}; -this.ailment_buildups_sorting_types = {}; -this.highlighted_buildup_bar_types = {}; -this.buildup_bar_relative_types = {}; +this.displayed_large_monster_UI_parts_filter_types = {}; + this.buff_UI_sorting_types = {}; +this.displayed_buff_UI_sorting_types = {}; this.damage_meter_UI_highlighted_entity_types = {}; +this.displayed_damage_meter_UI_highlighted_entity_types = {}; + this.damage_meter_UI_damage_bar_relative_types = {}; +this.displayed_damage_meter_UI_damage_bar_relative_types = {}; + this.damage_meter_UI_my_damage_bar_location_types = {}; +this.displayed_damage_meter_UI_my_damage_bar_location_types = {}; + this.damage_meter_UI_total_damage_location_types = {}; +this.displayed_damage_meter_UI_total_damage_location_types = {}; + this.damage_meter_UI_sorting_types = {}; +this.displayed_damage_meter_UI_sorting_types = {}; + this.damage_meter_UI_dps_modes = {}; +this.displayed_damage_meter_UI_dps_modes = {}; this.auto_highlight_modes = {}; - - +this.displayed_auto_highlight_modes = {}; this.fonts = {"Arial", "Arial Black", "Bahnschrift", "Calibri", "Cambria", "Cambria Math", "Candara", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New", "Ebrima", @@ -170,165 +163,208 @@ function this.reload_font(pop_push) end function this.init() - local current = language.current_language.customization_menu; local default = language.default_language.customization_menu; + local current = language.current_language.customization_menu; - this.displayed_orientation_types = { current.horizontal, - current.vertical}; + bar_customization.init(); + ailments_customization.init(); + ailment_buildups_customization.init(); - this.orientation_types = { default.horizontal, - default.vertical}; + this.orientation_types = + { + default.horizontal, + default.vertical + }; - this.displayed_anchor_types = { current.top_left, - current.top_right, - current.bottom_left, - current.bottom_right}; + this.displayed_orientation_types = + { + current.horizontal, + current.vertical + }; - - this.anchor_types = { default.top_left, - default.top_right, - default.bottom_left, - default.bottom_right}; + this.anchor_types = + { + default.top_left, + default.top_right, + default.bottom_left, + default.bottom_right + }; - this.displayed_outline_styles = { current.inside, - current.center, - current.outside}; + this.displayed_anchor_types = + { + current.top_left, + current.top_right, + current.bottom_left, + current.bottom_right + }; - this.outline_styles = { default.inside, - default.center, - default.outside}; + this.monster_UI_sorting_types = + { + default.normal, + default.health, + default.health_percentage, + default.distance + }; - this.displayed_monster_UI_sorting_types = { current.normal, - current.health, - current.health_percentage, - current.distance}; + this.displayed_monster_UI_sorting_types = + { + current.normal, + current.health, + current.health_percentage, + current.distance + }; - this.monster_UI_sorting_types = { default.normal, - default.health, - default.health_percentage, - default.distance}; + this.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 + }; - this.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}; + this.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 + }; - this.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}; + this.large_monster_UI_parts_filter_types = + { + default.current_state, + default.default_state + }; - this.displayed_large_monster_UI_parts_filter_types = { current.current_state, - current.default_state}; + this.displayed_large_monster_UI_parts_filter_types = + { + current.current_state, + current.default_state + }; - this.large_monster_UI_parts_filter_types = { default.current_state, - default.default_state}; + this.buff_UI_sorting_types = + { + default.name, + default.timer, + default.duration + }; - this.displayed_ailments_sorting_types = { current.normal, - current.buildup, - current.buildup_percentage}; + this.displayed_buff_UI_sorting_types = + { + current.name, + current.timer, + current.duration + }; - this.ailments_sorting_types = { default.normal, - default.buildup, - default.buildup_percentage}; + this.damage_meter_UI_highlighted_entity_types = + { + default.top_damage, + default.top_dps, + default.none + }; - this.displayed_buff_UI_sorting_types = { current.name, - current.timer, - current.duration}; + this.displayed_damage_meter_UI_highlighted_entity_types = + { + current.top_damage, + current.top_dps, + current.none + }; - this.buff_UI_sorting_types = { default.name, - default.timer, - default.duration}; + this.damage_meter_UI_damage_bar_relative_types = + { + default.total_damage, + default.top_damage + }; - this.displayed_ailment_buildups_sorting_types = { current.normal, - current.buildup, - current.buildup_percentage}; + this.displayed_damage_meter_UI_damage_bar_relative_types = + { + current.total_damage, + current.top_damage + }; - this.ailment_buildups_sorting_types = { default.normal, - default.buildup, - default.buildup_percentage}; - - this.displayed_highlighted_buildup_bar_types = { current.me, - current.top_buildup, - current.none}; - - this.highlighted_buildup_bar_types = { default.me, - default.top_buildup, - default.none}; - - this.displayed_buildup_bar_relative_types = { current.total_buildup, - current.top_buildup}; - - this.buildup_bar_relative_types = { default.total_buildup, - default.top_buildup}; - - this.displayed_damage_meter_UI_highlighted_entity_types = { current.top_damage, - current.top_dps, - current.none}; - - this.damage_meter_UI_highlighted_entity_types = { default.top_damage, - default.top_dps, - default.none}; - - this.displayed_damage_meter_UI_damage_bar_relative_types = { current.total_damage, - current.top_damage}; - - this.damage_meter_UI_damage_bar_relative_types = { default.total_damage, - default.top_damage}; + this.damage_meter_UI_my_damage_bar_location_types = + { + default.normal, + default.first, + default.last + }; - this.displayed_damage_meter_UI_my_damage_bar_location_types = { current.normal, - current.first, - current.last}; + this.displayed_damage_meter_UI_my_damage_bar_location_types = + { + current.normal, + current.first, + current.last + }; - this.damage_meter_UI_my_damage_bar_location_types = { default.normal, - default.first, - default.last}; + this.damage_meter_UI_total_damage_location_types = + { + default.first, + default.last + }; - this.displayed_damage_meter_UI_total_damage_location_types = { current.first, - current.last}; + this.displayed_damage_meter_UI_total_damage_location_types = + { + current.first, + current.last + }; - this.damage_meter_UI_total_damage_location_types = { default.first, - default.last}; + this.damage_meter_UI_sorting_types = + { + default.normal, + default.damage, + default.dps + }; - this.displayed_damage_meter_UI_sorting_types = { current.normal, - current.damage, - current.dps}; + this.displayed_damage_meter_UI_sorting_types = + { + current.normal, + current.damage, + current.dps + }; - this.damage_meter_UI_sorting_types = { default.normal, - default.damage, - default.dps}; + this.damage_meter_UI_dps_modes = + { + default.first_hit, + default.quest_time, + default.join_time + }; - this.displayed_damage_meter_UI_dps_modes = { current.first_hit, - current.quest_time, - current.join_time}; + this.displayed_damage_meter_UI_dps_modes = + { + current.first_hit, + current.quest_time, + current.join_time + }; - this.damage_meter_UI_dps_modes = { default.first_hit, - default.quest_time, - default.join_time}; + this.auto_highlight_modes = + { + default.closest, + default.farthest, + default.lowest_health, + default.highest_health, + default.lowest_health_percentage, + default.highest_health_percentage + }; - this.displayed_auto_highlight_modes = { current.closest, - current.farthest, - current.lowest_health, - current.highest_health, - current.lowest_health_percentage, - current.highest_health_percentage}; - - this.auto_highlight_modes = { default.closest, - default.farthest, - default.lowest_health, - default.highest_health, - default.lowest_health_percentage, - default.highest_health_percentage}; + this.displayed_auto_highlight_modes = + { + current.closest, + current.farthest, + current.lowest_health, + current.highest_health, + current.lowest_health_percentage, + current.highest_health_percentage + }; end function this.draw()