Refactoring

This commit is contained in:
GreenComfyTea
2022-07-26 19:27:37 +03:00
parent a20c458629
commit 2f9a8ac6a3
41 changed files with 5939 additions and 18587 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;