Bugfixes, added sorting by distance, localization system improvements

This commit is contained in:
GreenComfyTea
2022-02-12 19:59:07 +02:00
parent 3f1ceec534
commit 78722262f1
24 changed files with 868 additions and 153 deletions

View File

@@ -6,6 +6,7 @@ local player;
local quest_status;
local screen;
local drawing;
local language;
damage_meter_UI.last_displayed_players = {};
damage_meter_UI.freeze_displayed_players = false;
@@ -207,7 +208,7 @@ function damage_meter_UI.draw()
position_on_screen = screen.calculate_absolute_coordinates(config.current_config.damage_meter_UI.position);
end
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_label, position_on_screen, 1);
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_label, position_on_screen, 1, language.current_language.UI.total_damage);
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_value_label, position_on_screen, 1, player.total.display.total_damage);
end
@@ -220,6 +221,7 @@ function damage_meter_UI.init_module()
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
screen = require("MHR_Overlay.Game_Handler.screen");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
end
return damage_meter_UI;

View File

@@ -31,26 +31,36 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled)
local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
customization_menu.status = "No enemy";
break
goto continue;
end
local monster = large_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
break
goto continue;
end
table.insert(displayed_monsters, monster);
::continue::
end
if dynamic_enabled or config.current_config.large_monster_UI.static.sorting.type == "Distance" then
for _, monster in ipairs(displayed_monsters) do
monster.distance = (player.myself_position - monster.position):length();
end
end
if dynamic_enabled then
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if config.current_config.large_monster_UI.dynamic.settings.max_distance == 0 then
break;
end
if monster.dead_or_captured and config.current_config.large_monster_UI.dynamic.settings.hide_dead_or_captured then
goto continue;
end
local position_on_screen = {};
local world_offset = Vector3f.new(config.current_config.large_monster_UI.dynamic.world_offset.x, config.current_config.large_monster_UI.dynamic.world_offset.y, config.current_config.large_monster_UI.dynamic.world_offset.z);
@@ -65,13 +75,12 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled)
position_on_screen.y = position_on_screen.y + config.current_config.large_monster_UI.dynamic.viewport_offset.y;
local opacity_scale = 1;
local distance = (player.myself_position - monster.position):length();
if distance > config.current_config.large_monster_UI.dynamic.settings.max_distance then
if monster.distance > config.current_config.large_monster_UI.dynamic.settings.max_distance then
goto continue;
end
if config.current_config.large_monster_UI.dynamic.settings.opacity_falloff then
opacity_scale = 1 - (distance / config.current_config.large_monster_UI.dynamic.settings.max_distance);
opacity_scale = 1 - (monster.distance / config.current_config.large_monster_UI.dynamic.settings.max_distance);
end
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
@@ -111,12 +120,26 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled)
return left.health_percentage < right.health_percentage;
end);
end
elseif config.current_config.large_monster_UI.static.sorting.type == "Distance" then
if config.current_config.large_monster_UI.static.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right)
return left.distance > right.distance;
end);
else
table.sort(displayed_monsters, function(left, right)
return left.distance < right.distance;
end);
end
end
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.large_monster_UI.static.position);
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if monster.dead_or_captured and config.current_config.large_monster_UI.static.settings.hide_dead_or_captured then
goto continue;
end
local monster_position_on_screen = {
x = position_on_screen.x,
y = position_on_screen.y
@@ -131,6 +154,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled)
large_monster.draw_static(monster, monster_position_on_screen, 1);
i = i + 1;
::continue::
end
end
end

View File

@@ -31,21 +31,32 @@ function small_monster_UI.draw()
local enemy = get_zako_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
customization_menu.status = "No enemy";
break
goto continue;
end
local monster = small_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
break
goto continue;
end
if monster.dead_or_captured and config.current_config.small_monster_UI.settings.hide_dead_or_captured then
goto continue;
end
table.insert(displayed_monsters, monster);
::continue::
end
if config.current_config.small_monster_UI.dynamic_positioning.enabled
or (not config.current_config.small_monster_UI.dynamic_positioning.enabled and config.current_config.small_monster_UI.static_sorting.type == "Distance") then
for _, monster in ipairs(displayed_monsters) do
monster.distance = (player.myself_position - monster.position):length();
end
end
if not config.current_config.small_monster_UI.dynamic_positioning.enabled then
-- sort here
if config.current_config.small_monster_UI.static_sorting.type == "Normal" and config.current_config.small_monster_UI.static_sorting.reversed_order then
local reversed_monsters = {};
for i = #displayed_monsters, 1, -1 do
@@ -74,6 +85,16 @@ function small_monster_UI.draw()
return left.health_percentage < right.health_percentage;
end);
end
elseif config.current_config.small_monster_UI.static_sorting.type == "Distance" then
if config.current_config.small_monster_UI.static_sorting.reversed_order then
table.sort(displayed_monsters, function(left, right)
return left.distance > right.distance;
end);
else
table.sort(displayed_monsters, function(left, right)
return left.distance < right.distance;
end);
end
end
end
@@ -109,14 +130,12 @@ function small_monster_UI.draw()
return;
end
local distance = (player.myself_position - monster.position):length();
if distance > config.current_config.small_monster_UI.dynamic_positioning.max_distance then
if monster.distance > config.current_config.small_monster_UI.dynamic_positioning.max_distance then
goto continue;
end
if config.current_config.small_monster_UI.dynamic_positioning.opacity_falloff then
opacity_scale = 1 - (distance / config.current_config.small_monster_UI.dynamic_positioning.max_distance);
opacity_scale = 1 - (monster.distance / config.current_config.small_monster_UI.dynamic_positioning.max_distance);
end
end

View File

@@ -3,6 +3,7 @@ local table_helpers;
local drawing;
local config;
local player;
local language;
function damage_UI_entity.new(bar, highlighted_bar, player_name_label, value_label, percentage_label)
local entity = {};
@@ -30,7 +31,7 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
end
if player_include.word_player then
player_name_text = player_name_text .. "Player ";
player_name_text = player_name_text .. language.current_config.UI.player .. " ";
end
if player_include.player_id then
@@ -48,7 +49,7 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
local player_damage_bar_percentage = 0;
if config.current_config.damage_meter_UI.settings.damage_bar_relative_to == "Total Damage" then
if _player.total.display.total_damage ~= 0 then
if player.total.display.total_damage ~= 0 then
player_damage_bar_percentage = _player.display.total_damage / player.total.display.total_damage;
end
else
@@ -75,6 +76,7 @@ function damage_UI_entity.init_module()
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
player = require("MHR_Overlay.Damage_Meter.player");
language = require("MHR_Overlay.Misc.language");
end
return damage_UI_entity;

View File

@@ -1,6 +1,7 @@
local health_UI_entity = {};
local table_helpers;
local drawing;
local language;
function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {};
@@ -21,7 +22,7 @@ function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_s
drawing.draw_bar(health_UI.bar, position_on_screen, opacity_scale, monster.health_percentage);
drawing.draw_label(health_UI.text_label, position_on_screen, opacity_scale);
drawing.draw_label(health_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.HP);
drawing.draw_label(health_UI.value_label, position_on_screen, opacity_scale, monster.health, monster.max_health);
drawing.draw_label(health_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.health_percentage);
end
@@ -29,6 +30,7 @@ end
function health_UI_entity.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
end
return health_UI_entity;

View File

@@ -1,8 +1,9 @@
local rage_UI_entity = {};
local table_helpers;
local drawing;
local language;
function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {};
entity.visibility = visibility;
@@ -10,9 +11,8 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
entity.text_label = table_helpers.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(timer_label);
entity.timer_label.text = "%.0f:%02.0f";
return entity;
end
@@ -24,13 +24,12 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale
if monster.is_in_rage then
drawing.draw_bar(rage_UI.bar, position_on_screen, opacity_scale, monster.rage_timer_percentage);
drawing.draw_label(rage_UI.text_label, position_on_screen, opacity_scale);
drawing.draw_label(rage_UI.value_label, position_on_screen, opacity_scale, monster.rage_point, monster.rage_limit);
drawing.draw_label(rage_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.rage);
drawing.draw_label(rage_UI.timer_label, position_on_screen, opacity_scale, monster.rage_minutes_left, monster.rage_seconds_left);
else
drawing.draw_bar(rage_UI.bar, position_on_screen, opacity_scale, monster.rage_percentage);
drawing.draw_label(rage_UI.text_label, position_on_screen, opacity_scale);
drawing.draw_label(rage_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.rage);
drawing.draw_label(rage_UI.value_label, position_on_screen, opacity_scale, monster.rage_point, monster.rage_limit);
drawing.draw_label(rage_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.rage_percentage);
end
@@ -39,6 +38,7 @@ end
function rage_UI_entity.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
end
return rage_UI_entity;

View File

@@ -1,6 +1,7 @@
local stamina_UI_entity = {};
local table_helpers;
local drawing;
local language;
function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {};
@@ -21,7 +22,7 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity
drawing.draw_bar(stamina_UI.bar, position_on_screen, opacity_scale, monster.stamina_percentage);
drawing.draw_label(stamina_UI.text_label, position_on_screen, opacity_scale);
drawing.draw_label(stamina_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.stamina);
drawing.draw_label(stamina_UI.value_label, position_on_screen, opacity_scale, monster.stamina, monster.max_stamina);
drawing.draw_label(stamina_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.stamina_percentage);
end
@@ -29,6 +30,7 @@ end
function stamina_UI_entity.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
end
return stamina_UI_entity;

View File

@@ -7,6 +7,10 @@ local player;
local large_monster;
local small_monster;
local language;
local part_names;
customization_menu.font = nil;
customization_menu.font_range = { 0x1, 0xFFFF, 0 };
customization_menu.is_opened = false;
customization_menu.status = "OK";
@@ -18,7 +22,6 @@ customization_menu.window_flags = 0x10120;
customization_menu.color_picker_flags = 327680;
customization_menu.selected_language_index = 1;
customization_menu.displayed_orientation_types = {};
@@ -75,9 +78,13 @@ customization_menu.large_monster_UI_anchor_index = 1;
customization_menu.time_UI_anchor_index = 1;
customization_menu.damage_meter_UI_anchor_index = 1;
customization_menu.selected_font_index = 9;
customization_menu.selected_UI_font_index = 9;
function customization_menu.init()
customization_menu.font = imgui.load_font(language.current_language.font_name, config.current_config.global_settings.menu_font.size, customization_menu.font_range);
customization_menu.selected_language_index = table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false);
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};
@@ -138,7 +145,7 @@ function customization_menu.init()
customization_menu.damage_meter_UI_sorting_types, config.current_config.damage_meter_UI.sorting.type, false);
customization_menu.selected_font_index = table_helpers.find_index(customization_menu.fonts,
config.current_config.global_settings.font.family, false);
config.current_config.global_settings.UI_font.family, false);
customization_menu.small_monster_UI_anchor_index = table_helpers.find_index(customization_menu.anchor_types,
config.current_config.small_monster_UI.static_position.anchor, false);
@@ -157,15 +164,17 @@ function customization_menu.draw()
imgui.set_next_window_pos(customization_menu.window_position, 1 << 3, customization_menu.window_pivot);
imgui.set_next_window_size(customization_menu.window_size, 1 << 3);
customization_menu.is_opened = imgui.begin_window(language.current_language.customization_menu.mod_name .. " " .. config.current_config.version,
customization_menu.is_opened, customization_menu.window_flags);
imgui.push_font(customization_menu.font);
customization_menu.is_opened = imgui.begin_window(language.current_language.customization_menu.mod_name .. " " .. config.current_config.version, customization_menu.is_opened, customization_menu.window_flags);
if not customization_menu.is_opened then
return;
end
local config_changed = false;
local changed;
local changed = false;
local status_string = tostring(customization_menu.status);
imgui.text(language.current_language.customization_menu.status .. ": " .. status_string);
@@ -198,12 +207,16 @@ function customization_menu.draw()
changed, customization_menu.selected_language_index = imgui.combo(language.current_language.customization_menu.language, customization_menu.selected_language_index, language.language_names);
config_changed = config_changed or changed;
if changed then
config.current_config.global_settings.language = language.language_names[customization_menu.selected_font_index];
large_monster.init_list();
config.current_config.global_settings.language = language.language_names[customization_menu.selected_language_index];
language.update(customization_menu.selected_language_index);
imgui.pop_font(customization_menu.font);
customization_menu.init();
imgui.push_font(customization_menu.font);
part_names.init();
large_monster.init_list();
for _, monster in pairs(small_monster.list) do
small_monster.init_UI(monster);
end
@@ -213,6 +226,77 @@ function customization_menu.draw()
end
end
if imgui.tree_node(language.current_language.customization_menu.menu_font) then
changed, config.current_config.global_settings.menu_font.size =
imgui.slider_int(" ", config.current_config.global_settings.menu_font.size, 5, 100);
config_changed = config_changed or changed;
imgui.same_line();
if changed then
imgui.pop_font(customization_menu.font);
customization_menu.font = imgui.load_font(language.current_language.font_name, config.current_config.global_settings.menu_font.size, customization_menu.font_range);
imgui.push_font(customization_menu.font);
end
changed = imgui.button("-");
imgui.same_line();
if changed then
config.current_config.global_settings.menu_font.size = config.current_config.global_settings.menu_font.size - 1;
if config.current_config.global_settings.menu_font.size < 5 then
config.current_config.global_settings.menu_font.size = 10;
end
imgui.pop_font(customization_menu.font);
customization_menu.font = imgui.load_font(language.current_language.font_name, config.current_config.global_settings.menu_font.size, customization_menu.font_range);
imgui.push_font(customization_menu.font);
end
changed = imgui.button("+");
imgui.same_line();
if changed then
config.current_config.global_settings.menu_font.size = config.current_config.global_settings.menu_font.size + 1;
if config.current_config.global_settings.menu_font.size > 100 then
config.current_config.global_settings.menu_font.size = 100;
end
imgui.pop_font(customization_menu.font);
customization_menu.font = imgui.load_font(language.current_language.font_name, config.current_config.global_settings.menu_font.size, customization_menu.font_range);
imgui.push_font(customization_menu.font);
end
imgui.text(language.current_language.customization_menu.size);
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.UI_font) then
imgui.text(language.current_language.customization_menu.UI_font_notice);
changed, customization_menu.selected_UI_font_index = imgui.combo(language.current_language.customization_menu.family, customization_menu.selected_UI_font_index,
customization_menu.fonts);
config_changed = config_changed or changed;
if changed then
config.current_config.global_settings.uUI_font.family = customization_menu.fonts[customization_menu.selected_UI_font_index];
end
changed, config.current_config.global_settings.UI_font.size =
imgui.slider_int(language.current_language.customization_menu.size, config.current_config.global_settings.UI_font.size, 1, 100);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.UI_font.bold =
imgui.checkbox(language.current_language.customization_menu.bold, config.current_config.global_settings.UI_font.bold);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.UI_font.italic =
imgui.checkbox(language.current_language.customization_menu.italic, config.current_config.global_settings.UI_font.italic);
config_changed = config_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.performance) then
changed, config.current_config.global_settings.performance.max_monster_updates_per_tick =
imgui.slider_int(language.current_language.customization_menu.max_monster_updates_per_tick, config.current_config.global_settings.performance.max_monster_updates_per_tick, 1, 150);
@@ -307,31 +391,6 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.font) then
imgui.text(language.current_language.customization_menu.font_notice);
changed, customization_menu.selected_font_index = imgui.combo(language.current_language.customization_menu.family, customization_menu.selected_font_index,
customization_menu.fonts);
config_changed = config_changed or changed;
if changed then
config.current_config.global_settings.font.family = customization_menu.fonts[customization_menu.selected_font_index];
end
changed, config.current_config.global_settings.font.size =
imgui.slider_int(language.current_language.customization_menu.size, config.current_config.global_settings.font.size, 1, 100);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.font.bold =
imgui.checkbox(language.current_language.customization_menu.bold, config.current_config.global_settings.font.bold);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.font.italic =
imgui.checkbox(language.current_language.customization_menu.italic, config.current_config.global_settings.font.italic);
config_changed = config_changed or changed;
imgui.tree_pop();
end
imgui.tree_pop();
end
@@ -342,6 +401,10 @@ function customization_menu.draw()
config_changed = config_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.settings) then
changed, config.current_config.small_monster_UI.settings.hide_dead_or_captured = imgui.checkbox(language.current_language.customization_menu.hide_dead_or_captured, config.current_config
.small_monster_UI.settings.hide_dead_or_captured);
config_changed = config_changed or changed;
changed, customization_menu.small_monster_UI_orientation_index =
imgui.combo(language.current_language.customization_menu.static_orientation, customization_menu.small_monster_UI_orientation_index,
customization_menu.displayed_orientation_types);
@@ -1068,6 +1131,10 @@ function customization_menu.draw()
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.settings) then
changed, config.current_config.large_monster_UI.dynamic.settings.hide_dead_or_captured = imgui.checkbox(language.current_language.customization_menu.hide_dead_or_captured, config.current_config.
large_monster_UI.dynamic.settings.hide_dead_or_captured);
config_changed = config_changed or changed;
changed, config.current_config.large_monster_UI.dynamic.settings.opacity_falloff =
imgui.checkbox(language.current_language.customization_menu.opacity_falloff, config.current_config.large_monster_UI.dynamic.settings.opacity_falloff);
config_changed = config_changed or changed;
@@ -1452,7 +1519,7 @@ function customization_menu.draw()
if imgui.tree_node(language.current_language.customization_menu.colors) then
if imgui.tree_node(language.current_language.customization_menu.foreground) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.colors.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.colors.foreground, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.dynamic.health.bar.normal_colors.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.normal_colors.foreground, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
@@ -1460,7 +1527,7 @@ function customization_menu.draw()
end
if imgui.tree_node(language.current_language.customization_menu.background) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.colors.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.colors.background, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.dynamic.health.bar.normal_colors.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.normal_colors.background, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
@@ -1469,7 +1536,7 @@ function customization_menu.draw()
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
changed, config.current_config.large_monster_UI.dynamic.health.bar.colors.capture.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.colors.capture.foreground, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_colors.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.capture_colors.foreground, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
@@ -1477,7 +1544,7 @@ function customization_menu.draw()
end
if imgui.tree_node(language.current_language.customization_menu.background) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.colors.capture.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.colors.capture.background, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_colors.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.capture_colors.background, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
@@ -1488,6 +1555,51 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.capture_line) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_line.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.large_monster_UI.dynamic.health.bar.capture_line.visibility);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_line.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.dynamic.health.bar.capture_line.offset.x, 0.1, -screen.width, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_line.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.dynamic.health.bar.capture_line.offset.y, 0.1, -screen.height, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.size) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_line.size.width = imgui.drag_float(language.current_language.customization_menu.width,
config.current_config.large_monster_UI.dynamic.health.bar.capture_line.size.width, 0.1, 0, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_line.size.height = imgui.drag_float(language.current_language.customization_menu.height,
config.current_config.large_monster_UI.dynamic.health.bar.capture_line.size.height, 0.1, 0, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.large_monster_UI.dynamic.health.bar.capture_line.color = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.health.bar.capture_line.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.tree_pop();
end
@@ -1974,6 +2086,74 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.timer_label) then
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.large_monster_UI.dynamic.rage.timer_label.visibility);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
-- add text format
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.dynamic.rage.timer_label.offset.x, 0.1, -screen.width, screen.width,
"%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.dynamic.rage.timer_label.offset.y, 0.1, -screen.height, screen.height,
"%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.color = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.rage.timer_label.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.shadow) then
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.visibility = imgui.checkbox(
language.current_language.customization_menu.visible, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.visibility);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.offset.x = imgui.drag_float(
language.current_language.customization_menu.x, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.offset.x, 0.1, -screen.width,
screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.offset.y = imgui.drag_float(
language.current_language.customization_menu.y, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.offset.y, 0.1, -screen.height,
screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.color = imgui.color_picker_argb("", config.current_config.large_monster_UI.dynamic.rage.timer_label.shadow.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.bar) then
changed, config.current_config.large_monster_UI.dynamic.rage.bar.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.large_monster_UI.dynamic.rage.bar.visibility);
@@ -2459,6 +2639,10 @@ function customization_menu.draw()
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.settings) then
changed, config.current_config.large_monster_UI.static.settings.hide_dead_or_captured = imgui.checkbox(language.current_language.customization_menu.hide_dead_or_captured, config.current_config.
large_monster_UI.static.settings.hide_dead_or_captured);
config_changed = config_changed or changed;
changed, customization_menu.large_monster_UI_orientation_index = imgui.combo(language.current_language.customization_menu.orientation,
customization_menu.large_monster_UI_orientation_index, customization_menu.displayed_orientation_types);
config_changed = config_changed or changed;
@@ -2864,7 +3048,7 @@ function customization_menu.draw()
if imgui.tree_node(language.current_language.customization_menu.colors) then
if imgui.tree_node(language.current_language.customization_menu.foreground) then
changed, config.current_config.large_monster_UI.static.health.bar.colors.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.colors.foreground, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.static.health.bar.normal_colors.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.normal_colors.foreground, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
@@ -2872,7 +3056,7 @@ function customization_menu.draw()
end
if imgui.tree_node(language.current_language.customization_menu.background) then
changed, config.current_config.large_monster_UI.static.health.bar.colors.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.colors.background, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.static.health.bar.normal_colors.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.normal_colors.background, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
@@ -2881,7 +3065,7 @@ function customization_menu.draw()
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
changed, config.current_config.large_monster_UI.static.health.bar.colors.capture.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.colors.capture.foreground, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.static.health.bar.capture_colors.foreground = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.capture_colors.foreground, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
@@ -2889,7 +3073,7 @@ function customization_menu.draw()
end
if imgui.tree_node(language.current_language.customization_menu.background) then
changed, config.current_config.large_monster_UI.static.health.bar.colors.capture.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.colors.capture.background, customization_menu.color_picker_flags);
changed, config.current_config.large_monster_UI.static.health.bar.capture_colors.background = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.capture_colors.background, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
@@ -2900,6 +3084,51 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.capture_line) then
changed, config.current_config.large_monster_UI.static.health.bar.capture_line.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.large_monster_UI.static.health.bar.capture_line.visibility);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.large_monster_UI.static.health.bar.capture_line.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.static.health.bar.capture_line.offset.x, 0.1, -screen.width, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
changed, config.current_config.large_monster_UI.static.health.bar.capture_line.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.static.health.bar.capture_line.offset.y, 0.1, -screen.height, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.size) then
changed, config.current_config.large_monster_UI.static.health.bar.capture_line.size.width = imgui.drag_float(language.current_language.customization_menu.width,
config.current_config.large_monster_UI.static.health.bar.capture_line.size.width, 0.1, 0, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
changed, config.current_config.large_monster_UI.static.health.bar.capture_line.size.height = imgui.drag_float(language.current_language.customization_menu.height,
config.current_config.large_monster_UI.static.health.bar.capture_line.size.height, 0.1, 0, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.large_monster_UI.static.health.bar.capture_line.color = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.health.bar.capture_line.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.tree_pop();
end
@@ -3384,6 +3613,74 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.timer_label) then
changed, config.current_config.large_monster_UI.static.rage.timer_label.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.large_monster_UI.static.rage.timer_label.visibility);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
-- add text format
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.large_monster_UI.static.rage.timer_label.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.static.rage.timer_label.offset.x, 0.1, -screen.width, screen.width,
"%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
changed, config.current_config.large_monster_UI.static.rage.timer_label.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.static.rage.timer_label.offset.y, 0.1, -screen.height, screen.height,
"%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.large_monster_UI.static.rage.timer_label.color = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.rage.timer_label.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.shadow) then
changed, config.current_config.large_monster_UI.static.rage.timer_label.shadow.visibility = imgui.checkbox(
language.current_language.customization_menu.visible, config.current_config.large_monster_UI.static.rage.timer_label.shadow.visibility);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.large_monster_UI.static.rage.timer_label.shadow.offset.x = imgui.drag_float(
language.current_language.customization_menu.x, config.current_config.large_monster_UI.static.rage.timer_label.shadow.offset.x, 0.1, -screen.width,
screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
changed, config.current_config.large_monster_UI.static.rage.timer_label.shadow.offset.y = imgui.drag_float(
language.current_language.customization_menu.y, config.current_config.large_monster_UI.static.rage.timer_label.shadow.offset.y, 0.1, -screen.height,
screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.large_monster_UI.static.rage.timer_label.shadow.color = imgui.color_picker_argb("", config.current_config.large_monster_UI.static.rage.timer_label.shadow.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.bar) then
changed, config.current_config.large_monster_UI.static.rage.bar.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.large_monster_UI.static.rage.bar.visibility);
@@ -4649,6 +4946,8 @@ function customization_menu.draw()
imgui.end_window();
imgui.pop_font(customization_menu.font);
if config_changed then
config.save();
end
@@ -4662,6 +4961,7 @@ function customization_menu.init_module()
player = require("MHR_Overlay.Damage_Meter.player");
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
part_names = require("MHR_Overlay.Misc.part_names");
customization_menu.init();
end

View File

@@ -4,7 +4,7 @@ local config;
drawing.font = nil;
function drawing.init_font()
drawing.font = d2d.Font.new(config.current_config.global_settings.font.family, config.current_config.global_settings.font.size, config.current_config.global_settings.font.bold, config.current_config.global_settings.font.italic);
drawing.font = d2d.Font.new(config.current_config.global_settings.UI_font.family, config.current_config.global_settings.UI_font.size, config.current_config.global_settings.UI_font.bold, config.current_config.global_settings.UI_font.italic);
end
function drawing.color_to_argb(color)
@@ -30,11 +30,9 @@ function drawing.scale_color_opacity(color, scale)
end
function drawing.scale_bar_opacity(bar, scale)
if bar == nil or scale == nil then
return;
end
if not bar.visibility then
if bar == nil
or scale == nil
or not bar.visibility then
return;
end
@@ -43,20 +41,19 @@ function drawing.scale_bar_opacity(bar, scale)
end
function drawing.scale_label_opacity(label, scale)
if label == nil or scale == nil then
if label == nil
or scale == nil
or not label.visibility then
return;
end
if not label.visibility then
return;
end
label.color = drawing.scale_color_opacity(label.color, scale);
label.shadow.color = drawing.scale_color_opacity(label.shadow.color, scale);
end
function drawing.draw_label(label, position, opacity_scale, ...)
if label == nil or not label.visibility then
if label == nil
or not label.visibility then
return;
end
@@ -82,11 +79,8 @@ function drawing.draw_label(label, position, opacity_scale, ...)
end
function drawing.draw_bar(bar, position, opacity_scale, percentage)
if bar == nil then
return;
end
if not bar.visibility then
if bar == nil
or not bar.visibility then
return;
end
@@ -113,6 +107,30 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
d2d.fill_rect(position_x + foreground_width, position_y, background_width, bar.size.height, new_background_color);
end
function drawing.draw_capture_line(bar, position, opacity_scale, percentage)
if bar == nil
or bar.capture_line == nil
or not bar.visibility
or not bar.capture_line.visibility
or percentage >= 1
or percentage <= 0 then
return;
end
local position_x = position.x + bar.offset.x + bar.capture_line.offset.x + bar.size.width * percentage;
local position_y = position.y + bar.offset.y + bar.capture_line.offset.y;
local color = bar.capture_line.color;
if opacity_scale < 1 then
color = drawing.scale_color_opacity(color, opacity_scale);
end
d2d.fill_rect(position_x, position_y, bar.capture_line.size.width, bar.capture_line.size.height, color);
end
function drawing.init_module()
config = require("MHR_Overlay.Misc.config");
end