diff --git a/reframework/autorun/MHR_Overlay.lua b/reframework/autorun/MHR_Overlay.lua index f26fdde..fbf80b8 100644 --- a/reframework/autorun/MHR_Overlay.lua +++ b/reframework/autorun/MHR_Overlay.lua @@ -43,6 +43,8 @@ local table_helpers = require("MHR_Overlay.Misc.table_helpers"); local unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers"); local part_names = require("MHR_Overlay.Misc.part_names"); +--local buffs = require("MHR_Overlay.Buffs.buffs"); + local players = require("MHR_Overlay.Damage_Meter.players"); local non_players = require("MHR_Overlay.Damage_Meter.non_players"); local damage_hook = require("MHR_Overlay.Damage_Meter.damage_hook"); @@ -63,6 +65,7 @@ local large_monster_UI = require("MHR_Overlay.UI.Modules.large_monster_UI"); local small_monster_UI = require("MHR_Overlay.UI.Modules.small_monster_UI"); local time_UI = require("MHR_Overlay.UI.Modules.time_UI"); local env_creature_UI = require("MHR_Overlay.UI.Modules.env_creature_UI"); +--local buff_UI = require("MHR_Overlay.UI.Modules.buff_UI"); local body_part_UI_entity = require("MHR_Overlay.UI.UI_Entities.body_part_UI_entity"); local damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity"); @@ -71,6 +74,7 @@ local stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity" local rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity"); local ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity"); local ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity"); +--local buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); local customization_menu = require("MHR_Overlay.UI.customization_menu"); local label_customization = require("MHR_Overlay.UI.Customizations.label_customization"); @@ -108,6 +112,9 @@ rage_UI_entity.init_module(); ailment_UI_entity.init_module(); ailment_buildup_UI_entity.init_module(); body_part_UI_entity.init_module(); +--buff_UI_entity.init_module(); + +--buffs.init_module(); damage_hook.init_module(); players.init_module(); @@ -148,6 +155,7 @@ large_monster_UI.init_module(); small_monster_UI.init_module(); time_UI.init_module(); env_creature_UI.init_module(); +--buff_UI.init_module(); keyboard.init_module(); @@ -162,7 +170,7 @@ local function draw_modules(module_visibility_config, flow_state_name) if module_visibility_config.small_monster_UI and config.current_config.small_monster_UI.enabled then local success = pcall(small_monster_UI.draw); if not success then - customization_menu.status = string.format("[%s] Small monster drawing function threw an exception", flow_state_name); + customization_menu.status = string.format("[%s] Small Monster UI Drawing Function threw an Exception", flow_state_name); end end @@ -178,30 +186,37 @@ local function draw_modules(module_visibility_config, flow_state_name) if dynamic_enabled or static_enabled or highlighted_enabled then local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled); if not success then - customization_menu.status = string.format("[%s] Large Monster drawing function threw an exception", flow_state_name); + customization_menu.status = string.format("[%s] Large Monster UI Drawing Function threw an Exception", flow_state_name); end end if config.current_config.time_UI.enabled and module_visibility_config.time_UI then local success = pcall(time_UI.draw); if not success then - customization_menu.status = string.format("[%s] Time Drawing function threw an exception", flow_state_name); + customization_menu.status = string.format("[%s] Time UI Drawing Function threw an Exception", flow_state_name); end end if config.current_config.damage_meter_UI.enabled and module_visibility_config.damage_meter_UI then local success = pcall(damage_meter_UI.draw); if not success then - customization_menu.status = string.format("[%s] Damage Meter drawing function threw an exception", flow_state_name); + customization_menu.status = string.format("[%s] Damage Meter UI Drawing Function threw an Exception", flow_state_name); end end if config.current_config.endemic_life_UI.enabled and module_visibility_config.endemic_life_UI then local success = pcall(env_creature_UI.draw); if not success then - customization_menu.status = string.format("[%s] Endemic Life drawing function threw an exception", flow_state_name); + customization_menu.status = string.format("[%s] Endemic Life UI Drawing Function threw an Exception", flow_state_name); end end + + --[[if config.current_config.buff_UI.enabled and module_visibility_config.buff_UI then + local success = truepcall(buff_UI.draw); + if not success then + customization_menu.status = string.format("[%s] Buff UI Drawing Function threw an Exception", flow_state_name); + end + end]] end local function main_loop() @@ -225,24 +240,32 @@ local function main_loop() if dynamic_enabled or static_enabled or highlighted_enabled then local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled); if not success then - customization_menu.status = "[In Training Area] Large monster drawing function threw an exception"; + customization_menu.status = "[In Training Area] Large Monster UI Drawing Function threw an Exception"; end end if config.current_config.damage_meter_UI.enabled and module_visibility_config.damage_meter_UI then local success = pcall(damage_meter_UI.draw); if not success then - customization_menu.status = "[In Training Area] Damage meter drawing function threw an exception"; + customization_menu.status = "[In Training Area] Damage Meter UI Drawing Function threw an Exception"; end end if config.current_config.endemic_life_UI.enabled and module_visibility_config.endemic_life_UI then local success = pcall(env_creature_UI.draw); if not success then - customization_menu.status = "[In Training Area] Endemic life drawing function threw an exception"; + customization_menu.status = "[In Training Area] Endemic Life UI Drawing Function threw an Exception"; end end + --[[if config.current_config.buff_UI.enabled and module_visibility_config.buff_UI then + local success = pcall(buff_UI.draw); + if not success then + customization_menu.status = "[In Training Area] Buff UI Drawing Function threw an Exception"; + end + end]] + + elseif quest_status.flow_state == quest_status.flow_states.CUTSCENE then draw_modules(config.current_config.global_settings.module_visibility.cutscene, "Cutscene"); elseif quest_status.flow_state == quest_status.flow_states.LOADING_QUEST then diff --git a/reframework/autorun/MHR_Overlay/Buffs/buffs.lua b/reframework/autorun/MHR_Overlay/Buffs/buffs.lua new file mode 100644 index 0000000..318bb41 --- /dev/null +++ b/reframework/autorun/MHR_Overlay/Buffs/buffs.lua @@ -0,0 +1,105 @@ +local buffs = {}; + +local buff_UI_entity; +local config; + +local sdk = sdk; +local tostring = tostring; +local pairs = pairs; +local ipairs = ipairs; +local tonumber = tonumber; +local require = require; +local pcall = pcall; +local table = table; +local string = string; +local Vector3f = Vector3f; +local d2d = d2d; +local math = math; +local json = json; +local log = log; +local fs = fs; +local next = next; +local type = type; +local setmetatable = setmetatable; +local getmetatable = getmetatable; +local assert = assert; +local select = select; +local coroutine = coroutine; +local utf8 = utf8; +local re = re; +local imgui = imgui; +local draw = draw; +local Vector2f = Vector2f; +local reframework = reframework; + +buffs.list = {}; + +function buffs.new(name) + local buff = {}; + + buff.name = name; + buff.timer = 0; + buff.duration = 0; + + buff.is_active = true; + + buff.timer_percentage = 0; + + buff.minutes_left = 0; + buff.seconds_left = 0; + + buff.is_infinite = false; + + buffs.init_UI(buff); + + return buff; +end + +function buffs.init_buffs() + buffs.list = {}; +end + +function buffs.init_UI(buff) + local cached_config = config.current_config.buff_UI; + buff.buff_UI = buff_UI_entity.new(cached_config.bar, cached_config.name_label, cached_config.timer_label); +end + +function buffs.draw(buff, buff_UI, position_on_screen, opacity_scale) + buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale); +end + +function buffs.init_module() + config = require("MHR_Overlay.Misc.config"); + buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); + + + local buff = buffs.new("Enviroment Damage Negated"); + buff.duration = 90; + buff.timer = 65; + buff.timer_percentage = 0.66; + buff.minutes_left = 1; + buff.seconds_left = 5 + + buffs.list["Enviroment Damage Negated"] = buff; + + local buff = buffs.new("Sharpness Loss Reduced"); + buff.duration = 120; + buff.timer = 70; + buff.timer_percentage = 0.583; + buff.minutes_left = 1; + buff.seconds_left = 10 + + buffs.list["Sharpness Loss Reduced"] = buff; + + local buff = buffs.new("Sharpness Loss Reduced 2"); + buff.duration = 120; + buff.timer = 70; + buff.timer_percentage = 0.583; + buff.minutes_left = 1; + buff.seconds_left = 10 + buff.is_infinite = true; + + buffs.list["Sharpness Loss Reduced 2"] = buff; +end + +return buffs; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Misc/config.lua b/reframework/autorun/MHR_Overlay/Misc/config.lua index 485b38e..065fef7 100644 --- a/reframework/autorun/MHR_Overlay/Misc/config.lua +++ b/reframework/autorun/MHR_Overlay/Misc/config.lua @@ -85,7 +85,8 @@ function config.init_default() large_monster_static_UI = true, large_monster_highlighted_UI = true, damage_meter_UI = true, - endemic_life_UI = true + endemic_life_UI = true, + --buff_UI = true }, cutscene = { @@ -95,7 +96,8 @@ function config.init_default() large_monster_highlighted_UI = false, time_UI = false, damage_meter_UI = false, - endemic_life_UI = false + endemic_life_UI = false, + --buff_UI = false }, loading_quest = { @@ -105,7 +107,8 @@ function config.init_default() large_monster_highlighted_UI = false, time_UI = false, damage_meter_UI = false, - endemic_life_UI = false + endemic_life_UI = false, + --buff_UI = false }, quest_start_animation = { @@ -115,7 +118,8 @@ function config.init_default() large_monster_highlighted_UI = true, time_UI = true, damage_meter_UI = true, - endemic_life_UI = true + endemic_life_UI = true, + --buff_UI = true }, playing_quest = { @@ -125,7 +129,8 @@ function config.init_default() large_monster_highlighted_UI = true, time_UI = true, damage_meter_UI = true, - endemic_life_UI = true + endemic_life_UI = true, + --buff_UI = true }, killcam = { @@ -135,7 +140,8 @@ function config.init_default() large_monster_highlighted_UI = true, time_UI = true, damage_meter_UI = true, - endemic_life_UI = true + endemic_life_UI = true, + --buff_UI = true }, quest_end_timer = { @@ -145,7 +151,8 @@ function config.init_default() large_monster_highlighted_UI = true, time_UI = true, damage_meter_UI = true, - endemic_life_UI = true + endemic_life_UI = true, + --buff_UI = true }, quest_end_animation = { @@ -155,7 +162,8 @@ function config.init_default() large_monster_highlighted_UI = false, time_UI = false, damage_meter_UI = false, - endemic_life_UI = false + endemic_life_UI = false, + --buff_UI = false }, quest_end_screen = { @@ -165,7 +173,8 @@ function config.init_default() large_monster_highlighted_UI = false, time_UI = false, damage_meter_UI = false, - endemic_life_UI = false + endemic_life_UI = false, + --buff_UI = false }, reward_screen = { @@ -175,7 +184,8 @@ function config.init_default() large_monster_highlighted_UI = true, time_UI = true, damage_meter_UI = true, - endemic_life_UI = false + endemic_life_UI = false, + --buff_UI = false }, summary_screen = { @@ -185,7 +195,8 @@ function config.init_default() large_monster_highlighted_UI = true, time_UI = true, damage_meter_UI = true, - endemic_life_UI = false + endemic_life_UI = false, + --buff_UI = false }, }, @@ -5386,7 +5397,99 @@ function config.init_default() color = 0xFF000000 } } - } + }, + + --[[buff_UI = { + enabled = true, + + settings = { + hide_bar_for_infinite_buffs = true, + hide_timer_for_infinite_buffs = true, + orientation = "Vertical", -- "Vertical" or "Horizontal" + }, + + spacing = { + x = 260, + y = -24 + }, + + position = { + x = 10, + y = 30, + -- Possible values: "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" + anchor = "Bottom-Left" + }, + + sorting = { + type = "Name", -- "Name" or "Timer" or "Duration" + reversed_order = true + }, + + name_label = { + visibility = true, + + text = "%s", + offset = { + x = 5, + y = 0 + }, + color = 0xFFFEFF88, + + shadow = { + visibility = true, + offset = { + x = 1, + y = 1 + }, + color = 0xFF000000 + } + }, + + timer_label = { + visibility = true, + text = "%2.0f:%02.0f", + offset = { + x = 200, + y = 0 + }, + color = 0xFFFFBF81, + + shadow = { + visibility = true, + offset = { + x = 1, + y = 1 + }, + color = 0xFF000000 + } + }, + + bar = { + visibility = true, + offset = { + x = 0, + y = 17 + }, + + size = { + width = 240, + height = 5 + }, + + outline = { + visibility = true, + thickness = 1, + offset = 0, + style = "Center" + }, + + colors = { + foreground = 0xA76FD456, + background = 0xA7000000, + outline = 0xC0000000 + } + } + }]] }; end diff --git a/reframework/autorun/MHR_Overlay/Misc/language.lua b/reframework/autorun/MHR_Overlay/Misc/language.lua index 2ce34d6..9f1ad45 100644 --- a/reframework/autorun/MHR_Overlay/Misc/language.lua +++ b/reframework/autorun/MHR_Overlay/Misc/language.lua @@ -487,7 +487,13 @@ language.default_language = { new = "New", reset = "Reset", - highlighted = "Highlighted" + highlighted = "Highlighted", + + buff_UI = "Buff UI", + timer = "Timer", + duration = "Duration", + hide_bar_for_infinite_buffs = "Hide Bar for infinite Buffs", + hide_timer_for_infinite_buffs = "Hide Timer for infinite Buffs", } }; diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua index 39a7108..8a0a405 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua @@ -90,6 +90,12 @@ function module_visibility_customization.draw(cached_config) config_changed = config_changed or changed; + --[[changed, cached_config.buff_UI = imgui.checkbox( + language.current_language.customization_menu.buff_UI, + cached_config.buff_UI); + + config_changed = config_changed or changed;]] + return config_changed; end diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua new file mode 100644 index 0000000..308e2e3 --- /dev/null +++ b/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua @@ -0,0 +1,126 @@ +local buff_UI = {}; + +local buff_UI_entity; +local config; +local buffs; +local screen; +local table_helpers; + +local sdk = sdk; +local tostring = tostring; +local pairs = pairs; +local ipairs = ipairs; +local tonumber = tonumber; +local require = require; +local pcall = pcall; +local table = table; +local string = string; +local Vector3f = Vector3f; +local d2d = d2d; +local math = math; +local json = json; +local log = log; +local fs = fs; +local next = next; +local type = type; +local setmetatable = setmetatable; +local getmetatable = getmetatable; +local assert = assert; +local select = select; +local coroutine = coroutine; +local utf8 = utf8; +local re = re; +local imgui = imgui; +local draw = draw; +local Vector2f = Vector2f; +local reframework = reframework; + +function buff_UI.draw() + local cached_config = config.current_config.buff_UI; + local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; + + local displayed_buffs = {}; + + for _, buff in pairs(buffs.list) do + + if not buff.is_active then + goto continue + end + + table.insert(displayed_buffs, buff); + + ::continue:: + end + + -- sort + if cached_config.sorting.type == "Name" then + if cached_config.sorting.reversed_order then + table.sort(displayed_buffs, function(left, right) + return left.name > right.name; + end); + else + table.sort(displayed_buffs, function(left, right) + return left.name < right.name; + end); + end + elseif cached_config.sorting.type == "Timer" then + if cached_config.sorting.reversed_order then + table.sort(displayed_buffs, function(left, right) + return left.timer > right.timer; + end); + else + table.sort(displayed_buffs, function(left, right) + return left.timer < right.timer; + end); + end + else + if cached_config.sorting.reversed_order then + table.sort(displayed_buffs, function(left, right) + return left.duration > right.duration; + end); + else + table.sort(displayed_buffs, function(left, right) + return left.duration < right.duration; + end); + end + end + + + + local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position); + + -- draw + for _, buff in ipairs(displayed_buffs) do + + if not buff.is_active then + goto continue2 + end + + buffs.draw(buff, buff.buff_UI, position_on_screen, 1); + + if cached_config.settings.orientation == "Horizontal" then + position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier; + else + position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier; + end + + ::continue2:: + end +end + +function buff_UI.init_module() + config = require("MHR_Overlay.Misc.config"); + buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); + buffs = require("MHR_Overlay.Buffs.buffs"); + --singletons = require("MHR_Overlay.Game_Handler.singletons"); + table_helpers = require("MHR_Overlay.Misc.table_helpers"); + config = require("MHR_Overlay.Misc.config"); + --customization_menu = require("MHR_Overlay.UI.customization_menu"); + --players = require("MHR_Overlay.Damage_Meter.players"); + --non_players = require("MHR_Overlay.Damage_Meter.non_players"); + --quest_status = require("MHR_Overlay.Game_Handler.quest_status"); + screen = require("MHR_Overlay.Game_Handler.screen"); + --drawing = require("MHR_Overlay.UI.drawing"); +end + +return buff_UI; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua new file mode 100644 index 0000000..476d5e1 --- /dev/null +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua @@ -0,0 +1,88 @@ +local buff_UI_entity = {}; + +local config; +local table_helpers; +local drawing; +local language; + +local sdk = sdk; +local tostring = tostring; +local pairs = pairs; +local ipairs = ipairs; +local tonumber = tonumber; +local require = require; +local pcall = pcall; +local table = table; +local string = string; +local Vector3f = Vector3f; +local d2d = d2d; +local math = math; +local json = json; +local log = log; +local fs = fs; +local next = next; +local type = type; +local setmetatable = setmetatable; +local getmetatable = getmetatable; +local assert = assert; +local select = select; +local coroutine = coroutine; +local utf8 = utf8; +local re = re; +local imgui = imgui; +local draw = draw; +local Vector2f = Vector2f; +local reframework = reframework; + +function buff_UI_entity.new(bar, name_label, timer_label) + local entity = {}; + + local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; + + --entity.visibility = visibility; + entity.bar = table_helpers.deep_copy(bar); + entity.name_label = table_helpers.deep_copy(name_label); + entity.timer_label = table_helpers.deep_copy(timer_label); + + entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; + entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier; + entity.bar.size.width = entity.bar.size.width * global_scale_modifier; + entity.bar.size.height = entity.bar.size.height * global_scale_modifier; + entity.bar.outline.thickness = entity.bar.outline.thickness * global_scale_modifier; + entity.bar.outline.offset = entity.bar.outline.offset * global_scale_modifier; + + entity.name_label.offset.x = entity.name_label.offset.x * global_scale_modifier; + entity.name_label.offset.y = entity.name_label.offset.y * global_scale_modifier; + + entity.timer_label.offset.x = entity.timer_label.offset.x * global_scale_modifier; + entity.timer_label.offset.y = entity.timer_label.offset.y * global_scale_modifier; + + return entity; +end + +function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale) + local cached_config = config.current_config.buff_UI; + + if not buff.is_infinite then + drawing.draw_bar(buff_UI.bar, position_on_screen, opacity_scale, buff.timer_percentage); + elseif not cached_config.settings.hide_bar_for_infinite_buffs then + drawing.draw_bar(buff_UI.bar, position_on_screen, opacity_scale, 1); + end + + drawing.draw_label(buff_UI.name_label, position_on_screen, opacity_scale, buff.name); + + if not buff.is_infinite then + drawing.draw_label(buff_UI.timer_label, position_on_screen, opacity_scale, buff.minutes_left, buff.seconds_left); + elseif not cached_config.settings.hide_timer_for_infinite_buffs then + drawing.draw_label(buff_UI.timer_label, position_on_screen, opacity_scale, 0, 0); + end +end + +function buff_UI_entity.init_module() + table_helpers = require("MHR_Overlay.Misc.table_helpers"); + drawing = require("MHR_Overlay.UI.drawing"); + config = require("MHR_Overlay.Misc.config"); + language = require("MHR_Overlay.Misc.language"); +end + +return buff_UI_entity; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua index a180757..b69e6e9 100644 --- a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua +++ b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua @@ -13,6 +13,7 @@ local time_UI; local keyboard; local non_players; local quest_status; +local buffs; local label_customization; local bar_customization; @@ -79,6 +80,7 @@ customization_menu.displayed_ailments_sorting_types = {}; customization_menu.displayed_ailment_buildups_sorting_types = {}; customization_menu.displayed_highlighted_buildup_bar_types = {}; customization_menu.displayed_buildup_bar_relative_types = {}; +customization_menu.displayed_buff_UI_sorting_types = {}; customization_menu.displayed_damage_meter_UI_highlighted_entity_types = {}; customization_menu.displayed_damage_meter_UI_damage_bar_relative_types = {}; @@ -98,6 +100,7 @@ customization_menu.ailments_sorting_types = {}; customization_menu.ailment_buildups_sorting_types = {}; customization_menu.highlighted_buildup_bar_types = {}; customization_menu.buildup_bar_relative_types = {}; +customization_menu.buff_UI_sorting_types = {}; customization_menu.damage_meter_UI_highlighted_entity_types = {}; customization_menu.damage_meter_UI_damage_bar_relative_types = {}; @@ -108,6 +111,8 @@ customization_menu.damage_meter_UI_dps_modes = {}; customization_menu.auto_highlight_modes = {}; + + customization_menu.fonts = {"Arial", "Arial Black", "Bahnschrift", "Calibri", "Cambria", "Cambria Math", "Candara", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New", "Ebrima", "Franklin Gothic Medium", "Gabriola", "Gadugi", "Georgia", "HoloLens MDL2 Assets", "Impact", @@ -145,136 +150,159 @@ function customization_menu.reload_font(pop_push) end function customization_menu.init() - customization_menu.displayed_orientation_types = {language.current_language.customization_menu.horizontal, - language.current_language.customization_menu.vertical}; - customization_menu.displayed_anchor_types = {language.current_language.customization_menu.top_left, - language.current_language.customization_menu.top_right, - language.current_language.customization_menu.bottom_left, - language.current_language.customization_menu.bottom_right}; + local current = language.current_language.customization_menu; + local default = language.default_language.customization_menu; - customization_menu.displayed_outline_styles = {language.current_language.customization_menu.inside, - language.current_language.customization_menu.center, - language.current_language.customization_menu.outside}; - customization_menu.displayed_monster_UI_sorting_types = {language.current_language.customization_menu.normal, - language.current_language.customization_menu.health, - language.current_language.customization_menu.health_percentage, - language.current_language.customization_menu.distance}; + customization_menu.displayed_orientation_types = { current.horizontal, + current.vertical}; - customization_menu.displayed_monster_UI_parts_sorting_types = - {language.current_language.customization_menu.normal, language.current_language.customization_menu.health, - language.current_language.customization_menu.health_percentage, - language.current_language.customization_menu.flinch_count, language.current_language.customization_menu.break_health, - language.current_language.customization_menu.break_health_percentage, - language.current_language.customization_menu.break_count, language.current_language.customization_menu.loss_health, - language.current_language.customization_menu.loss_health_percentage}; + customization_menu.orientation_types = { default.horizontal, + default.vertical}; - customization_menu.displayed_ailments_sorting_types = {language.current_language.customization_menu.normal, - language.current_language.customization_menu.buildup, - language.current_language.customization_menu.buildup_percentage}; - customization_menu.displayed_ailment_buildups_sorting_types = - {language.current_language.customization_menu.normal, language.current_language.customization_menu.buildup, - language.current_language.customization_menu.buildup_percentage}; - customization_menu.displayed_highlighted_buildup_bar_types = - {language.current_language.customization_menu.me, language.current_language.customization_menu.top_buildup, - language.current_language.customization_menu.none}; + customization_menu.displayed_anchor_types = { current.top_left, + current.top_right, + current.bottom_left, + current.bottom_right}; - customization_menu.displayed_buildup_bar_relative_types = {language.current_language.customization_menu.total_buildup, - language.current_language.customization_menu.top_buildup}; - customization_menu.displayed_damage_meter_UI_highlighted_entity_types = - {language.current_language.customization_menu.top_damage, - language.current_language.customization_menu.top_dps, language.current_language.customization_menu.none}; + + customization_menu.anchor_types = { default.top_left, + default.top_right, + default.bottom_left, + default.bottom_right}; - customization_menu.displayed_damage_meter_UI_damage_bar_relative_types = - {language.current_language.customization_menu.total_damage, language.current_language.customization_menu.top_damage}; + customization_menu.displayed_outline_styles = { current.inside, + current.center, + current.outside}; + + customization_menu.outline_styles = { default.inside, + default.center, + default.outside}; + + customization_menu.displayed_monster_UI_sorting_types = { current.normal, + current.health, + current.health_percentage, + current.distance}; + + customization_menu.monster_UI_sorting_types = { default.normal, + default.health, + 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.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_ailments_sorting_types = { current.normal, + current.buildup, + current.buildup_percentage}; + + customization_menu.ailments_sorting_types = { default.normal, + default.buildup, + default.buildup_percentage}; + + customization_menu.displayed_buff_UI_sorting_types = { current.name, + current.timer, + current.duration}; + + customization_menu.buff_UI_sorting_types = { default.name, + default.timer, + default.duration}; + + customization_menu.displayed_ailment_buildups_sorting_types = { current.normal, + current.buildup, + current.buildup_percentage}; + + customization_menu.ailment_buildups_sorting_types = { default.normal, + default.buildup, + default.buildup_percentage}; + + customization_menu.displayed_highlighted_buildup_bar_types = { current.me, + current.top_buildup, + current.none}; + + customization_menu.highlighted_buildup_bar_types = { default.me, + default.top_buildup, + default.none}; + + customization_menu.displayed_buildup_bar_relative_types = { current.total_buildup, + current.top_buildup}; + + customization_menu.buildup_bar_relative_types = { default.total_buildup, + default.top_buildup}; + + customization_menu.displayed_damage_meter_UI_highlighted_entity_types = { current.top_damage, + current.top_dps, + current.none}; + + customization_menu.damage_meter_UI_highlighted_entity_types = { default.top_damage, + default.top_dps, + default.none}; + + customization_menu.displayed_damage_meter_UI_damage_bar_relative_types = { current.total_damage, + current.top_damage}; + + customization_menu.damage_meter_UI_damage_bar_relative_types = { default.total_damage, + default.top_damage}; - customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types = {language.current_language - .customization_menu.normal, language.current_language.customization_menu.first, - language.current_language - .customization_menu.last}; + customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types = { current.normal, + current.first, + current.last}; - customization_menu.displayed_damage_meter_UI_total_damage_location_types = { - language.current_language.customization_menu.first, - language.current_language.customization_menu.last}; + customization_menu.damage_meter_UI_my_damage_bar_location_types = { default.normal, + default.first, + default.last}; - customization_menu.displayed_damage_meter_UI_sorting_types = - {language.current_language.customization_menu.normal, language.current_language.customization_menu.damage, - language.current_language.customization_menu.dps}; - customization_menu.displayed_damage_meter_UI_dps_modes = {language.current_language.customization_menu.first_hit, - language.current_language.customization_menu.quest_time, - language.current_language.customization_menu.join_time}; + customization_menu.displayed_damage_meter_UI_total_damage_location_types = { current.first, + current.last}; - customization_menu.displayed_auto_highlight_modes = {language.current_language.customization_menu.closest, - language.current_language.customization_menu.farthest, - language.current_language.customization_menu.lowest_health, - language.current_language.customization_menu.highest_health, - language.current_language.customization_menu.lowest_health_percentage, - language.current_language.customization_menu.highest_health_percentage}; + customization_menu.damage_meter_UI_total_damage_location_types = { default.first, + default.last}; - customization_menu.orientation_types = {language.default_language.customization_menu.horizontal, - language.default_language.customization_menu.vertical}; - customization_menu.anchor_types = {language.default_language.customization_menu.top_left, - language.default_language.customization_menu.top_right, - language.default_language.customization_menu.bottom_left, - language.default_language.customization_menu.bottom_right}; + customization_menu.displayed_damage_meter_UI_sorting_types = { current.normal, + current.damage, + current.dps}; - customization_menu.outline_styles = {language.default_language.customization_menu.inside, - language.default_language.customization_menu.center, - language.default_language.customization_menu.outside}; - customization_menu.monster_UI_sorting_types = {language.default_language.customization_menu.normal, - language.default_language.customization_menu.health, - language.default_language.customization_menu.health_percentage, - language.default_language.customization_menu.distance}; + customization_menu.damage_meter_UI_sorting_types = { default.normal, + default.damage, + default.dps}; - customization_menu.large_monster_UI_parts_sorting_types = {language.default_language.customization_menu.normal, - language.default_language.customization_menu.health, - language.default_language.customization_menu - .health_percentage, language.default_language.customization_menu.flinch_count, - language.default_language.customization_menu.break_health, - language.default_language.customization_menu - .break_health_percentage, language.default_language.customization_menu.break_count, - language.default_language.customization_menu.loss_health, - language.default_language.customization_menu - .loss_health_percentage}; + customization_menu.displayed_damage_meter_UI_dps_modes = { current.first_hit, + current.quest_time, + current.join_time}; - customization_menu.ailments_sorting_types = {language.default_language.customization_menu.normal, - language.default_language.customization_menu.buildup, - language.default_language.customization_menu.buildup_percentage}; - customization_menu.ailment_buildups_sorting_types = {language.default_language.customization_menu.normal, - language.default_language.customization_menu.buildup, - language.default_language.customization_menu.buildup_percentage}; - customization_menu.highlighted_buildup_bar_types = {language.default_language.customization_menu.me, - language.default_language.customization_menu.top_buildup, - language.default_language.customization_menu.none}; - customization_menu.buildup_bar_relative_types = {language.default_language.customization_menu.total_buildup, - language.default_language.customization_menu.top_buildup}; + customization_menu.damage_meter_UI_dps_modes = { default.first_hit, + default.quest_time, + default.join_time}; - customization_menu.damage_meter_UI_highlighted_entity_types = {language.default_language.customization_menu.top_damage, - language.default_language.customization_menu.top_dps, - language.default_language.customization_menu.none}; - customization_menu.damage_meter_UI_damage_bar_relative_types = - {language.default_language.customization_menu.total_damage, language.default_language.customization_menu.top_damage}; + customization_menu.displayed_auto_highlight_modes = { current.closest, + current.farthest, + current.lowest_health, + current.highest_health, + current.lowest_health_percentage, + current.highest_health_percentage}; - customization_menu.damage_meter_UI_my_damage_bar_location_types = - {language.default_language.customization_menu.normal, language.default_language.customization_menu.first, - language.default_language.customization_menu.last}; - - customization_menu.damage_meter_UI_total_damage_location_types = { - language.current_language.customization_menu.first, - language.current_language.customization_menu.last}; - - customization_menu.damage_meter_UI_sorting_types = {language.default_language.customization_menu.normal, - language.default_language.customization_menu.damage, - language.default_language.customization_menu.dps}; - customization_menu.damage_meter_UI_dps_modes = {language.default_language.customization_menu.first_hit, - language.default_language.customization_menu.quest_time, - language.default_language.customization_menu.join_time}; - - customization_menu.auto_highlight_modes = {language.default_language.customization_menu.closest, - language.default_language.customization_menu.farthest, - language.default_language.customization_menu.lowest_health, - language.default_language.customization_menu.highest_health, - language.default_language.customization_menu.lowest_health_percentage, - language.default_language.customization_menu.highest_health_percentage}; + customization_menu.auto_highlight_modes = { default.closest, + default.farthest, + default.lowest_health, + default.highest_health, + default.lowest_health_percentage, + default.highest_health_percentage}; end function customization_menu.draw() @@ -304,6 +332,7 @@ function customization_menu.draw() local time_UI_changed = false; local damage_meter_UI_changed = false; local endemic_life_UI_changed = false; + local buff_UI_changed = false; local apply_font_requested = false; local status_string = tostring(customization_menu.status); @@ -326,6 +355,7 @@ function customization_menu.draw() time_UI_changed = customization_menu.draw_time_UI(); damage_meter_UI_changed = customization_menu.draw_damage_meter_UI(); endemic_life_UI_changed = customization_menu.draw_endemic_life_UI() + --buff_UI_changed = customization_menu.draw_buff_UI(); imgui.pop_font(); imgui.end_window(); @@ -384,6 +414,12 @@ function customization_menu.draw() end end + --[[if buff_UI_changed or modifiers_changed or config_changed then + for _, buff in pairs(buffs.list) do + buffs.init_UI(buff); + end + end]] + if customization_menu.menu_font_changed and (apply_font_requested or config_changed) then customization_menu.menu_font_changed = false; customization_menu.reload_font(false); @@ -391,7 +427,7 @@ function customization_menu.draw() if modules_changed or global_settings_changed or small_monster_UI_changed or large_monster_dynamic_UI_changed or large_monster_static_UI_changed or large_monster_highlighted_UI_changed or time_UI_changed or damage_meter_UI_changed or - endemic_life_UI_changed or modifiers_changed or config_changed then + endemic_life_UI_changed or buff_UI_changed or modifiers_changed or config_changed then config.save_current(); end end @@ -512,6 +548,11 @@ function customization_menu.draw_modules() changed, config.current_config.endemic_life_UI.enabled = imgui.checkbox( language.current_language.customization_menu.endemic_life_UI, config.current_config.endemic_life_UI.enabled); config_changed = config_changed or changed; + + --[[changed, config.current_config.buff_UI.enabled = imgui.checkbox( + language.current_language.customization_menu.buff_UI, config.current_config.buff_UI.enabled); + config_changed = config_changed or changed;]] + imgui.tree_pop(); end @@ -939,6 +980,13 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ cached_config.module_visibility.in_training_area.endemic_life_UI); config_changed = config_changed or changed; + + --[[changed, cached_config.module_visibility.in_training_area.buff_UI = imgui.checkbox( + language.current_language.customization_menu.buff_UI, + cached_config.module_visibility.in_training_area.buff_UI); + + config_changed = config_changed or changed;]] + imgui.tree_pop(); end @@ -2077,6 +2125,118 @@ function customization_menu.draw_endemic_life_UI() return config_changed; end +function customization_menu.draw_buff_UI() + local changed = false; + local config_changed = false; + local index = 0; + + if imgui.tree_node(language.current_language.customization_menu.buff_UI) then + local cached_config = config.current_config.buff_UI; + + changed, cached_config.enabled = imgui.checkbox( + language.current_language.customization_menu.enabled, cached_config.enabled); + + config_changed = config_changed or changed; + + if imgui.tree_node(language.current_language.customization_menu.settings) then + changed, cached_config.settings.hide_bar_for_infinite_buffs = imgui.checkbox( + language.current_language.customization_menu.hide_bar_for_infinite_buffs, cached_config.settings.hide_bar_for_infinite_buffs); + + config_changed = config_changed or changed; + + changed, cached_config.settings.hide_timer_for_infinite_buffs = imgui.checkbox( + language.current_language.customization_menu.hide_timer_for_infinite_buffs, cached_config.settings.hide_timer_for_infinite_buffs); + + config_changed = config_changed or changed; + + changed, index = imgui.combo( + language.current_language.customization_menu.orientation, + table_helpers.find_index(customization_menu.orientation_types, cached_config.settings.orientation), + customization_menu.displayed_orientation_types); + + config_changed = config_changed or changed; + + if changed then + cached_config.settings.orientation = customization_menu.orientation_types[index]; + end + + imgui.tree_pop(); + end + + if imgui.tree_node(language.current_language.customization_menu.spacing) then + changed, cached_config.spacing.x = imgui.drag_float( + language.current_language.customization_menu.x, cached_config.spacing.x, 0.1, -screen.width, screen.width, "%.1f"); + + config_changed = config_changed or changed; + + changed, cached_config.spacing.y = imgui.drag_float( + language.current_language.customization_menu.y, cached_config.spacing.y, 0.1, -screen.height, screen.height, "%.1f"); + + config_changed = config_changed or changed; + + imgui.tree_pop(); + end + + if imgui.tree_node(language.current_language.customization_menu.position) then + changed, cached_config.position.x = imgui.drag_float( + language.current_language.customization_menu.x, cached_config.position.x, 0.1, 0, screen.width, "%.1f"); + + config_changed = config_changed or changed; + + changed, cached_config.position.y = imgui.drag_float( + language.current_language.customization_menu.y, cached_config.position.y, 0.1, 0, screen.height, "%.1f"); + + config_changed = config_changed or changed; + + changed, index = imgui.combo( + language.current_language.customization_menu.anchor, + table_helpers.find_index(customization_menu.anchor_types, cached_config.position.anchor), + customization_menu.displayed_anchor_types); + + config_changed = config_changed or changed; + + if changed then + cached_config.position.anchor = customization_menu.anchor_types[index]; + end + + imgui.tree_pop(); + end + + if imgui.tree_node(language.current_language.customization_menu.sorting) then + changed, index = imgui.combo( + language.current_language.customization_menu.type, + table_helpers.find_index(customization_menu.buff_UI_sorting_types, cached_config.sorting.type), + customization_menu.displayed_buff_UI_sorting_types); + + config_changed = config_changed or changed; + + if changed then + cached_config.sorting.type = customization_menu.buff_UI_sorting_types[index]; + end + + changed, cached_config.sorting.reversed_order = imgui.checkbox( + language.current_language.customization_menu.reversed_order, cached_config.sorting.reversed_order); + + config_changed = config_changed or changed; + + imgui.tree_pop(); + end + + changed = label_customization.draw(language.current_language.customization_menu.name_label, cached_config.name_label); + config_changed = config_changed or changed; + + changed = label_customization.draw(language.current_language.customization_menu.timer_label, cached_config.timer_label); + config_changed = config_changed or changed; + + changed = bar_customization.draw(language.current_language.customization_menu.bar, cached_config.bar); + config_changed = config_changed or changed; + + imgui.tree_pop(); + end + + return config_changed; +end + function customization_menu.init_module() table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); @@ -2091,6 +2251,7 @@ function customization_menu.init_module() keyboard = require("MHR_Overlay.Game_Handler.keyboard"); non_players = require("MHR_Overlay.Damage_Meter.non_players"); quest_status = require("MHR_Overlay.Game_Handler.quest_status"); + buffs = require("MHR_Overlay.Buffs.buffs"); label_customization = require("MHR_Overlay.UI.Customizations.label_customization"); bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");