mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Refactoring
This commit is contained in:
@@ -34,7 +34,7 @@ function damage_meter_UI.get_players(player_info_list)
|
||||
local quest_players = {};
|
||||
|
||||
local count = get_count_method:call(player_info_list);
|
||||
|
||||
|
||||
if count == nil then
|
||||
customization_menu.status = "No player info list count";
|
||||
return {};
|
||||
@@ -44,18 +44,18 @@ function damage_meter_UI.get_players(player_info_list)
|
||||
local player_info = get_item_method:call(player_info_list, i);
|
||||
|
||||
if player_info == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local player_id = member_index_field:get_data(player_info);
|
||||
if player_id == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
local _player = player.get_player(player_id);
|
||||
if _player ~= nil then
|
||||
if _player == player.myself and cached_config.settings.my_damage_bar_location ~= "Normal" then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
table.insert(quest_players, _player);
|
||||
end
|
||||
@@ -128,7 +128,7 @@ function damage_meter_UI.draw()
|
||||
end
|
||||
damage_meter_UI.last_displayed_players = quest_players;
|
||||
end
|
||||
|
||||
|
||||
local top_damage = 0;
|
||||
local top_dps = 0;
|
||||
for _, _player in ipairs(quest_players) do
|
||||
@@ -140,20 +140,20 @@ function damage_meter_UI.draw()
|
||||
top_dps = _player.dps;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- draw
|
||||
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
for _, _player in ipairs(quest_players) do
|
||||
if _player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if _player == player.myself then
|
||||
if cached_config.settings.hide_myself then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
elseif cached_config.settings.hide_other_players then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
player.draw(_player, position_on_screen, 1, top_damage, top_dps);
|
||||
@@ -195,4 +195,4 @@ function damage_meter_UI.init_module()
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
end
|
||||
|
||||
return damage_meter_UI;
|
||||
return damage_meter_UI;
|
||||
|
||||
@@ -23,35 +23,36 @@ function env_creature_UI.draw()
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
for REcreature, creature in pairs(env_creature.list) do
|
||||
|
||||
|
||||
if cached_config.settings.max_distance == 0 then
|
||||
break;
|
||||
break
|
||||
end
|
||||
|
||||
if cached_config.settings.hide_inactive_creatures and creature.is_inactive then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local position_on_screen = {};
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y,
|
||||
cached_config.world_offset.z);
|
||||
|
||||
position_on_screen = draw.world_to_screen(creature.position + world_offset);
|
||||
|
||||
|
||||
if position_on_screen == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
|
||||
position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
|
||||
|
||||
|
||||
creature.distance = (player.myself_position - creature.position):length();
|
||||
|
||||
local opacity_scale = 1;
|
||||
if creature.distance > cached_config.settings.max_distance then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
if cached_config.settings.opacity_falloff then
|
||||
opacity_scale = 1 - (creature.distance / cached_config.settings.max_distance);
|
||||
end
|
||||
@@ -61,7 +62,6 @@ function env_creature_UI.draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function env_creature_UI.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
@@ -77,4 +77,4 @@ function env_creature_UI.init_module()
|
||||
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
|
||||
end
|
||||
|
||||
return env_creature_UI;
|
||||
return env_creature_UI;
|
||||
|
||||
@@ -25,7 +25,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
if singletons.enemy_manager == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local displayed_monsters = {};
|
||||
|
||||
local highlighted_id = -1;
|
||||
@@ -43,7 +43,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager);
|
||||
if enemy_count == nil then
|
||||
return;
|
||||
@@ -53,13 +53,13 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i);
|
||||
if enemy == nil then
|
||||
customization_menu.status = "No enemy";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local monster = large_monster.list[enemy];
|
||||
if monster == nil then
|
||||
customization_menu.status = "No monster hp entry";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster.dead_or_captured or not monster.is_disp_icon_mini_map then
|
||||
@@ -79,7 +79,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
|
||||
if dynamic_enabled then
|
||||
large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
|
||||
--large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
|
||||
end
|
||||
|
||||
if highlighted_enabled then
|
||||
@@ -87,7 +87,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
|
||||
if static_enabled then
|
||||
large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
|
||||
--large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,45 +98,46 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
|
||||
local i = 0;
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
if cached_config.settings.max_distance == 0 then
|
||||
break;
|
||||
break
|
||||
end
|
||||
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster == highlighted_monster then
|
||||
if not cached_config.settings.render_highlighted_monster then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
else
|
||||
if not cached_config.settings.render_not_highlighted_monsters then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
local position_on_screen = {};
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y,
|
||||
cached_config.world_offset.z);
|
||||
|
||||
position_on_screen = draw.world_to_screen(monster.position + world_offset);
|
||||
|
||||
|
||||
if position_on_screen == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
|
||||
position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
|
||||
|
||||
local opacity_scale = 1;
|
||||
if monster.distance > cached_config.settings.max_distance then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
if cached_config.settings.opacity_falloff then
|
||||
opacity_scale = 1 - (monster.distance / cached_config.settings.max_distance);
|
||||
end
|
||||
|
||||
|
||||
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
|
||||
|
||||
i = i + 1;
|
||||
@@ -147,14 +148,14 @@ end
|
||||
function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
local cached_config = config.current_config.large_monster_UI.static;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
|
||||
-- sort here
|
||||
if cached_config.sorting.type == "Normal" and cached_config.sorting.reversed_order then
|
||||
local reversed_monsters = {};
|
||||
for i = #displayed_monsters, 1, -1 do
|
||||
table.insert(reversed_monsters, displayed_monsters[i]);
|
||||
end
|
||||
|
||||
|
||||
displayed_monsters = reversed_monsters;
|
||||
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
@@ -194,16 +195,16 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
local i = 0;
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster == highlighted_monster then
|
||||
if not cached_config.settings.render_highlighted_monster then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
else
|
||||
if not cached_config.settings.render_not_highlighted_monsters then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
@@ -211,11 +212,11 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
x = position_on_screen.x,
|
||||
y = position_on_screen.y
|
||||
}
|
||||
|
||||
|
||||
if cached_config.settings.orientation == "Horizontal" then
|
||||
monster_position_on_screen.x = monster_position_on_screen.x + cached_config.spacing.x * i * global_scale_modifier;
|
||||
else
|
||||
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
|
||||
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
|
||||
end
|
||||
|
||||
large_monster.draw_static(monster, monster_position_on_screen, 1);
|
||||
@@ -231,13 +232,13 @@ function large_monster_UI.draw_highlighted(monster)
|
||||
if monster == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
large_monster.draw_highlighted(monster, position_on_screen, 1);
|
||||
end
|
||||
|
||||
@@ -255,4 +256,4 @@ function large_monster_UI.init_module()
|
||||
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
||||
end
|
||||
|
||||
return large_monster_UI;
|
||||
return large_monster_UI;
|
||||
|
||||
@@ -33,17 +33,17 @@ 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";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local monster = small_monster.list[enemy];
|
||||
if monster == nil then
|
||||
customization_menu.status = "No monster hp entry";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
table.insert(displayed_monsters, monster);
|
||||
@@ -51,7 +51,7 @@ function small_monster_UI.draw()
|
||||
end
|
||||
|
||||
if cached_config.dynamic_positioning.enabled
|
||||
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
|
||||
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
monster.distance = (player.myself_position - monster.position):length();
|
||||
end
|
||||
@@ -99,13 +99,15 @@ function small_monster_UI.draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local i = 0;
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
local position_on_screen;
|
||||
|
||||
if cached_config.dynamic_positioning.enabled then
|
||||
local world_offset = Vector3f.new(cached_config.dynamic_positioning.world_offset.x, cached_config.dynamic_positioning.world_offset.y, cached_config.dynamic_positioning.world_offset.z);
|
||||
local world_offset = Vector3f.new(cached_config.dynamic_positioning.world_offset.x,
|
||||
cached_config.dynamic_positioning.world_offset.y,
|
||||
cached_config.dynamic_positioning.world_offset.z);
|
||||
|
||||
position_on_screen = draw.world_to_screen(monster.position + world_offset);
|
||||
|
||||
@@ -125,9 +127,9 @@ function small_monster_UI.draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local opacity_scale = 1;
|
||||
if cached_config.dynamic_positioning.enabled then
|
||||
if cached_config.dynamic_positioning.max_distance == 0 then
|
||||
@@ -135,9 +137,9 @@ function small_monster_UI.draw()
|
||||
end
|
||||
|
||||
if monster.distance > cached_config.dynamic_positioning.max_distance then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
if cached_config.dynamic_positioning.opacity_falloff then
|
||||
opacity_scale = 1 - (monster.distance / cached_config.dynamic_positioning.max_distance);
|
||||
end
|
||||
@@ -146,7 +148,7 @@ function small_monster_UI.draw()
|
||||
|
||||
|
||||
small_monster.draw(monster, position_on_screen, opacity_scale);
|
||||
|
||||
|
||||
i = i + 1;
|
||||
::continue::
|
||||
end
|
||||
@@ -165,4 +167,4 @@ function small_monster_UI.init_module()
|
||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||
end
|
||||
|
||||
return small_monster_UI;
|
||||
return small_monster_UI;
|
||||
|
||||
@@ -16,8 +16,8 @@ function time_UI.draw()
|
||||
end
|
||||
|
||||
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.time_UI.position);
|
||||
|
||||
drawing.draw_label(time_UI.label , position_on_screen, 1, elapsed_minutes, elapsed_seconds);
|
||||
|
||||
drawing.draw_label(time_UI.label, position_on_screen, 1, elapsed_minutes, elapsed_seconds);
|
||||
end
|
||||
|
||||
function time_UI.init_UI()
|
||||
@@ -39,4 +39,4 @@ function time_UI.init_module()
|
||||
time_UI.init_UI()
|
||||
end
|
||||
|
||||
return time_UI;
|
||||
return time_UI;
|
||||
|
||||
@@ -21,6 +21,8 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
|
||||
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;
|
||||
@@ -57,16 +59,18 @@ function ailment_UI_entity.draw_dynamic(ailment, ailment_UI, position_on_screen,
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
@@ -88,16 +92,18 @@ function ailment_UI_entity.draw_static(ailment, ailment_UI, position_on_screen,
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
@@ -119,16 +125,18 @@ function ailment_UI_entity.draw_highlighted(ailment, ailment_UI, position_on_scr
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
@@ -150,16 +158,18 @@ function ailment_UI_entity.draw_small(ailment, ailment_UI, position_on_screen, o
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
@@ -171,4 +181,4 @@ function ailment_UI_entity.init_module()
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
end
|
||||
|
||||
return ailment_UI_entity;
|
||||
return ailment_UI_entity;
|
||||
|
||||
@@ -5,7 +5,9 @@ local config;
|
||||
local player;
|
||||
local language;
|
||||
|
||||
function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label, buildup_value_label, buildup_percentage_label, total_buildup_label, total_buildup_value_label)
|
||||
function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label,
|
||||
buildup_value_label, buildup_percentage_label, total_buildup_label,
|
||||
total_buildup_value_label)
|
||||
local entity = {};
|
||||
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
@@ -24,11 +26,16 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
|
||||
entity.buildup_bar.offset.y = entity.buildup_bar.offset.y * global_scale_modifier;
|
||||
entity.buildup_bar.size.width = entity.buildup_bar.size.width * global_scale_modifier;
|
||||
entity.buildup_bar.size.height = entity.buildup_bar.size.height * global_scale_modifier;
|
||||
entity.buildup_bar.outline.thickness = entity.buildup_bar.outline.thickness * global_scale_modifier;
|
||||
entity.buildup_bar.outline.offset = entity.buildup_bar.outline.offset * global_scale_modifier;
|
||||
|
||||
entity.highlighted_buildup_bar.offset.x = entity.highlighted_buildup_bar.offset.x * global_scale_modifier;
|
||||
entity.highlighted_buildup_bar.offset.y = entity.highlighted_buildup_bar.offset.y * global_scale_modifier;
|
||||
entity.highlighted_buildup_bar.size.width = entity.highlighted_buildup_bar.size.width * global_scale_modifier;
|
||||
entity.highlighted_buildup_bar.size.height = entity.highlighted_buildup_bar.size.height * global_scale_modifier;
|
||||
entity.highlighted_buildup_bar.outline.thickness = entity.highlighted_buildup_bar.outline.thickness *
|
||||
global_scale_modifier;
|
||||
entity.highlighted_buildup_bar.outline.offset = entity.highlighted_buildup_bar.outline.offset * global_scale_modifier;
|
||||
|
||||
entity.player_name_label.offset.x = entity.player_name_label.offset.x * global_scale_modifier;
|
||||
entity.player_name_label.offset.y = entity.player_name_label.offset.y * global_scale_modifier;
|
||||
@@ -48,12 +55,13 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
|
||||
return entity;
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
|
||||
function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
|
||||
top_buildup)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
@@ -61,24 +69,29 @@ function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, pos
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
|
||||
function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
|
||||
top_buildup)
|
||||
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
|
||||
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
@@ -86,24 +99,29 @@ function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, posi
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
|
||||
function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
|
||||
top_buildup)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
@@ -111,24 +129,28 @@ function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI,
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
|
||||
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
|
||||
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
@@ -136,16 +158,20 @@ function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, posit
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.init_module()
|
||||
@@ -156,4 +182,4 @@ function ailment_buildup_UI_entity.init_module()
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
end
|
||||
|
||||
return ailment_buildup_UI_entity;
|
||||
return ailment_buildup_UI_entity;
|
||||
|
||||
@@ -4,9 +4,12 @@ local table_helpers;
|
||||
local drawing;
|
||||
|
||||
function body_part_UI_entity.new(part_visibility, part_name_label,
|
||||
flinch_visibility, flinch_bar, flinch_text_label, flinch_value_label, flinch_percentage_label,
|
||||
break_visibility, break_bar, break_text_label, break_value_label, break_percentage_label,
|
||||
loss_visibility, loss_bar, loss_text_label, loss_value_label, loss_health_percentage_label)
|
||||
flinch_visibility, flinch_bar, flinch_text_label, flinch_value_label,
|
||||
flinch_percentage_label,
|
||||
break_visibility, break_bar, break_text_label, break_value_label, break_percentage_label
|
||||
,
|
||||
loss_visibility, loss_bar, loss_text_label, loss_value_label,
|
||||
loss_health_percentage_label)
|
||||
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
@@ -31,6 +34,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
|
||||
entity.flinch_bar.offset.y = entity.flinch_bar.offset.y * global_scale_modifier;
|
||||
entity.flinch_bar.size.width = entity.flinch_bar.size.width * global_scale_modifier;
|
||||
entity.flinch_bar.size.height = entity.flinch_bar.size.height * global_scale_modifier;
|
||||
entity.flinch_bar.outline.thickness = entity.flinch_bar.outline.thickness * global_scale_modifier;
|
||||
entity.flinch_bar.outline.offset = entity.flinch_bar.outline.offset * global_scale_modifier;
|
||||
|
||||
entity.flinch_text_label.offset.x = entity.flinch_text_label.offset.x * global_scale_modifier;
|
||||
entity.flinch_text_label.offset.y = entity.flinch_text_label.offset.y * global_scale_modifier;
|
||||
@@ -50,6 +55,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
|
||||
entity.break_bar.offset.y = entity.break_bar.offset.y * global_scale_modifier;
|
||||
entity.break_bar.size.width = entity.break_bar.size.width * global_scale_modifier;
|
||||
entity.break_bar.size.height = entity.break_bar.size.height * global_scale_modifier;
|
||||
entity.break_bar.outline.thickness = entity.break_bar.outline.thickness * global_scale_modifier;
|
||||
entity.break_bar.outline.offset = entity.break_bar.outline.offset * global_scale_modifier;
|
||||
|
||||
entity.break_text_label.offset.x = entity.break_text_label.offset.x * global_scale_modifier;
|
||||
entity.break_text_label.offset.y = entity.break_text_label.offset.y * global_scale_modifier;
|
||||
@@ -69,6 +76,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
|
||||
entity.loss_bar.offset.y = entity.loss_bar.offset.y * global_scale_modifier;
|
||||
entity.loss_bar.size.width = entity.loss_bar.size.width * global_scale_modifier;
|
||||
entity.loss_bar.size.height = entity.loss_bar.size.height * global_scale_modifier;
|
||||
entity.loss_bar.outline.thickness = entity.loss_bar.outline.thickness * global_scale_modifier;
|
||||
entity.loss_bar.outline.offset = entity.loss_bar.outline.offset * global_scale_modifier;
|
||||
|
||||
entity.loss_text_label.offset.x = entity.loss_text_label.offset.x * global_scale_modifier;
|
||||
entity.loss_text_label.offset.y = entity.loss_text_label.offset.y * global_scale_modifier;
|
||||
@@ -88,7 +97,7 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
|
||||
if not part.body_part_dynamic_UI.part_visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local part_name = "";
|
||||
if cached_config.part_name_label.include.part_name then
|
||||
part_name = part.name .. " ";
|
||||
@@ -101,19 +110,20 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
|
||||
if cached_config.part_name_label.include.break_count then
|
||||
if cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
|
||||
|
||||
|
||||
elseif part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.break_count);
|
||||
end
|
||||
elseif cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. "/" .. tostring(part.break_max_count);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health,
|
||||
part.break_max_health);
|
||||
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
|
||||
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_health.offset.y,
|
||||
@@ -127,9 +137,9 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
|
||||
};
|
||||
|
||||
local loss_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y,
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -137,32 +147,42 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
|
||||
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and
|
||||
part.break_count < part.break_max_count then
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.loss_bar, loss_position_on_screen, opacity_scale, part.loss_health_percentage);
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.loss_bar, loss_position_on_screen, opacity_scale,
|
||||
part.loss_health_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(part.body_part_dynamic_UI.part_name_label, position_on_screen, opacity_scale, part_name);
|
||||
|
||||
if part.body_part_dynamic_UI.flinch_visibility then
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
|
||||
health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
100 * part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
|
||||
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and
|
||||
part.break_count < part.break_max_count then
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
break_health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
100 * part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
loss_health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
100 * part.loss_health_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -172,7 +192,7 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
|
||||
if not part.body_part_static_UI.part_visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local part_name = "";
|
||||
if cached_config.part_name_label.include.part_name then
|
||||
part_name = part.name .. " ";
|
||||
@@ -185,19 +205,20 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
|
||||
if cached_config.part_name_label.include.break_count then
|
||||
if cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
|
||||
|
||||
|
||||
elseif part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.break_count);
|
||||
end
|
||||
elseif cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. "/" .. tostring(part.break_max_count);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health,
|
||||
part.break_max_health);
|
||||
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
|
||||
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_health.offset.y,
|
||||
@@ -211,9 +232,9 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
|
||||
};
|
||||
|
||||
local loss_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y,
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -222,7 +243,8 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
|
||||
drawing.draw_bar(part.body_part_static_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
|
||||
drawing.draw_bar(part.body_part_static_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
@@ -234,19 +256,24 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
|
||||
if part.body_part_static_UI.flinch_visibility then
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage);
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
100 * part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
|
||||
drawing.draw_label(part.body_part_static_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_static_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage);
|
||||
drawing.draw_label(part.body_part_static_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
break_health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
100 * part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_label(part.body_part_static_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_static_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage);
|
||||
drawing.draw_label(part.body_part_static_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
loss_health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
100 * part.loss_health_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,7 +283,7 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
|
||||
if not part.body_part_highlighted_UI.part_visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local part_name = "";
|
||||
if cached_config.part_name_label.include.part_name then
|
||||
part_name = part.name .. " ";
|
||||
@@ -269,19 +296,20 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
|
||||
if cached_config.part_name_label.include.break_count then
|
||||
if cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
|
||||
|
||||
|
||||
elseif part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.break_count);
|
||||
end
|
||||
elseif cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. "/" .. tostring(part.break_max_count);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health,
|
||||
part.break_max_health);
|
||||
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
|
||||
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_health.offset.y,
|
||||
@@ -295,46 +323,56 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
|
||||
};
|
||||
|
||||
local loss_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y,
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
local draw_health = part.body_part_highlighted_UI.flinch_visibility and part.max_health > 0;
|
||||
local draw_break = part.body_part_highlighted_UI.break_visibility and part.break_max_health > 0 and part.break_count < part.break_max_count;
|
||||
local draw_break = part.body_part_highlighted_UI.break_visibility and part.break_max_health > 0 and
|
||||
part.break_count < part.break_max_count;
|
||||
local draw_loss = part.body_part_highlighted_UI.loss_visibility and part.loss_max_health > 0 and not part.is_severed;
|
||||
|
||||
if draw_health then
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
|
||||
part.health_percentage);
|
||||
end
|
||||
|
||||
if draw_break then
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
part.break_health_percentage);
|
||||
end
|
||||
|
||||
if draw_loss then
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.loss_bar, loss_position_on_screen, opacity_scale, part.loss_health_percentage);
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.loss_bar, loss_position_on_screen, opacity_scale,
|
||||
part.loss_health_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(part.body_part_highlighted_UI.part_name_label, position_on_screen, opacity_scale, part_name);
|
||||
|
||||
if draw_health then
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
|
||||
health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
100 * part.health_percentage);
|
||||
end
|
||||
|
||||
if draw_break then
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
break_health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
100 * part.break_health_percentage);
|
||||
end
|
||||
|
||||
if draw_loss then
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
loss_health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
100 * part.loss_health_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -344,4 +382,4 @@ function body_part_UI_entity.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
end
|
||||
|
||||
return body_part_UI_entity;
|
||||
return body_part_UI_entity;
|
||||
|
||||
@@ -5,7 +5,8 @@ local config;
|
||||
local player;
|
||||
local language;
|
||||
|
||||
function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label, hunter_rank_label, value_label, percentage_label, cart_count_label)
|
||||
function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label, hunter_rank_label, value_label,
|
||||
percentage_label, cart_count_label)
|
||||
local entity = {};
|
||||
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
@@ -24,16 +25,21 @@ function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label
|
||||
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.highlighted_bar.offset.x = entity.highlighted_bar.offset.x * global_scale_modifier;
|
||||
entity.highlighted_bar.offset.y = entity.highlighted_bar.offset.y * global_scale_modifier;
|
||||
entity.highlighted_bar.size.width = entity.highlighted_bar.size.width * global_scale_modifier;
|
||||
entity.highlighted_bar.size.height = entity.highlighted_bar.size.height * global_scale_modifier;
|
||||
entity.highlighted_bar.outline.thickness = entity.highlighted_bar.outline.thickness * global_scale_modifier;
|
||||
entity.highlighted_bar.outline.offset = entity.highlighted_bar.outline.offset * global_scale_modifier;
|
||||
|
||||
entity.player_name_label.offset.x = entity.player_name_label.offset.x * global_scale_modifier;
|
||||
entity.player_name_label.offset.y = entity.player_name_label.offset.y * global_scale_modifier;
|
||||
|
||||
entity.player_name_size_limit = config.current_config.damage_meter_UI.settings.player_name_size_limit * global_scale_modifier;
|
||||
entity.player_name_size_limit = config.current_config.damage_meter_UI.settings.player_name_size_limit *
|
||||
global_scale_modifier;
|
||||
|
||||
entity.dps_label.offset.x = entity.dps_label.offset.x * global_scale_modifier;
|
||||
entity.dps_label.offset.y = entity.dps_label.offset.y * global_scale_modifier;
|
||||
@@ -60,7 +66,7 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
|
||||
if _player.id == player.myself.id then
|
||||
player_include = cached_config.player_name_label.include.myself;
|
||||
end
|
||||
|
||||
|
||||
local player_name_text = "";
|
||||
|
||||
if player_include.master_rank and player_include.hunter_rank then
|
||||
@@ -117,20 +123,28 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id then
|
||||
if _player.damage_UI.hunter_rank_label.include.myself.master_rank and _player.damage_UI.hunter_rank_label.include.myself.hunter_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d:%d", _player.master_rank, _player.hunter_rank));
|
||||
if _player.damage_UI.hunter_rank_label.include.myself.master_rank and
|
||||
_player.damage_UI.hunter_rank_label.include.myself.hunter_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
|
||||
string.format("%d:%d", _player.master_rank, _player.hunter_rank));
|
||||
elseif _player.damage_UI.hunter_rank_label.include.myself.master_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.master_rank));
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
|
||||
string.format("%d", _player.master_rank));
|
||||
elseif _player.damage_UI.hunter_rank_label.include.myself.hunter_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.hunter_rank));
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
|
||||
string.format("%d", _player.hunter_rank));
|
||||
end
|
||||
else
|
||||
if _player.damage_UI.hunter_rank_label.include.others.master_rank and _player.damage_UI.hunter_rank_label.include.others.hunter_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d:%d", _player.master_rank, _player.hunter_rank));
|
||||
if _player.damage_UI.hunter_rank_label.include.others.master_rank and
|
||||
_player.damage_UI.hunter_rank_label.include.others.hunter_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
|
||||
string.format("%d:%d", _player.master_rank, _player.hunter_rank));
|
||||
elseif _player.damage_UI.hunter_rank_label.include.others.master_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.master_rank));
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
|
||||
string.format("%d", _player.master_rank));
|
||||
elseif _player.damage_UI.hunter_rank_label.include.others.hunter_rank then
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.hunter_rank));
|
||||
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
|
||||
string.format("%d", _player.hunter_rank));
|
||||
end
|
||||
end
|
||||
|
||||
@@ -152,4 +166,4 @@ function damage_UI_entity.init_module()
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
end
|
||||
|
||||
return damage_UI_entity;
|
||||
return damage_UI_entity;
|
||||
|
||||
@@ -19,6 +19,8 @@ function health_UI_entity.new(visibility, bar, text_label, value_label, percenta
|
||||
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.text_label.offset.x = entity.text_label.offset.x * global_scale_modifier;
|
||||
entity.text_label.offset.y = entity.text_label.offset.y * global_scale_modifier;
|
||||
@@ -51,4 +53,4 @@ function health_UI_entity.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
end
|
||||
|
||||
return health_UI_entity;
|
||||
return health_UI_entity;
|
||||
|
||||
@@ -20,6 +20,8 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
|
||||
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.text_label.offset.x = entity.text_label.offset.x * global_scale_modifier;
|
||||
entity.text_label.offset.y = entity.text_label.offset.y * global_scale_modifier;
|
||||
@@ -43,9 +45,10 @@ 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, 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);
|
||||
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);
|
||||
|
||||
@@ -62,4 +65,4 @@ function rage_UI_entity.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
end
|
||||
|
||||
return rage_UI_entity;
|
||||
return rage_UI_entity;
|
||||
|
||||
@@ -45,8 +45,9 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity
|
||||
|
||||
if monster.is_tired then
|
||||
drawing.draw_bar(stamina_UI.bar, position_on_screen, opacity_scale, monster.tired_timer_percentage);
|
||||
|
||||
drawing.draw_label(stamina_UI.timer_label, position_on_screen, opacity_scale, monster.tired_minutes_left, monster.tired_seconds_left);
|
||||
|
||||
drawing.draw_label(stamina_UI.timer_label, position_on_screen, opacity_scale, monster.tired_minutes_left,
|
||||
monster.tired_seconds_left);
|
||||
else
|
||||
drawing.draw_bar(stamina_UI.bar, position_on_screen, opacity_scale, monster.stamina_percentage);
|
||||
|
||||
@@ -62,4 +63,4 @@ function stamina_UI_entity.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
end
|
||||
|
||||
return stamina_UI_entity;
|
||||
return stamina_UI_entity;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,8 @@ drawing.font = nil;
|
||||
|
||||
function drawing.init_font()
|
||||
local cached_config = config.current_config.global_settings.UI_font;
|
||||
drawing.font = d2d.Font.new(cached_config.family, cached_config.size, cached_config.bold, cached_config.italic);
|
||||
drawing.font = d2d.Font.new(cached_config.family, cached_config.size, cached_config.bold,
|
||||
cached_config.italic);
|
||||
end
|
||||
|
||||
function drawing.argb_color_to_abgr_color(argb_color)
|
||||
@@ -31,7 +32,7 @@ function drawing.color_to_argb(color)
|
||||
end
|
||||
|
||||
function drawing.argb_to_color(alpha, red, green, blue)
|
||||
return 0x1000000 * alpha + 0x10000 * red + 0x100 * green + blue;
|
||||
return 0x1000000 * alpha + 0x10000 * red + 0x100 * green + blue;
|
||||
end
|
||||
|
||||
function drawing.limit_text_size(text, size_limit)
|
||||
@@ -44,7 +45,7 @@ function drawing.limit_text_size(text, size_limit)
|
||||
local text_width, text_height = drawing.font:measure(limited_text);
|
||||
|
||||
if text_width < size_limit then
|
||||
break;
|
||||
break
|
||||
else
|
||||
limited_text = unicode_helpers.sub(limited_text, 1, -5) .. "...";
|
||||
end
|
||||
@@ -54,7 +55,7 @@ function drawing.limit_text_size(text, size_limit)
|
||||
end
|
||||
|
||||
function drawing.scale_color_opacity(color, scale)
|
||||
local alpha, red, green, blue = drawing.color_to_argb(color);
|
||||
local alpha, red, green, blue = drawing.color_to_argb(color);
|
||||
local new_alpha = math.floor(alpha * scale);
|
||||
if new_alpha < 0 then new_alpha = 0; end
|
||||
if new_alpha > 255 then new_alpha = 255; end
|
||||
@@ -64,19 +65,19 @@ end
|
||||
|
||||
function drawing.scale_bar_opacity(bar, scale)
|
||||
if bar == nil
|
||||
or scale == nil
|
||||
or not bar.visibility then
|
||||
or scale == nil
|
||||
or not bar.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
bar.colors.foreground = drawing.scale_color_opacity(bar.colors.foreground, scale);
|
||||
bar.colors.background = drawing.scale_color_opacity(bar.colors.background, scale);
|
||||
end
|
||||
|
||||
function drawing.scale_label_opacity(label, scale)
|
||||
if label == nil
|
||||
or scale == nil
|
||||
or not label.visibility then
|
||||
or scale == nil
|
||||
or not label.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -86,17 +87,17 @@ end
|
||||
|
||||
function drawing.draw_label(label, position, opacity_scale, ...)
|
||||
if label == nil
|
||||
or not label.visibility then
|
||||
or not label.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local text = string.format(label.text, table.unpack({...}));
|
||||
|
||||
local text = string.format(label.text, table.unpack({ ... }));
|
||||
local position_x = position.x + label.offset.x;
|
||||
local position_y = position.y + label.offset.y;
|
||||
|
||||
|
||||
if label.shadow.visibility then
|
||||
local new_shadow_color = label.shadow.color;
|
||||
|
||||
|
||||
if opacity_scale < 1 then
|
||||
new_shadow_color = drawing.scale_color_opacity(new_shadow_color, opacity_scale);
|
||||
end
|
||||
@@ -120,12 +121,13 @@ function drawing.draw_label(label, position, opacity_scale, ...)
|
||||
new_color = drawing.argb_color_to_abgr_color(new_color);
|
||||
draw.text(text, position_x, position_y, new_color);
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function drawing.draw_bar(bar, position, opacity_scale, percentage)
|
||||
|
||||
if bar == nil
|
||||
or not bar.visibility then
|
||||
or not bar.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -137,63 +139,160 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
|
||||
percentage = 0;
|
||||
end
|
||||
|
||||
local position_x = position.x + bar.offset.x;
|
||||
local position_y = position.y + bar.offset.y;
|
||||
local foreground_width = bar.size.width * percentage;
|
||||
local background_width = bar.size.width - foreground_width;
|
||||
local outline_visibility = bar.outline.visibility;
|
||||
local style = bar.outline.style; -- Inside/Center/Outside
|
||||
|
||||
local new_foreground_color = bar.colors.foreground;
|
||||
local new_background_color = bar.colors.background;
|
||||
local outline_thickness = bar.outline.thickness;
|
||||
if not outline_visibility then
|
||||
outline_thickness = 0;
|
||||
end
|
||||
|
||||
local half_outline_thickness = outline_thickness / 2;
|
||||
|
||||
local outline_offset = bar.outline.offset;
|
||||
|
||||
if outline_thickness == 0 then
|
||||
outline_offset = 0;
|
||||
end
|
||||
local half_outline_offset = outline_offset / 2;
|
||||
|
||||
local outline_position_x = 0;
|
||||
local outline_position_y = 0;
|
||||
|
||||
local outline_width = 0;
|
||||
local outline_height = 0;
|
||||
|
||||
local position_x = 0;
|
||||
local position_y = 0;
|
||||
|
||||
local foreground_width = 0;
|
||||
local background_width = 0;
|
||||
local height = 0;
|
||||
|
||||
if style == "Inside" then
|
||||
outline_position_x = position.x + bar.offset.x + half_outline_thickness;
|
||||
outline_position_y = position.y + bar.offset.y + half_outline_thickness;
|
||||
|
||||
outline_width = bar.size.width - outline_thickness;
|
||||
outline_height = bar.size.height - outline_thickness;
|
||||
|
||||
position_x = outline_position_x + half_outline_thickness + outline_offset;
|
||||
position_y = outline_position_y + half_outline_thickness + outline_offset;
|
||||
|
||||
local width = outline_width - outline_thickness - outline_offset - outline_offset;
|
||||
foreground_width = width * percentage;
|
||||
background_width = width - foreground_width;
|
||||
|
||||
height = outline_height - outline_thickness - outline_offset - outline_offset;
|
||||
|
||||
elseif style == "Center" then
|
||||
outline_position_x = position.x + bar.offset.x - half_outline_offset;
|
||||
outline_position_y = position.y + bar.offset.y - half_outline_offset;
|
||||
|
||||
outline_width = bar.size.width + outline_offset;
|
||||
outline_height = bar.size.height + outline_offset;
|
||||
|
||||
position_x = outline_position_x + half_outline_thickness + outline_offset;
|
||||
position_y = outline_position_y + half_outline_thickness + outline_offset;
|
||||
|
||||
local width = outline_width - outline_thickness - outline_offset - outline_offset;
|
||||
foreground_width = width * percentage;
|
||||
background_width = width - foreground_width;
|
||||
|
||||
height = outline_height - outline_thickness - outline_offset - outline_offset;
|
||||
|
||||
else
|
||||
position_x = position.x + bar.offset.x;
|
||||
position_y = position.y + bar.offset.y;
|
||||
|
||||
local width = bar.size.width;
|
||||
height = bar.size.height;
|
||||
|
||||
foreground_width = width * percentage;
|
||||
background_width = width - foreground_width;
|
||||
|
||||
outline_position_x = position_x - half_outline_thickness - outline_offset;
|
||||
outline_position_y = position_y - half_outline_thickness - outline_offset;
|
||||
|
||||
outline_width = width + outline_thickness + outline_offset + outline_offset;
|
||||
outline_height = height + outline_thickness + outline_offset + outline_offset;
|
||||
end
|
||||
|
||||
local foreground_color = bar.colors.foreground;
|
||||
local background_color = bar.colors.background;
|
||||
local outline_color = bar.colors.outline;
|
||||
|
||||
if opacity_scale < 1 then
|
||||
new_foreground_color = drawing.scale_color_opacity(new_foreground_color, opacity_scale);
|
||||
new_background_color = drawing.scale_color_opacity(new_background_color, opacity_scale);
|
||||
foreground_color = drawing.scale_color_opacity(foreground_color, opacity_scale);
|
||||
background_color = drawing.scale_color_opacity(background_color, opacity_scale);
|
||||
outline_color = drawing.scale_color_opacity(outline_color, opacity_scale);
|
||||
end
|
||||
|
||||
local use_d2d = d2d ~= nil;
|
||||
|
||||
-- outline
|
||||
if outline_thickness ~= 0 then
|
||||
if use_d2d then
|
||||
d2d.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_thickness,
|
||||
outline_color);
|
||||
else
|
||||
outline_color = drawing.argb_color_to_abgr_color(outline_color);
|
||||
draw.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_color);
|
||||
end
|
||||
end
|
||||
|
||||
-- foreground
|
||||
if d2d ~= nil then
|
||||
d2d.fill_rect(position_x, position_y, foreground_width, bar.size.height, new_foreground_color);
|
||||
else
|
||||
new_foreground_color = drawing.argb_color_to_abgr_color(new_foreground_color);
|
||||
draw.filled_rect(position_x, position_y, foreground_width, bar.size.height, new_foreground_color)
|
||||
if foreground_width ~= 0 then
|
||||
if use_d2d then
|
||||
d2d.fill_rect(position_x, position_y, foreground_width, height, foreground_color);
|
||||
|
||||
else
|
||||
foreground_color = drawing.argb_color_to_abgr_color(foreground_color);
|
||||
draw.filled_rect(position_x, position_y, foreground_width, height, foreground_color)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- background
|
||||
if d2d ~= nil then
|
||||
d2d.fill_rect(position_x + foreground_width, position_y, background_width, bar.size.height, new_background_color);
|
||||
else
|
||||
new_background_color = drawing.argb_color_to_abgr_color(new_background_color);
|
||||
draw.filled_rect(position_x + foreground_width, position_y, background_width, bar.size.height, new_background_color)
|
||||
if background_width ~= 0 then
|
||||
if use_d2d then
|
||||
d2d.fill_rect(position_x + foreground_width, position_y, background_width, height, background_color);
|
||||
else
|
||||
background_color = drawing.argb_color_to_abgr_color(background_color);
|
||||
draw.filled_rect(position_x + foreground_width, position_y, background_width, height, background_color)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function drawing.draw_capture_line(health_UI, position, opacity_scale, percentage)
|
||||
if health_UI == nil
|
||||
or not health_UI.visibility
|
||||
or health_UI.bar == nil
|
||||
or not health_UI.bar.visibility
|
||||
or health_UI.bar.capture_line == nil
|
||||
or not health_UI.bar.capture_line.visibility
|
||||
or percentage >= 1
|
||||
or percentage <= 0 then
|
||||
or not health_UI.visibility
|
||||
or health_UI.bar == nil
|
||||
or not health_UI.bar.visibility
|
||||
or health_UI.bar.capture_line == nil
|
||||
or not health_UI.bar.capture_line.visibility
|
||||
or percentage >= 1
|
||||
or percentage <= 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local position_x = position.x + health_UI.bar.offset.x + health_UI.bar.capture_line.offset.x + health_UI.bar.size.width * percentage;
|
||||
|
||||
local position_x = position.x + health_UI.bar.offset.x + health_UI.bar.capture_line.offset.x +
|
||||
health_UI.bar.size.width * percentage;
|
||||
local position_y = position.y + health_UI.bar.offset.y + health_UI.bar.capture_line.offset.y;
|
||||
|
||||
local color = health_UI.bar.capture_line.color;
|
||||
|
||||
if opacity_scale < 1 then
|
||||
color = drawing.scale_color_opacity(color, opacity_scale);
|
||||
color = drawing.scale_color_opacity(color, opacity_scale);
|
||||
end
|
||||
|
||||
if d2d ~= nil then
|
||||
d2d.fill_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height, color);
|
||||
d2d.fill_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height,
|
||||
color);
|
||||
else
|
||||
color = drawing.argb_color_to_abgr_color(color);
|
||||
draw.filled_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height, color)
|
||||
draw.filled_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height
|
||||
, color)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -203,4 +302,4 @@ function drawing.init_module()
|
||||
unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers");
|
||||
end
|
||||
|
||||
return drawing;
|
||||
return drawing;
|
||||
|
||||
Reference in New Issue
Block a user