mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Add include options for value/max labels
This commit is contained in:
@@ -363,4 +363,4 @@ end
|
||||
|
||||
if imgui.begin_table == nil then
|
||||
re.msg(language.current_language.customization_menu.reframework_outdated);
|
||||
end
|
||||
end
|
||||
@@ -64,9 +64,7 @@ local height_field = size_type:get_field("h");
|
||||
|
||||
function screen.get_game_window_size()
|
||||
if scene_view == nil then
|
||||
scene_view = sdk.call_native_func(singletons.scene_manager,
|
||||
sdk.find_type_definition("via.SceneManager")
|
||||
, "get_MainView");
|
||||
scene_view = sdk.call_native_func(singletons.scene_manager, sdk.find_type_definition("via.SceneManager") , "get_MainView");
|
||||
|
||||
if scene_view == nil then
|
||||
--log.error("[MHR_Overlay.lua] No scene view");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -494,6 +494,9 @@ language.default_language = {
|
||||
duration = "Duration",
|
||||
hide_bar_for_infinite_buffs = "Hide Bar for infinite Buffs",
|
||||
hide_timer_for_infinite_buffs = "Hide Timer for infinite Buffs",
|
||||
|
||||
current_value = "Current Value",
|
||||
max_value = "Max Value"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -85,20 +85,32 @@ function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
local total_buildup_string = "";
|
||||
if not ailment.is_active then
|
||||
local include_current_value = ailment_UI.value_label.include.current_value;
|
||||
local include_max_value = ailment_UI.value_label.include.max_value;
|
||||
|
||||
if include_current_value and include_max_value then
|
||||
total_buildup_string = string.format("%.0f/%.0f", ailment.total_buildup, ailment.buildup_limit);
|
||||
elseif include_current_value then
|
||||
total_buildup_string = string.format("%.0f", ailment.total_buildup);
|
||||
elseif include_max_value then
|
||||
total_buildup_string = string.format("%.0f", ailment.buildup_limit);
|
||||
end
|
||||
end
|
||||
|
||||
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, total_buildup_string);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -151,9 +151,50 @@ function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_scre
|
||||
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 loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
-- health value string
|
||||
local health_string = "";
|
||||
if draw_health then
|
||||
local include_health_current_value = part_UI.flinch_value_label.include.current_value;
|
||||
local include_health_max_value = part_UI.flinch_value_label.include.max_value;
|
||||
|
||||
if include_health_current_value and include_health_max_value then
|
||||
health_string = string.format("%.0f/%.0f", part.health, part.max_health);
|
||||
elseif include_health_current_value then
|
||||
health_string = string.format("%.0f", part.health);
|
||||
elseif include_health_max_value then
|
||||
health_string = string.format("%.0f", part.max_health);
|
||||
end
|
||||
end
|
||||
|
||||
-- break health value string
|
||||
local break_health_string = "";
|
||||
if draw_break then
|
||||
local include_break_health_current_value = part_UI.break_value_label.include.current_value;
|
||||
local include_break_health_max_value = part_UI.break_value_label.include.max_value;
|
||||
|
||||
if include_break_health_current_value and include_break_health_max_value then
|
||||
break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
|
||||
elseif include_break_health_current_value then
|
||||
break_health_string = string.format("%.0f", part.break_health);
|
||||
elseif include_break_health_max_value then
|
||||
break_health_string = string.format("%.0f", part.break_max_health);
|
||||
end
|
||||
end
|
||||
|
||||
-- loss health value string
|
||||
local loss_health_string = "";
|
||||
if draw_severe then
|
||||
local include_loss_health_current_value = part_UI.loss_value_label.include.current_value;
|
||||
local include_loss_health_max_value = part_UI.loss_value_label.include.max_value;
|
||||
|
||||
if include_loss_health_current_value and include_loss_health_max_value then
|
||||
loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
elseif include_loss_health_current_value then
|
||||
loss_health_string = string.format("%.0f", part.loss_health);
|
||||
elseif include_loss_health_max_value then
|
||||
loss_health_string = string.format("%.0f", part.loss_max_health);
|
||||
end
|
||||
end
|
||||
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
@@ -177,7 +218,7 @@ function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_scre
|
||||
drawing.draw_bar(part_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
|
||||
end
|
||||
|
||||
if draw_break then
|
||||
if draw_break then
|
||||
drawing.draw_bar(part_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
|
||||
end
|
||||
|
||||
|
||||
@@ -69,10 +69,22 @@ function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_s
|
||||
return;
|
||||
end
|
||||
|
||||
local include_current_value = health_UI.value_label.include.current_value;
|
||||
local include_max_value = health_UI.value_label.include.max_value;
|
||||
|
||||
local health_string;
|
||||
if include_current_value and include_max_value then
|
||||
health_string = string.format("%.0f/%.0f", monster.health, monster.max_health);
|
||||
elseif include_current_value then
|
||||
health_string = string.format("%.0f", monster.health);
|
||||
elseif include_max_value then
|
||||
health_string = string.format("%.0f", monster.max_health);
|
||||
end
|
||||
|
||||
drawing.draw_bar(health_UI.bar, position_on_screen, opacity_scale, monster.health_percentage);
|
||||
|
||||
drawing.draw_label(health_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.HP);
|
||||
drawing.draw_label(health_UI.value_label, position_on_screen, opacity_scale, monster.health, monster.max_health);
|
||||
drawing.draw_label(health_UI.value_label, position_on_screen, opacity_scale, health_string);
|
||||
drawing.draw_label(health_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.health_percentage);
|
||||
end
|
||||
|
||||
|
||||
@@ -73,6 +73,20 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale
|
||||
return;
|
||||
end
|
||||
|
||||
local rage_string = "";
|
||||
if not monster.is_in_rage then
|
||||
local include_current_value = rage_UI.value_label.include.current_value;
|
||||
local include_max_value = rage_UI.value_label.include.max_value;
|
||||
|
||||
if include_current_value and include_max_value then
|
||||
rage_string = string.format("%.0f/%.0f", monster.rage_point, monster.rage_limit);
|
||||
elseif include_current_value then
|
||||
rage_string = string.format("%.0f", monster.rage_point);
|
||||
elseif include_max_value then
|
||||
rage_string = string.format("%.0f", monster.rage_limit);
|
||||
end
|
||||
end
|
||||
|
||||
if monster.is_in_rage then
|
||||
drawing.draw_bar(rage_UI.bar, position_on_screen, opacity_scale, monster.rage_timer_percentage);
|
||||
|
||||
@@ -83,7 +97,7 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale
|
||||
drawing.draw_bar(rage_UI.bar, position_on_screen, opacity_scale, monster.rage_percentage);
|
||||
|
||||
drawing.draw_label(rage_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.rage);
|
||||
drawing.draw_label(rage_UI.value_label, position_on_screen, opacity_scale, monster.rage_point, monster.rage_limit);
|
||||
drawing.draw_label(rage_UI.value_label, position_on_screen, opacity_scale, rage_string);
|
||||
drawing.draw_label(rage_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.rage_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,17 +71,30 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity
|
||||
return;
|
||||
end
|
||||
|
||||
local stamina_string = "";
|
||||
if not monster.is_tired then
|
||||
local include_current_value = stamina_UI.value_label.include.current_value;
|
||||
local include_max_value = stamina_UI.value_label.include.max_value;
|
||||
|
||||
if include_current_value and include_max_value then
|
||||
stamina_string = string.format("%.0f/%.0f", monster.stamina, monster.max_stamina);
|
||||
elseif include_current_value then
|
||||
stamina_string = string.format("%.0f", monster.stamina);
|
||||
elseif include_max_value then
|
||||
stamina_string = string.format("%.0f", monster.max_stamina);
|
||||
end
|
||||
end
|
||||
|
||||
drawing.draw_label(stamina_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.stamina);
|
||||
|
||||
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);
|
||||
|
||||
drawing.draw_label(stamina_UI.value_label, position_on_screen, opacity_scale, monster.stamina, monster.max_stamina);
|
||||
drawing.draw_label(stamina_UI.value_label, position_on_screen, opacity_scale, stamina_string);
|
||||
drawing.draw_label(stamina_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.stamina_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -124,7 +124,12 @@ function drawing.draw_label(label, position, opacity_scale, ...)
|
||||
return;
|
||||
end
|
||||
|
||||
local text = string.format(label.text, table.unpack({...}));
|
||||
local text = string.format(label.text_format, table.unpack({...}));
|
||||
|
||||
if text == "" then
|
||||
return;
|
||||
end
|
||||
|
||||
local position_x = position.x + label.offset.x;
|
||||
local position_y = position.y + label.offset.y;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user