mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-25 04:48:22 -08:00
Release v1.11
1) Cache config access function-wide where possible; 2) Break and Sever values added to parts; 3) Hooks are now applied in init_module instead of global space; 4) Added checks for submodule (health, stamina, etc) visibility. If not visible, do not pull data.
This commit is contained in:
@@ -11,29 +11,32 @@ local table_helpers;
|
||||
local drawing;
|
||||
|
||||
function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_screen, opacity_scale)
|
||||
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.visibility then
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
if not cached_config.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if id == ailments.stun_id then
|
||||
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.filter.stun then
|
||||
if not cached_config.filter.stun then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
elseif id == ailments.poison_id then
|
||||
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.filter.poison then
|
||||
if not cached_config.filter.poison then
|
||||
goto continue;
|
||||
end
|
||||
elseif id == ailments.blast_id then
|
||||
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.filter.blast then
|
||||
if not cached_config.filter.blast then
|
||||
goto continue;
|
||||
end
|
||||
else
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -61,8 +64,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.id < right.id;
|
||||
end);
|
||||
@@ -71,8 +74,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
return left.id > right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.type == "Buildup" then
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup < right.buildup;
|
||||
end);
|
||||
@@ -81,8 +84,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
return left.buildup > right.buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup_share < right.buildup_share;
|
||||
end);
|
||||
@@ -94,10 +97,10 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
end
|
||||
|
||||
local ailment_name = "";
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_name_label.include.ailment_name then
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
@@ -107,8 +110,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
local last_j = 0;
|
||||
for j, _player in ipairs(displayed_players) do
|
||||
local ailment_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
|
||||
};
|
||||
|
||||
ailment_buildup_UI_entity.draw_dynamic(_player, monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
|
||||
@@ -119,8 +122,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
|
||||
|
||||
local total_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
|
||||
};
|
||||
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
|
||||
@@ -128,8 +131,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
|
||||
|
||||
ailment_buildups_position_on_screen = {
|
||||
x = total_buildup_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
|
||||
};
|
||||
|
||||
::continue::
|
||||
@@ -139,29 +142,32 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
|
||||
end
|
||||
|
||||
function ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale)
|
||||
if not config.current_config.large_monster_UI.static.ailment_buildups.visibility then
|
||||
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
if not cached_config.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if id == ailments.stun_id then
|
||||
if not config.current_config.large_monster_UI.static.ailment_buildups.filter.stun then
|
||||
if not cached_config.filter.stun then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
elseif id == ailments.poison_id then
|
||||
if not config.current_config.large_monster_UI.static.ailment_buildups.filter.poison then
|
||||
if not cached_config.filter.poison then
|
||||
goto continue;
|
||||
end
|
||||
elseif id == ailments.blast_id then
|
||||
if not config.current_config.large_monster_UI.static.ailment_buildups.filter.blast then
|
||||
if not cached_config.filter.blast then
|
||||
goto continue;
|
||||
end
|
||||
else
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.static.ailment_buildups.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -189,8 +195,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.id < right.id;
|
||||
end);
|
||||
@@ -199,8 +205,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
return left.id > right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.ailment_buildups.sorting.type == "Buildup" then
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup < right.buildup;
|
||||
end);
|
||||
@@ -209,8 +215,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
return left.buildup > right.buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.ailment_buildups.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup_share < right.buildup_share;
|
||||
end);
|
||||
@@ -222,10 +228,10 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
end
|
||||
|
||||
local ailment_name = "";
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.ailment_name_label.include.ailment_name then
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if config.current_config.large_monster_UI.static.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
@@ -234,8 +240,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
local last_j = 0;
|
||||
for j, _player in ipairs(displayed_players) do
|
||||
local ailment_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
|
||||
};
|
||||
|
||||
ailment_buildup_UI_entity.draw_static(_player, monster.ailments[ailments.stun_id].ailment_buildup_static_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
|
||||
@@ -244,8 +250,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
end
|
||||
|
||||
local total_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
|
||||
};
|
||||
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
|
||||
@@ -253,8 +259,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
|
||||
|
||||
ailment_buildups_position_on_screen = {
|
||||
x = total_buildup_position_on_screen.x + config.current_config.large_monster_UI.static.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + config.current_config.large_monster_UI.static.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
|
||||
};
|
||||
|
||||
::continue::
|
||||
@@ -264,29 +270,32 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
|
||||
end
|
||||
|
||||
function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale)
|
||||
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.visibility then
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
if not cached_config.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if id == ailments.stun_id then
|
||||
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.filter.stun then
|
||||
if not cached_config.filter.stun then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
elseif id == ailments.poison_id then
|
||||
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.filter.poison then
|
||||
if not cached_config.filter.poison then
|
||||
goto continue;
|
||||
end
|
||||
elseif id == ailments.blast_id then
|
||||
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.filter.blast then
|
||||
if not cached_config.filter.blast then
|
||||
goto continue;
|
||||
end
|
||||
else
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -314,8 +323,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.id < right.id;
|
||||
end);
|
||||
@@ -324,8 +333,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
return left.id > right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.type == "Buildup" then
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup < right.buildup;
|
||||
end);
|
||||
@@ -334,8 +343,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
return left.buildup > right.buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup_share < right.buildup_share;
|
||||
end);
|
||||
@@ -347,10 +356,10 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
end
|
||||
|
||||
local ailment_name = "";
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_name_label.include.ailment_name then
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
@@ -359,8 +368,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
local last_j = 0;
|
||||
for j, _player in ipairs(displayed_players) do
|
||||
local ailment_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
|
||||
};
|
||||
|
||||
ailment_buildup_UI_entity.draw_highlighted(_player, monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
|
||||
@@ -369,8 +378,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
end
|
||||
|
||||
local total_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
|
||||
};
|
||||
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
|
||||
@@ -378,8 +387,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
|
||||
|
||||
ailment_buildups_position_on_screen = {
|
||||
x = total_buildup_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
|
||||
};
|
||||
|
||||
::continue::
|
||||
@@ -389,29 +398,32 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
|
||||
end
|
||||
|
||||
function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale)
|
||||
if not config.current_config.small_monster_UI.ailment_buildups.visibility then
|
||||
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
if not cached_config.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if id == ailments.stun_id then
|
||||
if not config.current_config.small_monster_UI.ailment_buildups.filter.stun then
|
||||
if not cached_config.filter.stun then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
elseif id == ailments.poison_id then
|
||||
if not config.current_config.small_monster_UI.ailment_buildups.filter.poison then
|
||||
if not cached_config.filter.poison then
|
||||
goto continue;
|
||||
end
|
||||
elseif id == ailments.blast_id then
|
||||
if not config.current_config.small_monster_UI.ailment_buildups.filter.blast then
|
||||
if not cached_config.filter.blast then
|
||||
goto continue;
|
||||
end
|
||||
else
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.small_monster_UI.ailment_buildups.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -439,8 +451,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailment_buildups.sorting.type == "Normal" then
|
||||
if config.current_config.small_monster_UI.ailment_buildups.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.id < right.id;
|
||||
end);
|
||||
@@ -449,8 +461,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
return left.id > right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.small_monster_UI.ailment_buildups.sorting.type == "Buildup" then
|
||||
if config.current_config.small_monster_UI.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup < right.buildup;
|
||||
end);
|
||||
@@ -459,8 +471,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
return left.buildup > right.buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.small_monster_UI.ailment_buildups.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.small_monster_UI.ailment_buildups.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_players, function(left, right)
|
||||
return left.buildup_share < right.buildup_share;
|
||||
end);
|
||||
@@ -472,10 +484,10 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
end
|
||||
|
||||
local ailment_name = "";
|
||||
if config.current_config.small_monster_UI.ailment_buildups.ailment_name_label.include.ailment_name then
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if config.current_config.small_monster_UI.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
@@ -484,8 +496,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
local last_j = 0;
|
||||
for j, _player in ipairs(displayed_players) do
|
||||
local ailment_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.small_monster_UI.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
|
||||
};
|
||||
|
||||
ailment_buildup_UI_entity.draw_small(_player, monster.ailments[ailments.stun_id].ailment_buildup_small_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
|
||||
@@ -494,8 +506,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
end
|
||||
|
||||
local total_buildup_position_on_screen = {
|
||||
x = ailment_buildups_position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + config.current_config.small_monster_UI.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
|
||||
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
|
||||
};
|
||||
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
|
||||
@@ -503,8 +515,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
|
||||
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
|
||||
|
||||
ailment_buildups_position_on_screen = {
|
||||
x = total_buildup_position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + config.current_config.small_monster_UI.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
|
||||
y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
|
||||
};
|
||||
|
||||
::continue::
|
||||
|
||||
@@ -20,18 +20,6 @@ local stock_damage_method = enemy_damage_param_type_def:get_method("stockDamage"
|
||||
local poison_param_field = enemy_damage_param_type_def:get_field("_PoisonParam");
|
||||
local blast_param_field = enemy_damage_param_type_def:get_field("_BlastParam");
|
||||
|
||||
sdk.hook(stock_damage_method, function(args)
|
||||
pcall(ailment_hook.stock_damage);
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(on_poison_activate_proc_method, function(args)
|
||||
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
function ailment_hook.poison_proc(poison_param)
|
||||
if poison_param == nil then
|
||||
return;
|
||||
@@ -54,7 +42,7 @@ function ailment_hook.poison_proc(poison_param)
|
||||
monster = small_monster.get_monster(enemy);
|
||||
end
|
||||
|
||||
monster.ailments[ailments.poison_id].cashed_buildup_share = monster.ailments[ailments.poison_id].buildup_share;
|
||||
monster.ailments[ailments.poison_id].cached_buildup_share = monster.ailments[ailments.poison_id].buildup_share;
|
||||
ailments.clear_ailment_contribution(monster, ailments.poison_id);
|
||||
end
|
||||
|
||||
@@ -92,6 +80,18 @@ function ailment_hook.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
ailments = require("MHR_Overlay.Monsters.ailments");
|
||||
table_helpers = require("MHR_Overlay.Misc.table_helpers");
|
||||
|
||||
sdk.hook(stock_damage_method, function(args)
|
||||
pcall(ailment_hook.stock_damage);
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(on_poison_activate_proc_method, function(args)
|
||||
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
end
|
||||
|
||||
return ailment_hook;
|
||||
@@ -140,7 +140,7 @@ function ailments.init_ailments()
|
||||
|
||||
_ailments[ailments.poison_id].buildup = {};
|
||||
_ailments[ailments.poison_id].buildup_share = {};
|
||||
_ailments[ailments.poison_id].cashed_buildup_share = {};
|
||||
_ailments[ailments.poison_id].cached_buildup_share = {};
|
||||
|
||||
_ailments[ailments.blast_id].buildup = {};
|
||||
_ailments[ailments.blast_id].buildup_share = {};
|
||||
@@ -161,54 +161,62 @@ function ailments.init_ailment_buildup_UI(_ailments)
|
||||
end
|
||||
|
||||
function ailments.init_ailment_buildup_dynamic_UI(_ailments)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
|
||||
|
||||
_ailments[ailments.stun_id].ailment_buildup_dynamic_UI = ailment_buildup_UI_entity.new(
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.buildup_bar,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.highlighted_buildup_bar,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_name_label,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.player_name_label,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.buildup_value_label,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.buildup_percentage_label,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.total_buildup_label,
|
||||
config.current_config.large_monster_UI.dynamic.ailment_buildups.total_buildup_value_label
|
||||
cached_config.buildup_bar,
|
||||
cached_config.highlighted_buildup_bar,
|
||||
cached_config.ailment_name_label,
|
||||
cached_config.player_name_label,
|
||||
cached_config.buildup_value_label,
|
||||
cached_config.buildup_percentage_label,
|
||||
cached_config.total_buildup_label,
|
||||
cached_config.total_buildup_value_label
|
||||
);
|
||||
end
|
||||
|
||||
function ailments.init_ailment_buildup_static_UI(_ailments)
|
||||
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
|
||||
|
||||
_ailments[ailments.stun_id].ailment_buildup_static_UI = ailment_buildup_UI_entity.new(
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.buildup_bar,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.highlighted_buildup_bar,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.ailment_name_label,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.player_name_label,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.buildup_value_label,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.buildup_percentage_label,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.total_buildup_label,
|
||||
config.current_config.large_monster_UI.static.ailment_buildups.total_buildup_value_label
|
||||
cached_config.buildup_bar,
|
||||
cached_config.highlighted_buildup_bar,
|
||||
cached_config.ailment_name_label,
|
||||
cached_config.player_name_label,
|
||||
cached_config.buildup_value_label,
|
||||
cached_config.buildup_percentage_label,
|
||||
cached_config.total_buildup_label,
|
||||
cached_config.total_buildup_value_label
|
||||
);
|
||||
end
|
||||
|
||||
function ailments.init_ailment_buildup_highlighted_UI(_ailments)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
|
||||
|
||||
_ailments[ailments.stun_id].ailment_buildup_highlighted_UI = ailment_buildup_UI_entity.new(
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.buildup_bar,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.highlighted_buildup_bar,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_name_label,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.player_name_label,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.buildup_value_label,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.buildup_percentage_label,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.total_buildup_label,
|
||||
config.current_config.large_monster_UI.highlighted.ailment_buildups.total_buildup_value_label
|
||||
cached_config.buildup_bar,
|
||||
cached_config.highlighted_buildup_bar,
|
||||
cached_config.ailment_name_label,
|
||||
cached_config.player_name_label,
|
||||
cached_config.buildup_value_label,
|
||||
cached_config.buildup_percentage_label,
|
||||
cached_config.total_buildup_label,
|
||||
cached_config.total_buildup_value_label
|
||||
);
|
||||
end
|
||||
|
||||
function ailments.init_ailment_buildup_small_UI(_ailments)
|
||||
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
|
||||
|
||||
_ailments[ailments.stun_id].ailment_buildup_small_UI = ailment_buildup_UI_entity.new(
|
||||
config.current_config.small_monster_UI.ailment_buildups.buildup_bar,
|
||||
config.current_config.small_monster_UI.ailment_buildups.highlighted_buildup_bar,
|
||||
config.current_config.small_monster_UI.ailment_buildups.ailment_name_label,
|
||||
config.current_config.small_monster_UI.ailment_buildups.player_name_label,
|
||||
config.current_config.small_monster_UI.ailment_buildups.buildup_value_label,
|
||||
config.current_config.small_monster_UI.ailment_buildups.buildup_percentage_label,
|
||||
config.current_config.small_monster_UI.ailment_buildups.total_buildup_label,
|
||||
config.current_config.small_monster_UI.ailment_buildups.total_buildup_value_label
|
||||
cached_config.buildup_bar,
|
||||
cached_config.highlighted_buildup_bar,
|
||||
cached_config.ailment_name_label,
|
||||
cached_config.player_name_label,
|
||||
cached_config.buildup_value_label,
|
||||
cached_config.buildup_percentage_label,
|
||||
cached_config.total_buildup_label,
|
||||
cached_config.total_buildup_value_label
|
||||
);
|
||||
end
|
||||
|
||||
@@ -253,7 +261,7 @@ function ailments.update_ailments(enemy, monster)
|
||||
end
|
||||
|
||||
ailments.update_stun_poison_blast_ailments(monster, damage_param);
|
||||
|
||||
|
||||
if not config.current_config.large_monster_UI.dynamic.ailments.visibility
|
||||
and not config.current_config.large_monster_UI.static.ailments.visibility
|
||||
and not config.current_config.large_monster_UI.highlighted.ailments.visibility
|
||||
@@ -276,6 +284,7 @@ function ailments.update_ailments(enemy, monster)
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
for index, ailment_param in ipairs(condition_param_table) do
|
||||
local id = index - 1;
|
||||
if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then
|
||||
@@ -307,7 +316,7 @@ end
|
||||
|
||||
function ailments.update_ailment(monster, ailment_param, id)
|
||||
local is_enable = get_is_enable_method:call(ailment_param);
|
||||
local activate_count = get_activate_count_method:call(ailment_param):get_element(0):get_field("mValue");
|
||||
local activate_count = get_activate_count_method:call(ailment_param):get_element(0):get_field("mValue") or 0;
|
||||
local buildup = get_stock_method:call(ailment_param):get_element(0):get_field("mValue");
|
||||
local buildup_limit = get_limit_method:call(ailment_param):get_element(0):get_field("mValue");
|
||||
local timer = get_active_timer_method:call(ailment_param);
|
||||
@@ -315,13 +324,16 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
local is_active = get_is_active_method:call(ailment_param);
|
||||
|
||||
if is_enable ~= nil then
|
||||
if is_enable ~= monster.ailments[id].is_enable then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].is_enable = is_enable;
|
||||
is_enable = true;
|
||||
end
|
||||
|
||||
|
||||
if is_enable ~= monster.ailments[id].is_enable then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].is_enable = is_enable;
|
||||
|
||||
if activate_count ~= nil then
|
||||
if activate_count ~= monster.ailments[id].activate_count then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
@@ -435,30 +447,33 @@ function ailments.update_poison_blast(monster, poison_param, blast_param)
|
||||
end
|
||||
|
||||
function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.ailments;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
--sort parts here
|
||||
local displayed_ailments = {};
|
||||
for REpart, ailment in pairs(monster.ailments) do
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_all_active_ailments and ailment.is_active then
|
||||
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.dynamic.ailments.settings.time_limit and not ailment.is_active then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -467,8 +482,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
|
||||
end
|
||||
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -477,8 +492,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.ailments.sorting.type == "Buildup" then
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.total_buildup > right.total_buildup;
|
||||
end);
|
||||
@@ -487,8 +502,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
|
||||
return left.total_buildup < right.total_buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.ailments.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.buildup_percentage > right.buildup_percentage;
|
||||
end);
|
||||
@@ -501,8 +516,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
|
||||
|
||||
for j, ailment in ipairs(displayed_ailments) do
|
||||
local ailment_position_on_screen = {
|
||||
x = ailments_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
ailment_UI_entity.draw_dynamic(ailment, monster.ailment_dynamic_UI, ailment_position_on_screen, opacity_scale);
|
||||
end
|
||||
@@ -511,31 +526,33 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
|
||||
end
|
||||
|
||||
function ailments.draw_static(monster, ailments_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.static.ailments;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
--sort parts here
|
||||
local displayed_ailments = {};
|
||||
for REpart, ailment in pairs(monster.ailments) do
|
||||
if config.current_config.large_monster_UI.static.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailments.settings.hide_all_active_ailments and ailment.is_active then
|
||||
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailments.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.static.ailments.settings.time_limit and not ailment.is_active then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -544,8 +561,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
|
||||
end
|
||||
|
||||
|
||||
if config.current_config.large_monster_UI.static.ailments.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.static.ailments.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -554,8 +571,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.ailments.sorting.type == "Buildup" then
|
||||
if config.current_config.large_monster_UI.static.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.total_buildup > right.total_buildup;
|
||||
end);
|
||||
@@ -564,8 +581,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
|
||||
return left.total_buildup < right.total_buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.ailments.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.large_monster_UI.static.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.buildup_percentage > right.buildup_percentage;
|
||||
end);
|
||||
@@ -578,8 +595,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
|
||||
|
||||
for j, ailment in ipairs(displayed_ailments) do
|
||||
local ailment_position_on_screen = {
|
||||
x = ailments_position_on_screen.x + config.current_config.large_monster_UI.static.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + config.current_config.large_monster_UI.static.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
ailment_UI_entity.draw_static(ailment, monster.ailment_static_UI, ailment_position_on_screen, opacity_scale);
|
||||
@@ -587,30 +604,33 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
|
||||
end
|
||||
|
||||
function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.ailments;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
--sort parts here
|
||||
local displayed_ailments = {};
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_all_active_ailments and ailment.is_active then
|
||||
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.highlighted.ailments.settings.time_limit and not ailment.is_active then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -618,8 +638,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -628,8 +648,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.ailments.sorting.type == "Buildup" then
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.total_buildup > right.total_buildup;
|
||||
end);
|
||||
@@ -638,8 +658,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
|
||||
return left.total_buildup < right.total_buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.ailments.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
return left.buildup_percentage > right.buildup_percentage;
|
||||
end);
|
||||
@@ -652,8 +672,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
|
||||
|
||||
for j, ailment in ipairs(displayed_ailments) do
|
||||
local ailment_position_on_screen = {
|
||||
x = ailments_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
ailment_UI_entity.draw_highlighted(ailment, monster.ailment_highlighted_UI, ailment_position_on_screen, opacity_scale);
|
||||
@@ -661,30 +681,33 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
|
||||
end
|
||||
|
||||
function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.small_monster_UI.ailments;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
--sort parts here
|
||||
local displayed_ailments = {};
|
||||
for REpart, ailment in pairs(monster.ailments) do
|
||||
if config.current_config.small_monster_UI.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailments.settings.hide_all_active_ailments and ailment.is_active then
|
||||
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailments.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.small_monster_UI.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.small_monster_UI.ailments.settings.time_limit and not ailment.is_active then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -693,39 +716,39 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
|
||||
end
|
||||
|
||||
|
||||
if config.current_config.small_monster_UI.ailments.sorting.type == "Normal" then
|
||||
if config.current_config.small_monster_UI.ailments.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return false; end
|
||||
if cached_config.settings.prioritize_active_ailments and left.is_active then return false; end
|
||||
return left.id > right.id;
|
||||
end);
|
||||
else
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return true; end
|
||||
if cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.small_monster_UI.ailments.sorting.type == "Buildup" then
|
||||
if config.current_config.small_monster_UI.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return false; end
|
||||
if cached_config.settings.prioritize_active_ailments and left.is_active then return false; end
|
||||
return left.total_buildup > right.total_buildup;
|
||||
end);
|
||||
else
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return true; end
|
||||
if cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
|
||||
return left.total_buildup < right.total_buildup;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.small_monster_UI.ailments.sorting.type == "Buildup Percentage" then
|
||||
if config.current_config.small_monster_UI.ailments.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Buildup Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return false; end
|
||||
if cached_config.settings.prioritize_active_ailments and left.is_active then return false; end
|
||||
return left.buildup_percentage > right.buildup_percentage;
|
||||
end);
|
||||
else
|
||||
table.sort(displayed_ailments, function(left, right)
|
||||
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return true; end
|
||||
if cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
|
||||
return left.buildup_percentage < right.buildup_percentage;
|
||||
end);
|
||||
end
|
||||
@@ -733,8 +756,8 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
|
||||
|
||||
for j, ailment in ipairs(displayed_ailments) do
|
||||
local ailment_position_on_screen = {
|
||||
x = ailments_position_on_screen.x + config.current_config.small_monster_UI.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + config.current_config.small_monster_UI.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,93 +46,105 @@ end
|
||||
|
||||
|
||||
function body_part.init_dynamic_UI(part)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
|
||||
|
||||
part.body_part_dynamic_UI = body_part_UI_entity.new(
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_name_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.bar,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.text_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.value_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.percentage_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.bar,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.text_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.value_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.percentage_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.bar,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.text_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.value_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.percentage_label
|
||||
cached_config.visibility,
|
||||
cached_config.part_name_label,
|
||||
cached_config.part_health.visibility,
|
||||
cached_config.part_health.bar,
|
||||
cached_config.part_health.text_label,
|
||||
cached_config.part_health.value_label,
|
||||
cached_config.part_health.percentage_label,
|
||||
cached_config.part_break.visibility,
|
||||
cached_config.part_break.bar,
|
||||
cached_config.part_break.text_label,
|
||||
cached_config.part_break.value_label,
|
||||
cached_config.part_break.percentage_label,
|
||||
cached_config.part_loss.visibility,
|
||||
cached_config.part_loss.bar,
|
||||
cached_config.part_loss.text_label,
|
||||
cached_config.part_loss.value_label,
|
||||
cached_config.part_loss.percentage_label
|
||||
);
|
||||
end
|
||||
|
||||
function body_part.init_static_UI(part)
|
||||
local cached_config = config.current_config.large_monster_UI.static.body_parts;
|
||||
|
||||
part.body_part_static_UI = body_part_UI_entity.new(
|
||||
config.current_config.large_monster_UI.static.body_parts.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_name_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.bar,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.text_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.value_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.percentage_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.bar,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.text_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.value_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.percentage_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.bar,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.text_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.value_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.percentage_label
|
||||
cached_config.visibility,
|
||||
cached_config.part_name_label,
|
||||
cached_config.part_health.visibility,
|
||||
cached_config.part_health.bar,
|
||||
cached_config.part_health.text_label,
|
||||
cached_config.part_health.value_label,
|
||||
cached_config.part_health.percentage_label,
|
||||
cached_config.part_break.visibility,
|
||||
cached_config.part_break.bar,
|
||||
cached_config.part_break.text_label,
|
||||
cached_config.part_break.value_label,
|
||||
cached_config.part_break.percentage_label,
|
||||
cached_config.part_loss.visibility,
|
||||
cached_config.part_loss.bar,
|
||||
cached_config.part_loss.text_label,
|
||||
cached_config.part_loss.value_label,
|
||||
cached_config.part_loss.percentage_label
|
||||
);
|
||||
end
|
||||
|
||||
function body_part.init_highlighted_UI(part)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
|
||||
|
||||
part.body_part_highlighted_UI = body_part_UI_entity.new(
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_name_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.bar,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.text_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.value_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.percentage_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.bar,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.text_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.value_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.percentage_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.bar,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.text_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.value_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.percentage_label
|
||||
cached_config.visibility,
|
||||
cached_config.part_name_label,
|
||||
cached_config.part_health.visibility,
|
||||
cached_config.part_health.bar,
|
||||
cached_config.part_health.text_label,
|
||||
cached_config.part_health.value_label,
|
||||
cached_config.part_health.percentage_label,
|
||||
cached_config.part_break.visibility,
|
||||
cached_config.part_break.bar,
|
||||
cached_config.part_break.text_label,
|
||||
cached_config.part_break.value_label,
|
||||
cached_config.part_break.percentage_label,
|
||||
cached_config.part_loss.visibility,
|
||||
cached_config.part_loss.bar,
|
||||
cached_config.part_loss.text_label,
|
||||
cached_config.part_loss.value_label,
|
||||
cached_config.part_loss.percentage_label
|
||||
);
|
||||
end
|
||||
|
||||
function body_part.update(part, part_current, part_max, part_break_current, part_break_max, part_loss_current, part_loss_max, part_break_count, part_break_max_count, is_severed)
|
||||
if part == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
function body_part.update_flinch(part, part_current, part_max)
|
||||
if part_current > part.health then
|
||||
part.flinch_count = part.flinch_count + 1;
|
||||
end
|
||||
|
||||
if part_break_current > part.break_health then
|
||||
part.break_count = part.break_count + 1;
|
||||
end
|
||||
|
||||
if part.health ~= part_current then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.max_health ~= part_max then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
part.health = part_current;
|
||||
part.max_health = part_max;
|
||||
|
||||
if part.max_health ~= 0 then
|
||||
part.health_percentage = part.health / part.max_health;
|
||||
end
|
||||
end
|
||||
|
||||
function body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
|
||||
|
||||
if part.break_health ~= part_break_current then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.loss_health ~= part_loss_current then
|
||||
if part.break_max_health ~= part_break_max then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
@@ -143,31 +155,35 @@ function body_part.update(part, part_current, part_max, part_break_current, part
|
||||
if part.break_max_count ~= part_break_max_count then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.is_severed ~= is_severed then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
part.health = part_current;
|
||||
part.max_health = part_max;
|
||||
|
||||
part.break_health = part_break_current;
|
||||
part.break_max_health = part_break_max;
|
||||
|
||||
part.loss_health = part_loss_current;
|
||||
part.loss_max_health = part_loss_max;
|
||||
|
||||
part.break_count = part_break_count;
|
||||
part.break_max_count = part_break_max_count;
|
||||
part.is_severed = is_severed;
|
||||
|
||||
if part.max_health ~= 0 then
|
||||
part.health_percentage = part.health / part.max_health;
|
||||
end
|
||||
|
||||
if part.break_max_health ~= 0 then
|
||||
part.break_health_percentage = part.break_health / part.break_max_health;
|
||||
end
|
||||
end
|
||||
|
||||
function body_part.update_loss(part, part_loss_current, part_loss_max, is_severed)
|
||||
if part.loss_health ~= part_loss_current then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.loss_max_health ~= part_loss_max then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.is_severed ~= is_severed then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
part.loss_health = part_loss_current;
|
||||
part.loss_max_health = part_loss_max;
|
||||
|
||||
part.is_severed = is_severed;
|
||||
|
||||
if part.loss_max_health ~= 0 then
|
||||
part.loss_health_percentage = part.loss_health / part.loss_max_health;
|
||||
@@ -176,22 +192,25 @@ function body_part.update(part, part_current, part_max, part_break_current, part
|
||||
end
|
||||
|
||||
function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.settings.hide_undamaged_parts
|
||||
and part.health == part.max_health and part.flinch_count == 0
|
||||
if cached_config.settings.hide_undamaged_parts
|
||||
and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
|
||||
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
|
||||
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if (not part.body_part_dynamic_UI.flinch_visibility)
|
||||
if (not part.body_part_dynamic_UI.flinch_visibility or part.max_health < 0)
|
||||
and (not part.body_part_dynamic_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
|
||||
and (not part.body_part_dynamic_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.dynamic.body_parts.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -199,8 +218,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -209,8 +228,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Health" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health > right.health;
|
||||
end);
|
||||
@@ -219,8 +238,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.health < right.health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Health Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health_percentage > right.health_percentage;
|
||||
end);
|
||||
@@ -229,8 +248,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.health_percentage < right.health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Flinch Count" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Flinch Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.flinch_count > right.flinch_count;
|
||||
end);
|
||||
@@ -239,8 +258,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.flinch_count < right.flinch_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Health" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health > right.break_health;
|
||||
end);
|
||||
@@ -249,8 +268,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.break_health < right.break_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Health Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health_percentage > right.break_health_percentage;
|
||||
end);
|
||||
@@ -259,8 +278,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.break_health_percentage < right.break_health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Count" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_count > right.break_count;
|
||||
end);
|
||||
@@ -269,8 +288,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.break_count < right.break_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Sever Health" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health > right.loss_health;
|
||||
end);
|
||||
@@ -279,8 +298,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.loss_health < right.loss_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Sever Health Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health_percentage > right.loss_health_percentage;
|
||||
end);
|
||||
@@ -295,8 +314,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
|
||||
for j, part in ipairs(displayed_parts) do
|
||||
local part_position_on_screen = {
|
||||
x = parts_position_on_screen.x + config.current_config.large_monster_UI.dynamic.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = parts_position_on_screen.y + config.current_config.large_monster_UI.dynamic.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
body_part_UI_entity.draw_dynamic(part, part_position_on_screen, opacity_scale);
|
||||
@@ -307,23 +326,25 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
end
|
||||
|
||||
function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.static.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
if config.current_config.large_monster_UI.static.body_parts.settings.hide_undamaged_parts
|
||||
and part.health == part.max_health and part.flinch_count == 0
|
||||
if cached_config.settings.hide_undamaged_parts
|
||||
and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
|
||||
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
|
||||
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if (not part.body_part_static_UI.flinch_visibility)
|
||||
if (not part.body_part_static_UI.flinch_visibility or part.max_health < 0)
|
||||
and (not part.body_part_static_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
|
||||
and (not part.body_part_static_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.static.body_parts.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -331,8 +352,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -341,8 +362,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Health" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health > right.health;
|
||||
end);
|
||||
@@ -351,8 +372,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.health < right.health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Health Percentage" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health_percentage > right.health_percentage;
|
||||
end);
|
||||
@@ -361,8 +382,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.health_percentage < right.health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Flinch Count" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Flinch Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.flinch_count > right.flinch_count;
|
||||
end);
|
||||
@@ -371,8 +392,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.flinch_count < right.flinch_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Health" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health > right.break_health;
|
||||
end);
|
||||
@@ -381,8 +402,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.break_health < right.break_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Health Percentage" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health_percentage > right.break_health_percentage;
|
||||
end);
|
||||
@@ -391,8 +412,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.break_health_percentage < right.break_health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Count" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_count > right.break_count;
|
||||
end);
|
||||
@@ -401,8 +422,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.break_count < right.break_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Sever Health" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health > right.loss_health;
|
||||
end);
|
||||
@@ -411,8 +432,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.loss_health < right.loss_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Sever Health Percentage" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health_percentage > right.loss_health_percentage;
|
||||
end);
|
||||
@@ -427,8 +448,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
|
||||
for j, part in ipairs(displayed_parts) do
|
||||
local part_position_on_screen = {
|
||||
x = parts_position_on_screen.x + config.current_config.large_monster_UI.static.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = parts_position_on_screen.y + config.current_config.large_monster_UI.static.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
body_part_UI_entity.draw_static(part, part_position_on_screen, opacity_scale);
|
||||
@@ -439,22 +460,25 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
end
|
||||
|
||||
function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.settings.hide_undamaged_parts
|
||||
and part.health == part.max_health and part.flinch_count == 0
|
||||
if cached_config.settings.hide_undamaged_parts
|
||||
and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
|
||||
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
|
||||
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if (not part.body_part_highlighted_UI.flinch_visibility)
|
||||
if (not part.body_part_highlighted_UI.flinch_visibility or part.max_health < 0)
|
||||
and (not part.body_part_highlighted_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
|
||||
and (not part.body_part_highlighted_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.highlighted.body_parts.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -462,8 +486,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -472,8 +496,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Health" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health > right.health;
|
||||
end);
|
||||
@@ -482,8 +506,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.health < right.health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Health Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health_percentage > right.health_percentage;
|
||||
end);
|
||||
@@ -492,8 +516,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.health_percentage < right.health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Flinch Count" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Flinch Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.flinch_count > right.flinch_count;
|
||||
end);
|
||||
@@ -502,8 +526,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.flinch_count < right.flinch_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Health" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health > right.break_health;
|
||||
end);
|
||||
@@ -512,8 +536,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.break_health < right.break_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Health Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health_percentage > right.break_health_percentage;
|
||||
end);
|
||||
@@ -522,8 +546,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.break_health_percentage < right.break_health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Count" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_count > right.break_count;
|
||||
end);
|
||||
@@ -532,8 +556,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.break_count < right.break_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Sever Health" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health > right.loss_health;
|
||||
end);
|
||||
@@ -542,8 +566,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.loss_health < right.loss_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Sever Health Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health_percentage > right.loss_health_percentage;
|
||||
end);
|
||||
@@ -558,8 +582,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
|
||||
for j, part in ipairs(displayed_parts) do
|
||||
local part_position_on_screen = {
|
||||
x = parts_position_on_screen.x + config.current_config.large_monster_UI.highlighted.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = parts_position_on_screen.y + config.current_config.large_monster_UI.highlighted.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
};
|
||||
|
||||
body_part_UI_entity.draw_highlighted(part, part_position_on_screen, opacity_scale);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,12 +9,6 @@ local enemy_character_base_update_method = enemy_character_base_type_def:get_met
|
||||
|
||||
local is_boss_enemy_method = enemy_character_base_type_def:get_method("get_isBossEnemy");
|
||||
|
||||
sdk.hook(enemy_character_base_update_method, function(args)
|
||||
pcall(monster_hook.update_monster, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
local tick_count = 0;
|
||||
local last_update_tick = 0;
|
||||
local recorded_monsters = {};
|
||||
@@ -53,8 +47,8 @@ function monster_hook.update_monster(enemy)
|
||||
end
|
||||
|
||||
if not recorded_monsters[enemy] then
|
||||
num_known_monsters = num_known_monsters + 1
|
||||
recorded_monsters[enemy] = true
|
||||
num_known_monsters = num_known_monsters + 1;
|
||||
recorded_monsters[enemy] = true;
|
||||
end
|
||||
|
||||
-- saves on a method call.
|
||||
@@ -76,9 +70,11 @@ function monster_hook.update_monster(enemy)
|
||||
end
|
||||
|
||||
function monster_hook.update_large_monster(enemy)
|
||||
if not config.current_config.large_monster_UI.dynamic.enabled and
|
||||
not config.current_config.large_monster_UI.static.enabled and
|
||||
not config.current_config.large_monster_UI.highlighted.enabled then
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled and
|
||||
not cached_config.static.enabled and
|
||||
not cached_config.highlighted.enabled then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -144,6 +140,12 @@ function monster_hook.init_module()
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
ailments = require("MHR_Overlay.Monsters.ailments");
|
||||
|
||||
sdk.hook(enemy_character_base_update_method, function(args)
|
||||
pcall(monster_hook.update_monster, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
end
|
||||
|
||||
return monster_hook;
|
||||
@@ -77,52 +77,53 @@ function small_monster.init(monster, enemy)
|
||||
end
|
||||
|
||||
function small_monster.init_UI(monster)
|
||||
monster.name_label = table_helpers.deep_copy(config.current_config.small_monster_UI.monster_name_label);
|
||||
local cached_config = config.current_config.small_monster_UI;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
monster.name_label.offset.x = monster.name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
monster.name_label.offset.y = monster.name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
monster.name_label = table_helpers.deep_copy(cached_config.monster_name_label);
|
||||
|
||||
monster.name_label.offset.x = monster.name_label.offset.x * global_scale_modifier;
|
||||
monster.name_label.offset.y = monster.name_label.offset.y * global_scale_modifier;
|
||||
|
||||
monster.health_UI = health_UI_entity.new(
|
||||
config.current_config.small_monster_UI.health.visibility,
|
||||
config.current_config.small_monster_UI.health.bar,
|
||||
config.current_config.small_monster_UI.health.text_label,
|
||||
config.current_config.small_monster_UI.health.value_label,
|
||||
config.current_config.small_monster_UI.health.percentage_label
|
||||
cached_config.health.visibility,
|
||||
cached_config.health.bar,
|
||||
cached_config.health.text_label,
|
||||
cached_config.health.value_label,
|
||||
cached_config.health.percentage_label
|
||||
);
|
||||
|
||||
monster.stamina_UI = stamina_UI_entity.new(
|
||||
config.current_config.small_monster_UI.stamina.visibility,
|
||||
config.current_config.small_monster_UI.stamina.bar,
|
||||
config.current_config.small_monster_UI.stamina.text_label,
|
||||
config.current_config.small_monster_UI.stamina.value_label,
|
||||
config.current_config.small_monster_UI.stamina.percentage_label
|
||||
cached_config.stamina.visibility,
|
||||
cached_config.stamina.bar,
|
||||
cached_config.stamina.text_label,
|
||||
cached_config.stamina.value_label,
|
||||
cached_config.stamina.percentage_label
|
||||
);
|
||||
|
||||
monster.ailment_UI = ailment_UI_entity.new(
|
||||
config.current_config.small_monster_UI.ailments.visibility,
|
||||
config.current_config.small_monster_UI.ailments.bar,
|
||||
config.current_config.small_monster_UI.ailments.ailment_name_label,
|
||||
config.current_config.small_monster_UI.ailments.text_label,
|
||||
config.current_config.small_monster_UI.ailments.value_label,
|
||||
config.current_config.small_monster_UI.ailments.percentage_label,
|
||||
config.current_config.small_monster_UI.ailments.timer_label
|
||||
cached_config.ailments.visibility,
|
||||
cached_config.ailments.bar,
|
||||
cached_config.ailments.ailment_name_label,
|
||||
cached_config.ailments.text_label,
|
||||
cached_config.ailments.value_label,
|
||||
cached_config.ailments.percentage_label,
|
||||
cached_config.ailments.timer_label
|
||||
);
|
||||
|
||||
ailments.init_ailment_buildup_small_UI(monster.ailments);
|
||||
end
|
||||
|
||||
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
|
||||
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
|
||||
local status_param_field = enemy_character_base_type_def:get_field("<StatusParam>k__BackingField");
|
||||
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField");
|
||||
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
|
||||
|
||||
local physical_param_type = physical_param_field:get_type();
|
||||
local get_vital_method = physical_param_type:get_method("getVital");
|
||||
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital");
|
||||
|
||||
local get_hp_vital_method = enemy_character_base_type_def:get_method("getHpVital");
|
||||
local get_hp_max_vital_method = enemy_character_base_type_def:get_method("getHpMaxVital");
|
||||
local vital_param_type = get_vital_method:get_return_type();
|
||||
local get_current_method = vital_param_type:get_method("get_Current");
|
||||
local get_max_method = vital_param_type:get_method("get_Max");
|
||||
|
||||
|
||||
local stamina_param_type = stamina_param_field:get_type();
|
||||
@@ -131,61 +132,42 @@ local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina");
|
||||
|
||||
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
|
||||
|
||||
--local get_gameobject_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject");
|
||||
--local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform");
|
||||
--local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position");
|
||||
|
||||
function small_monster.update_position(enemy)
|
||||
if not config.current_config.small_monster_UI.enabled or not config.current_config.small_monster_UI.dynamic_positioning.enabled then
|
||||
local cached_config = config.current_config.small_monster_UI;
|
||||
if not cached_config.enabled or not cached_config.dynamic_positioning.enabled then
|
||||
return;
|
||||
end
|
||||
|
||||
local monster = small_monster.get_monster(enemy);
|
||||
if not monster then return end
|
||||
|
||||
local position = get_pos_field:call(enemy);
|
||||
if position ~= nil then
|
||||
monster.position = position;
|
||||
end
|
||||
|
||||
--[[
|
||||
-- cache off the game object and transform
|
||||
-- as these are pretty much guaranteed to stay constant
|
||||
-- as long as the enemy is alive
|
||||
if monster.game_object == nil then
|
||||
monster.game_object = get_gameobject_method:call(enemy)
|
||||
if monster.game_object == nil then
|
||||
customization_menu.status = "No enemy game object";
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
if monster.transform == nil then
|
||||
monster.transform = get_transform_method:call(monster.game_object)
|
||||
if monster.transform == nil then
|
||||
customization_menu.status = "No enemy transform";
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
local position = get_position_method:call(monster.transform)
|
||||
if not position then
|
||||
customization_menu.status = "No enemy position";
|
||||
if monster == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
if position ~= nil then
|
||||
monster.position = position;
|
||||
end
|
||||
--]]
|
||||
local position = get_pos_field:call(enemy) or monster.position;
|
||||
monster.position = position;
|
||||
end
|
||||
|
||||
function small_monster.update(enemy)
|
||||
if not config.current_config.small_monster_UI.enabled then
|
||||
return;
|
||||
end
|
||||
|
||||
if enemy == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
if not config.current_config.small_monster_UI.enabled then
|
||||
local monster = small_monster.get_monster(enemy);
|
||||
|
||||
local dead_or_captured = check_die_method:call(enemy);
|
||||
monster.dead_or_captured = (dead_or_captured == nil and false) or dead_or_captured;
|
||||
|
||||
small_monster.update_health(enemy, monster);
|
||||
small_monster.update_stamina(enemy, monster);
|
||||
ailments.update_ailments(enemy, monster);
|
||||
end
|
||||
|
||||
function small_monster.update_health(enemy, monster)
|
||||
if not config.current_config.small_monster_UI.health.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -195,9 +177,24 @@ function small_monster.update(enemy)
|
||||
return;
|
||||
end
|
||||
|
||||
local status_param = status_param_field:get_data(enemy)
|
||||
if status_param == nil then
|
||||
customization_menu.status = "No status param";
|
||||
local vital_param = get_vital_method:call(physical_param, 0, 0);
|
||||
if vital_param == nil then
|
||||
customization_menu.status = "No vital param";
|
||||
return;
|
||||
end
|
||||
|
||||
monster.health = get_current_method:call(vital_param) or monster.health;
|
||||
monster.max_health = get_max_method:call(vital_param) or monster.max_health;
|
||||
|
||||
monster.missing_health = monster.max_health - monster.health;
|
||||
if monster.max_health ~= 0 then
|
||||
monster.health_percentage = monster.health / monster.max_health;
|
||||
monster.capture_percentage = monster.capture_health / monster.max_health;
|
||||
end
|
||||
end
|
||||
|
||||
function small_monster.update_stamina(enemy, monster)
|
||||
if not config.current_config.small_monster_UI.stamina.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -207,88 +204,40 @@ function small_monster.update(enemy)
|
||||
return;
|
||||
end
|
||||
|
||||
local vital_param = get_vital_method:call(physical_param, 0, 0);
|
||||
if vital_param == nil then
|
||||
customization_menu.status = "No vital param";
|
||||
return;
|
||||
monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
|
||||
monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
|
||||
|
||||
|
||||
monster.missing_stamina = monster.max_stamina - monster.stamina;
|
||||
if monster.max_stamina ~= 0 then
|
||||
monster.stamina_percentage = monster.stamina / monster.max_stamina;
|
||||
end
|
||||
|
||||
local health = get_hp_vital_method:call(enemy);
|
||||
local max_health = get_hp_max_vital_method:call(enemy);
|
||||
local capture_health = get_capture_hp_vital_method:call(physical_param);
|
||||
|
||||
local stamina = get_stamina_method:call(stamina_param);
|
||||
local max_stamina = get_max_stamina_method:call(stamina_param);
|
||||
|
||||
local dead_or_captured = check_die_method:call(enemy);
|
||||
if dead_or_captured == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
local monster = small_monster.get_monster(enemy);
|
||||
|
||||
if health ~= nil then
|
||||
monster.health = health;
|
||||
end
|
||||
|
||||
if max_health ~= nil then
|
||||
monster.max_health = max_health;
|
||||
end
|
||||
|
||||
if capture_health ~= nil then
|
||||
monster.capture_health = capture_health;
|
||||
end
|
||||
|
||||
if max_health ~= nil and health ~= nil then
|
||||
monster.missing_health = max_health - health;
|
||||
if max_health ~= 0 then
|
||||
monster.health_percentage = health / max_health;
|
||||
end
|
||||
end
|
||||
|
||||
if dead_or_captured ~= nil then
|
||||
monster.dead_or_captured = dead_or_captured;
|
||||
end
|
||||
|
||||
if stamina ~= nil then
|
||||
monster.stamina = stamina;
|
||||
end
|
||||
|
||||
if max_stamina ~= nil then
|
||||
monster.max_stamina = max_stamina;
|
||||
end
|
||||
|
||||
if max_stamina ~= nil and stamina ~= nil then
|
||||
monster.missing_stamina = max_stamina - stamina;
|
||||
if max_stamina ~= 0 then
|
||||
monster.stamina_percentage = stamina / max_stamina;
|
||||
end
|
||||
end
|
||||
|
||||
ailments.update_ailments(enemy, monster);
|
||||
end
|
||||
|
||||
function small_monster.draw(monster, position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.small_monster_UI;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
drawing.draw_label(monster.name_label, position_on_screen, opacity_scale, monster.name);
|
||||
|
||||
local health_position_on_screen = {
|
||||
x = position_on_screen.x + config.current_config.small_monster_UI.health.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = position_on_screen.y + config.current_config.small_monster_UI.health.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = position_on_screen.x + cached_config.health.offset.x * global_scale_modifier,
|
||||
y = position_on_screen.y + cached_config.health.offset.y * global_scale_modifier
|
||||
};
|
||||
|
||||
local stamina_position_on_screen = {
|
||||
x = position_on_screen.x + config.current_config.small_monster_UI.stamina.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = position_on_screen.y + config.current_config.small_monster_UI.stamina.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = position_on_screen.x + cached_config.stamina.offset.x * global_scale_modifier,
|
||||
y = position_on_screen.y + cached_config.stamina.offset.y * global_scale_modifier
|
||||
};
|
||||
|
||||
local ailments_position_on_screen = {
|
||||
x = position_on_screen.x + config.current_config.small_monster_UI.ailments.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = position_on_screen.y + config.current_config.small_monster_UI.ailments.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = position_on_screen.x + cached_config.ailments.offset.x * global_scale_modifier,
|
||||
y = position_on_screen.y + cached_config.ailments.offset.y * global_scale_modifier
|
||||
};
|
||||
|
||||
local ailment_buildups_position_on_screen = {
|
||||
x = position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = position_on_screen.y + config.current_config.small_monster_UI.ailment_buildups.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
|
||||
x = position_on_screen.x + cached_config.ailment_buildups.offset.x * global_scale_modifier,
|
||||
y = position_on_screen.y + cached_config.ailment_buildups.offset.y * global_scale_modifier
|
||||
};
|
||||
|
||||
health_UI_entity.draw(monster, monster.health_UI, health_position_on_screen, opacity_scale);
|
||||
|
||||
Reference in New Issue
Block a user