More refactoring

This commit is contained in:
GreenComfyTea
2022-07-28 15:00:22 +03:00
parent 49b6b28c9e
commit 90fba51cd5
15 changed files with 924 additions and 5403 deletions

View File

@@ -18,7 +18,7 @@ function player.new(id, guid, name, master_rank, hunter_rank)
local new_player = {};
new_player.id = id;
new_player.guid = guid;
new_player.name = name;
new_player.name = name; -- 齁ODO
new_player.hunter_rank = hunter_rank;
new_player.master_rank = master_rank;
@@ -423,11 +423,11 @@ function player.update_player_list_(hunter_info_field_)
local myself_master_rank = get_master_rank_method:call(singletons.progress_manager) or 0;
local myself_id = get_master_player_id_method:call(singletons.player_manager) or -1;
--if quest_status.is_online then
--myself_id = get_master_player_id_method:call(singletons.player_manager) or -1;
--else
--myself_id = myself_quest_index_field:call(singletons.lobby_manager) or -1;
--end
-- if quest_status.is_online then
-- myself_id = get_master_player_id_method:call(singletons.player_manager) or -1;
-- else
-- myself_id = myself_quest_index_field:call(singletons.lobby_manager) or -1;
-- end
if myself_id == nil then
customization_menu.status = "No myself player id";
@@ -440,16 +440,15 @@ function player.update_player_list_(hunter_info_field_)
return;
end
--local myself_guid_string = guid_tostring_method:call(myself_guid);
--if myself_guid_string == nil then
-- local myself_guid_string = guid_tostring_method:call(myself_guid);
-- if myself_guid_string == nil then
-- customization_menu.status = "No myself guid string";
-- return;
--end
-- end
if myself_id ~= player.myself.id then
player.list[player.myself.id] = nil;
player.myself = player.new(myself_id, myself_guid, myself_player_name, myself_master_rank,
myself_hunter_rank);
player.myself = player.new(myself_id, myself_guid, myself_player_name, myself_master_rank, myself_hunter_rank);
player.list[myself_id] = player.myself;
end
@@ -484,11 +483,11 @@ function player.update_player_list_(hunter_info_field_)
return;
end
--local player_guid_string = guid_tostring_method:call(player_guid);
--if player_guid_string == nil then
-- local player_guid_string = guid_tostring_method:call(player_guid);
-- if player_guid_string == nil then
-- customization_menu.status = "No player guid string";
-- return;
--end
-- end
local player_hunter_rank = hunter_rank_field:get_data(player_info) or 0;
local player_master_rank = master_rank_field:get_data(player_info) or 0;
@@ -498,15 +497,13 @@ function player.update_player_list_(hunter_info_field_)
goto continue
end
if player.list[player_id] == nil or
not guid_equals_method:call(player.list[player_id].guid, player_guid)
--player.list[player_id].guid ~= player_guid
if player.list[player_id] == nil or not guid_equals_method:call(player.list[player_id].guid, player_guid) -- player.list[player_id].guid ~= player_guid
then
local _player = player.new(player_id, player_guid, player_name, player_master_rank, player_hunter_rank);
player.list[player_id] = _player;
if player_name == player.myself.name and player_hunter_rank == player.myself.hunter_rank and
player_master_rank == player.myself.master_rank then
if player_name == player.myself.name and player_hunter_rank == player.myself.hunter_rank and player_master_rank ==
player.myself.master_rank then
player.myself = _player;
end
end
@@ -518,16 +515,9 @@ end
function player.init_UI(_player)
local cached_config = config.current_config.damage_meter_UI;
_player.damage_UI = damage_UI_entity.new(
cached_config.damage_bar,
cached_config.highlighted_damage_bar,
cached_config.player_name_label,
cached_config.dps_label,
cached_config.master_hunter_rank_label,
cached_config.damage_value_label,
cached_config.damage_percentage_label,
cached_config.cart_count_label
);
_player.damage_UI = damage_UI_entity.new(cached_config.damage_bar, cached_config.highlighted_damage_bar,
cached_config.player_name_label, cached_config.dps_label, cached_config.master_hunter_rank_label,
cached_config.damage_value_label, cached_config.damage_percentage_label, cached_config.cart_count_label);
end
function player.init_total_UI(_player)
@@ -544,9 +534,9 @@ function player.init_total_UI(_player)
_player.damage_UI.total_damage_label.offset.y = _player.damage_UI.total_damage_label.offset.y * global_scale_modifier;
_player.damage_UI.total_damage_value_label.offset.x = _player.damage_UI.total_damage_value_label.offset.x *
global_scale_modifier;
global_scale_modifier;
_player.damage_UI.total_damage_value_label.offset.y = _player.damage_UI.total_damage_value_label.offset.y *
global_scale_modifier;
global_scale_modifier;
_player.damage_UI.total_dps_label.offset.x = _player.damage_UI.total_dps_label.offset.x * global_scale_modifier;
_player.damage_UI.total_dps_label.offset.y = _player.damage_UI.total_dps_label.offset.y * global_scale_modifier;

View File

@@ -326,7 +326,7 @@ language.default_language = {
hide_inactive_ailments_with_no_buildup_support = "Hide Inactive Ailments with no Buildup Support",
hide_all_inactive_ailments = "Hide All Inactive Ailments",
hide_all_active_ailments = "Hide All Active Ailments",
hide_disabled_ailments = "Hide Disabled Ailments",
hide_disabled_ailments = "Hide Disabled Ailments by Game",
offset_is_relative_to_parts = "Offset is Relative to Parts",
time_limit = "Time Limit (seconds)",
ailment_name_label = "Ailment Name Label",

View File

@@ -10,8 +10,9 @@ local large_monster;
local table_helpers;
local drawing;
function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
function ailment_buildup.draw(monster, ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale)
local cached_config = cached_config.ailment_buildups;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
if not cached_config.visibility then
@@ -105,9 +106,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_buildup_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -116,143 +115,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
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);
last_j = j;
end
local total_buildup_position_on_screen = {
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);
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 + 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::
end
end
function ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale)
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 cached_config.filter.stun then
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue
end
else
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
local top_buildup = 0;
local displayed_players = {};
for player_id, player_buildup in pairs(ailment.buildup) do
total_buildup = total_buildup + player_buildup;
if player_buildup > top_buildup then
top_buildup = player_buildup;
end
table.insert(displayed_players,
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
}
);
end
if total_buildup == 0 then
goto continue
end
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);
else
table.sort(displayed_players, function(left, right)
return left.id > right.id;
end);
end
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);
else
table.sort(displayed_players, function(left, right)
return left.buildup > right.buildup;
end);
end
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);
else
table.sort(displayed_players, function(left, right)
return left.buildup_share > right.buildup_share;
end);
end
end
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";
end
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
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
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 + 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);
ailment_buildup_UI_entity.draw(_player, ailment_buildup_UI, cached_config, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
last_j = j;
end
@@ -262,277 +125,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
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);
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 + 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::
end
end
function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale)
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 cached_config.filter.stun then
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue
end
else
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
local top_buildup = 0;
local displayed_players = {};
for player_id, player_buildup in pairs(ailment.buildup) do
total_buildup = total_buildup + player_buildup;
if player_buildup > top_buildup then
top_buildup = player_buildup;
end
table.insert(displayed_players,
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
}
);
end
if total_buildup == 0 then
goto continue
end
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);
else
table.sort(displayed_players, function(left, right)
return left.id > right.id;
end);
end
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);
else
table.sort(displayed_players, function(left, right)
return left.buildup > right.buildup;
end);
end
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);
else
table.sort(displayed_players, function(left, right)
return left.buildup_share > right.buildup_share;
end);
end
end
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";
end
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
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
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 + 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);
last_j = j;
end
local total_buildup_position_on_screen = {
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);
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 + 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::
end
end
function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale)
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 cached_config.filter.stun then
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue
end
else
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
local top_buildup = 0;
local displayed_players = {};
for player_id, player_buildup in pairs(ailment.buildup) do
total_buildup = total_buildup + player_buildup;
if player_buildup > top_buildup then
top_buildup = player_buildup;
end
table.insert(displayed_players,
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
}
);
end
if total_buildup == 0 then
goto continue
end
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);
else
table.sort(displayed_players, function(left, right)
return left.id > right.id;
end);
end
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);
else
table.sort(displayed_players, function(left, right)
return left.buildup > right.buildup;
end);
end
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);
else
table.sort(displayed_players, function(left, right)
return left.buildup_share > right.buildup_share;
end);
end
end
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";
end
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
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
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 + 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);
last_j = j;
end
local total_buildup_position_on_screen = {
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);
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);
drawing.draw_label(ailment_buildup_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(ailment_buildup_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 + cached_config.ailment_spacing.x * global_scale_modifier,

View File

@@ -148,78 +148,9 @@ function ailments.init_ailments()
_ailments[ailments.stun_id].buildup = {};
_ailments[ailments.stun_id].buildup_share = {};
ailments.init_ailment_buildup_UI(_ailments);
return _ailments;
end
function ailments.init_ailment_buildup_UI(_ailments)
ailments.init_ailment_buildup_dynamic_UI(_ailments);
ailments.init_ailment_buildup_static_UI(_ailments);
ailments.init_ailment_buildup_highlighted_UI(_ailments);
ailments.init_ailment_buildup_small_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(
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(
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(
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(
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
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_condition_damage_param_base_type_def = sdk.find_type_definition("snow.enemy.EnemyConditionDamageParamBase");
@@ -429,176 +360,8 @@ function ailments.update_poison(monster, poison_param)
end
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 id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue
end
else
goto continue
end
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 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 cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
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);
else
table.sort(displayed_ailments, function(left, right)
return left.id < right.id;
end);
end
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);
else
table.sort(displayed_ailments, function(left, right)
return left.total_buildup < right.total_buildup;
end);
end
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);
else
table.sort(displayed_ailments, function(left, right)
return left.buildup_percentage < right.buildup_percentage;
end);
end
end
for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = {
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
end
function ailments.draw_static(monster, ailments_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.static.ailments;
function ailments.draw(monster, ailment_UI, cached_config, ailments_position_on_screen, opacity_scale)
local cached_config = cached_config.ailments;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--sort parts here
@@ -760,349 +523,10 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
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);
end
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 id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue
end
else
goto continue
end
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 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 cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
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);
else
table.sort(displayed_ailments, function(left, right)
return left.id < right.id;
end);
end
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);
else
table.sort(displayed_ailments, function(left, right)
return left.total_buildup < right.total_buildup;
end);
end
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);
else
table.sort(displayed_ailments, function(left, right)
return left.buildup_percentage < right.buildup_percentage;
end);
end
end
for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = {
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);
end
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 id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue
end
else
goto continue
end
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 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 cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
ailment_UI_entity.draw(ailment, ailment_UI, cached_config, ailment_position_on_screen, opacity_scale);
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right)
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 cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
return left.id < right.id;
end);
end
elseif cached_config.sorting.type == "Buildup" then
if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right)
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 cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
return left.total_buildup < right.total_buildup;
end);
end
elseif cached_config.sorting.type == "Buildup Percentage" then
if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right)
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 cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
return left.buildup_percentage < right.buildup_percentage;
end);
end
end
for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = {
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_small(ailment, monster.ailment_UI, ailment_position_on_screen, opacity_scale);
end
end
function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailment_buildup)

View File

@@ -38,84 +38,9 @@ function body_part.new(id, name)
part.last_change_time = time.total_elapsed_script_seconds;
body_part.init_dynamic_UI(part);
body_part.init_static_UI(part);
body_part.init_highlighted_UI(part);
return part;
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(
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(
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(
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_flinch(part, part_current, part_max)
if part_current > part.health then
part.flinch_count = part.flinch_count + 1;
@@ -190,8 +115,8 @@ function body_part.update_loss(part, part_loss_current, part_loss_max, is_severe
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;
function body_part.draw(monster, part_UI, cached_config, parts_position_on_screen, opacity_scale)
local cached_config = cached_config.body_parts;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local displayed_parts = {};
@@ -251,382 +176,9 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
goto continue
end
if (not part.body_part_dynamic_UI.flinch_visibility or not health_supported)
and
(not part.body_part_dynamic_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_dynamic_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
table.insert(displayed_parts, part);
::continue::
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.id < right.id;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.health < right.health;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.health_percentage < right.health_percentage;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.flinch_count < right.flinch_count;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.break_health < right.break_health;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.break_health_percentage < right.break_health_percentage;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.break_count < right.break_count;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.loss_health < right.loss_health;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.loss_health_percentage < right.loss_health_percentage;
end);
end
end
local last_part_position_on_screen;
for j, part in ipairs(displayed_parts) do
local part_position_on_screen = {
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);
last_part_position_on_screen = part_position_on_screen;
end
return last_part_position_on_screen;
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
local health_supported = part.max_health >= 0;
local break_supported = part.break_max_health >= 0;
local severe_supported = part.loss_max_health >= 0;
if health_supported then
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue
end
else
if not cached_config.filter.health_break then
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue
end
else
if not cached_config.filter.health then
goto continue
end
end
end
else
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue
end
else
if not cached_config.filter.break_ then
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue
end
else
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_static_UI.flinch_visibility or not health_supported)
and
(not part.body_part_static_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_static_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
table.insert(displayed_parts, part);
::continue::
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.id < right.id;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.health < right.health;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.health_percentage < right.health_percentage;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.flinch_count < right.flinch_count;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.break_health < right.break_health;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.break_health_percentage < right.break_health_percentage;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.break_count < right.break_count;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.loss_health < right.loss_health;
end);
end
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);
else
table.sort(displayed_parts, function(left, right)
return left.loss_health_percentage < right.loss_health_percentage;
end);
end
end
local last_part_position_on_screen;
for j, part in ipairs(displayed_parts) do
local part_position_on_screen = {
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);
last_part_position_on_screen = part_position_on_screen;
end
return last_part_position_on_screen;
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
local health_supported = part.max_health >= 0;
local break_supported = part.break_max_health >= 0;
local severe_supported = part.loss_max_health >= 0;
if health_supported then
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue
end
else
if not cached_config.filter.health_break then
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue
end
else
if not cached_config.filter.health then
goto continue
end
end
end
else
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue
end
else
if not cached_config.filter.break_ then
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue
end
else
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_highlighted_UI.flinch_visibility or not health_supported)
and (
not part.body_part_highlighted_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_highlighted_UI.loss_visibility or not severe_supported or part.is_severed) then
if (not part_UI.flinch_visibility or not health_supported)
and (not part_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
@@ -739,7 +291,7 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
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);
body_part_UI_entity.draw(part, part_UI, cached_config, part_position_on_screen, opacity_scale);
last_part_position_on_screen = part_position_on_screen;
end

View File

@@ -9,6 +9,8 @@ local stamina_UI_entity;
local rage_UI_entity;
local ailment_UI_entity;
local ailment_buildup;
local ailment_buildup_UI_entity;
local body_part_UI_entity;
local screen;
local drawing;
local ailments;
@@ -83,10 +85,14 @@ function large_monster.new(enemy)
monster.rider_id = -1;
monster.dynamic_UI = {};
monster.static_UI = {};
monster.highlighted_UI = {};
large_monster.init(monster, enemy);
large_monster.init_static_UI(monster);
large_monster.init_dynamic_UI(monster);
large_monster.init_highlighted_UI(monster);
large_monster.init_UI(monster, monster.dynamic_UI, config.current_config.large_monster_UI.dynamic);
large_monster.init_UI(monster, monster.static_UI, config.current_config.large_monster_UI.static);
large_monster.init_UI(monster, monster.highlighted_UI, config.current_config.large_monster_UI.highlighted);
if large_monster.list[enemy] == nil then
large_monster.list[enemy] = monster;
@@ -190,13 +196,12 @@ function large_monster.init(monster, enemy)
end
end
function large_monster.init_dynamic_UI(monster)
local cached_config = config.current_config.large_monster_UI.dynamic;
function large_monster.init_UI(monster, monster_UI, cached_config)
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
monster.dynamic_name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster_UI.monster_name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster.health_dynamic_UI = health_UI_entity.new(
monster_UI.health_UI = health_UI_entity.new(
cached_config.health.visibility,
cached_config.health.bar,
cached_config.health.text_label,
@@ -204,18 +209,14 @@ function large_monster.init_dynamic_UI(monster)
cached_config.health.percentage_label
);
monster.health_dynamic_UI.bar.capture_line.offset.x = monster.health_dynamic_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.y = monster.health_dynamic_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.width = monster.health_dynamic_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.height = monster.health_dynamic_UI.bar.capture_line.size.height *
global_scale_modifier;
monster_UI.health_UI.bar.capture_line.offset.x = monster_UI.health_UI.bar.capture_line.offset.x * global_scale_modifier;
monster_UI.health_UI.bar.capture_line.offset.y = monster_UI.health_UI.bar.capture_line.offset.y * global_scale_modifier;
monster_UI.health_UI.bar.capture_line.size.width = monster_UI.health_UI.bar.capture_line.size.width * global_scale_modifier;
monster_UI.health_UI.bar.capture_line.size.height = monster_UI.health_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_dynamic_UI.bar.colors = cached_config.health.bar.normal_colors;
monster_UI.health_UI.bar.colors = monster_UI.health_UI.bar.normal_colors;
monster.stamina_dynamic_UI = stamina_UI_entity.new(
monster_UI.stamina_UI = stamina_UI_entity.new(
cached_config.stamina.visibility,
cached_config.stamina.bar,
cached_config.stamina.text_label,
@@ -224,7 +225,7 @@ function large_monster.init_dynamic_UI(monster)
cached_config.stamina.timer_label
);
monster.rage_dynamic_UI = rage_UI_entity.new(
monster_UI.rage_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
cached_config.rage.text_label,
@@ -233,11 +234,27 @@ function large_monster.init_dynamic_UI(monster)
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_dynamic_UI(part);
end
monster_UI.part_UI = body_part_UI_entity.new(
cached_config.body_parts.visibility,
cached_config.body_parts.part_name_label,
cached_config.body_parts.part_health.visibility,
cached_config.body_parts.part_health.bar,
cached_config.body_parts.part_health.text_label,
cached_config.body_parts.part_health.value_label,
cached_config.body_parts.part_health.percentage_label,
cached_config.body_parts.part_break.visibility,
cached_config.body_parts.part_break.bar,
cached_config.body_parts.part_break.text_label,
cached_config.body_parts.part_break.value_label,
cached_config.body_parts.part_break.percentage_label,
cached_config.body_parts.part_loss.visibility,
cached_config.body_parts.part_loss.bar,
cached_config.body_parts.part_loss.text_label,
cached_config.body_parts.part_loss.value_label,
cached_config.body_parts.part_loss.percentage_label
);
monster.ailment_dynamic_UI = ailment_UI_entity.new(
monster_UI.ailment_UI = ailment_UI_entity.new(
cached_config.ailments.visibility,
cached_config.ailments.bar,
cached_config.ailments.ailment_name_label,
@@ -247,130 +264,16 @@ function large_monster.init_dynamic_UI(monster)
cached_config.ailments.timer_label
);
ailments.init_ailment_buildup_dynamic_UI(monster.ailments);
end
function large_monster.init_static_UI(monster)
local cached_config = config.current_config.large_monster_UI.static;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
monster.static_name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster.static_name_label.offset.x = monster.static_name_label.offset.x * global_scale_modifier;
monster.static_name_label.offset.y = monster.static_name_label.offset.y * global_scale_modifier;
monster.health_static_UI = health_UI_entity.new(
cached_config.health.visibility,
cached_config.health.bar,
cached_config.health.text_label,
cached_config.health.value_label,
cached_config.health.percentage_label
monster_UI.ailment_buildup_UI = ailment_buildup_UI_entity.new(
cached_config.ailment_buildups.buildup_bar,
cached_config.ailment_buildups.highlighted_buildup_bar,
cached_config.ailment_buildups.ailment_name_label,
cached_config.ailment_buildups.player_name_label,
cached_config.ailment_buildups.buildup_value_label,
cached_config.ailment_buildups.buildup_percentage_label,
cached_config.ailment_buildups.total_buildup_label,
cached_config.ailment_buildups.total_buildup_value_label
);
monster.health_static_UI.bar.capture_line.offset.x = monster.health_static_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.y = monster.health_static_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.width = monster.health_static_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.height = monster.health_static_UI.bar.capture_line.size.height *
global_scale_modifier;
monster.health_static_UI.bar.colors = cached_config.health.bar.normal_colors;
monster.stamina_static_UI = stamina_UI_entity.new(
cached_config.stamina.visibility,
cached_config.stamina.bar,
cached_config.stamina.text_label,
cached_config.stamina.value_label,
cached_config.stamina.percentage_label,
cached_config.stamina.timer_label
);
monster.rage_static_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
cached_config.rage.text_label,
cached_config.rage.value_label,
cached_config.rage.percentage_label,
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_static_UI(part);
end
monster.ailment_static_UI = ailment_UI_entity.new(
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_static_UI(monster.ailments);
end
function large_monster.init_highlighted_UI(monster)
local cached_config = config.current_config.large_monster_UI.highlighted;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
monster.highlighted_name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster.health_highlighted_UI = health_UI_entity.new(
cached_config.health.visibility,
cached_config.health.bar,
cached_config.health.text_label,
cached_config.health.value_label,
cached_config.health.percentage_label
);
monster.health_highlighted_UI.bar.capture_line.offset.x = monster.health_highlighted_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.y = monster.health_highlighted_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.width = monster.health_highlighted_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.height = monster.health_highlighted_UI.bar.capture_line.size.height
* global_scale_modifier;
monster.health_highlighted_UI.bar.colors = cached_config.health.bar.normal_colors;
monster.stamina_highlighted_UI = stamina_UI_entity.new(
cached_config.stamina.visibility,
cached_config.stamina.bar,
cached_config.stamina.text_label,
cached_config.stamina.value_label,
cached_config.stamina.percentage_label,
cached_config.stamina.timer_label
);
monster.rage_highlighted_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
cached_config.rage.text_label,
cached_config.rage.value_label,
cached_config.rage.percentage_label,
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_highlighted_UI(part);
end
monster.ailment_highlighted_UI = ailment_UI_entity.new(
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_highlighted_UI(monster.ailments);
end
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
@@ -790,38 +693,48 @@ function large_monster.update_parts(enemy, monster, physical_param)
end
end
function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.dynamic;
function large_monster.draw(monster, type, cached_config, position_on_screen, opacity_scale)
local monster_UI;
xy = 1;
if type == "dynamic" then
monster_UI = monster.dynamic_UI;
elseif type == "static" then
monster_UI = monster.static_UI;
else
monster_UI = monster.highlighted_UI;
end
xy = 2;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
xy = 2.01;
local monster_name_text = "";
if cached_config.monster_name_label.include.monster_name then
monster_name_text = string.format("%s ", monster.name);
end
xy = 2.02;
if cached_config.monster_name_label.include.monster_id then
monster_name_text = monster_name_text .. tostring(monster.id) .. " ";
end
xy = 2.03;
if cached_config.monster_name_label.include.crown and monster.crown ~= "" then
monster_name_text = monster_name_text .. string.format("%s ", monster.crown);
end
xy = 2.04;
if cached_config.monster_name_label.include.size then
monster_name_text = monster_name_text .. string.format("#%.0f ", 100 * monster.size);
end
xy = 2.05;
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
end
xy = table_helpers.tostring(monster_UI);
if monster.health < monster.capture_health then
monster.health_dynamic_UI.bar.colors = cached_config.health.bar.capture_colors;
monster_UI.health_UI.bar.colors = monster_UI.health_UI.bar.capture_colors;
else
monster.health_dynamic_UI.bar.colors = cached_config.health.bar.normal_colors;
monster_UI.health_UI.bar.colors = monster_UI.health_UI.bar.normal_colors;
end
drawing.draw_label(monster.dynamic_name_label, position_on_screen, opacity_scale, monster_name_text);
xy = 2.1;
drawing.draw_label(monster_UI.monster_name_label, position_on_screen, opacity_scale, monster_name_text);
local health_position_on_screen = {
x = position_on_screen.x + cached_config.health.offset.x * global_scale_modifier,
@@ -853,106 +766,13 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
y = position_on_screen.y + cached_config.ailment_buildups.offset.y * global_scale_modifier
};
health_UI_entity.draw(monster, monster.health_dynamic_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_dynamic_UI, health_position_on_screen, opacity_scale,
monster.capture_percentage);
health_UI_entity.draw(monster, monster_UI.health_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster_UI.health_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
stamina_UI_entity.draw(monster, monster_UI.stamina_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster_UI.rage_UI, rage_position_on_screen, opacity_scale);
stamina_UI_entity.draw(monster, monster.stamina_dynamic_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_dynamic_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_dynamic(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = last_part_position_on_screen.x +
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * global_scale_modifier,
y = last_part_position_on_screen.y +
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * global_scale_modifier
};
end
end
ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_scale);
ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_screen, opacity_scale);
end
function large_monster.draw_static(monster, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.static;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local monster_name_text = "";
if cached_config.monster_name_label.include.monster_name then
monster_name_text = string.format("%s ", monster.name);
end
if cached_config.monster_name_label.include.monster_id then
monster_name_text = monster_name_text .. tostring(monster.id) .. " ";
end
if cached_config.monster_name_label.include.crown and monster.crown ~= "" then
monster_name_text = monster_name_text .. string.format("%s ", monster.crown);
end
if cached_config.monster_name_label.include.size then
monster_name_text = monster_name_text .. string.format("#%.0f ", 100 * monster.size);
end
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
monster.health_static_UI.bar.colors = cached_config.health.bar.capture_colors;
else
monster.health_static_UI.bar.colors = cached_config.health.bar.normal_colors;
end
drawing.draw_label(monster.static_name_label, position_on_screen, opacity_scale, monster_name_text);
local health_position_on_screen = {
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 + cached_config.stamina.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.stamina.offset.y * global_scale_modifier
};
local rage_position_on_screen = {
x = position_on_screen.x + cached_config.rage.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.rage.offset.y * global_scale_modifier
};
local parts_position_on_screen = {
x = position_on_screen.x + cached_config.body_parts.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.body_parts.offset.y * global_scale_modifier
};
local ailments_position_on_screen = {
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 + 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_static_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_static_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
stamina_UI_entity.draw(monster, monster.stamina_static_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_static_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_static(monster,
parts_position_on_screen
, opacity_scale);
local last_part_position_on_screen = body_part.draw(monster, monster_UI.part_UI, cached_config, parts_position_on_screen, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
@@ -963,95 +783,8 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
end
end
ailments.draw_static(monster, ailments_position_on_screen, opacity_scale);
ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale);
end
function large_monster.draw_highlighted(monster, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.highlighted;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local monster_name_text = "";
if cached_config.monster_name_label.include.monster_name then
monster_name_text = string.format("%s ", monster.name);
end
if cached_config.monster_name_label.include.monster_id then
monster_name_text = monster_name_text .. tostring(monster.id) .. " ";
end
if cached_config.monster_name_label.include.crown and monster.crown ~= "" then
monster_name_text = monster_name_text .. string.format("%s ", monster.crown);
end
if cached_config.monster_name_label.include.size then
monster_name_text = monster_name_text .. string.format("#%.0f ", 100 * monster.size);
end
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
monster.health_highlighted_UI.bar.colors = cached_config.health.bar.capture_colors;
else
monster.health_highlighted_UI.bar.colors = cached_config.health.bar.normal_colors;
end
drawing.draw_label(monster.highlighted_name_label, position_on_screen, opacity_scale, monster_name_text);
local health_position_on_screen = {
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 + cached_config.stamina.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.stamina.offset.y * global_scale_modifier
};
local rage_position_on_screen = {
x = position_on_screen.x + cached_config.rage.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.rage.offset.y * global_scale_modifier
};
local parts_position_on_screen = {
x = position_on_screen.x + cached_config.body_parts.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.body_parts.offset.y * global_scale_modifier
};
local ailments_position_on_screen = {
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 + 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_highlighted_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_highlighted_UI, health_position_on_screen, opacity_scale,
monster.capture_percentage);
stamina_UI_entity.draw(monster, monster.stamina_highlighted_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_highlighted_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_highlighted(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = last_part_position_on_screen.x + cached_config.ailments.relative_offset.x * global_scale_modifier,
y = last_part_position_on_screen.y + cached_config.ailments.relative_offset.y * global_scale_modifier
};
end
end
ailments.draw_highlighted(monster, ailments_position_on_screen, opacity_scale);
ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale);
ailments.draw(monster, monster_UI.ailment_UI, cached_config, ailments_position_on_screen, opacity_scale);
ailment_buildup.draw(monster, monster_UI.ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale);
end
function large_monster.init_list()
@@ -1069,6 +802,8 @@ function large_monster.init_module()
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity");
ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity");
body_part_UI_entity = require("MHR_Overlay.UI.UI_Entities.body_part_UI_entity");
screen = require("MHR_Overlay.Game_Handler.screen");
drawing = require("MHR_Overlay.UI.drawing");

View File

@@ -10,6 +10,7 @@ local drawing;
local ailments;
local ailment_UI_entity;
local ailment_buildup;
local ailment_buildup_UI_entity;
small_monster.list = {};
@@ -27,9 +28,11 @@ function small_monster.new(enemy)
monster.distance = 0;
monster.name = "Small Monster";
monster.ailments = ailments.init_ailments();
monster.UI = {};
small_monster.init(monster, enemy);
small_monster.init_UI(monster);
@@ -78,12 +81,14 @@ function small_monster.init_UI(monster)
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 = table_helpers.deep_copy(cached_config.monster_name_label);
local monster_UI = monster.UI;
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_UI.name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster_UI.name_label.offset.x = monster_UI.name_label.offset.x * global_scale_modifier;
monster_UI.name_label.offset.y = monster_UI.name_label.offset.y * global_scale_modifier;
monster.health_UI = health_UI_entity.new(
monster_UI.health_UI = health_UI_entity.new(
cached_config.health.visibility,
cached_config.health.bar,
cached_config.health.text_label,
@@ -91,17 +96,26 @@ function small_monster.init_UI(monster)
cached_config.health.percentage_label
);
monster.ailment_UI = ailment_UI_entity.new(
monster_UI.ailment_UI = ailment_UI_entity.new(
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.percentage_label,
cached_config.ailments.timer_label
);
ailments.init_ailment_buildup_small_UI(monster.ailments);
monster_UI.ailment_buildup_UI = ailment_buildup_UI_entity.new(
cached_config.ailment_buildups.buildup_bar,
cached_config.ailment_buildups.highlighted_buildup_bar,
cached_config.ailment_buildups.ailment_name_label,
cached_config.ailment_buildups.player_name_label,
cached_config.ailment_buildups.buildup_value_label,
cached_config.ailment_buildups.buildup_percentage_label,
cached_config.ailment_buildups.total_buildup_label,
cached_config.ailment_buildups.total_buildup_value_label
);
end
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
@@ -171,11 +185,10 @@ function small_monster.update_health(enemy, monster)
end
end
function small_monster.draw(monster, position_on_screen, opacity_scale)
local cached_config = config.current_config.small_monster_UI;
function small_monster.draw(monster, cached_config, position_on_screen, opacity_scale)
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);
drawing.draw_label(monster.UI.name_label, position_on_screen, opacity_scale, monster.name);
local health_position_on_screen = {
x = position_on_screen.x + cached_config.health.offset.x * global_scale_modifier,
@@ -192,9 +205,9 @@ function small_monster.draw(monster, position_on_screen, opacity_scale)
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);
ailments.draw_small(monster, ailments_position_on_screen, opacity_scale);
ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale);
health_UI_entity.draw(monster, monster.UI.health_UI, health_position_on_screen, opacity_scale);
ailments.draw(monster, monster.UI.ailment_UI, cached_config, ailments_position_on_screen, opacity_scale);
ailment_buildup.draw(monster, monster.UI.ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale);
end
function small_monster.init_list()
@@ -213,6 +226,7 @@ function small_monster.init_module()
ailments = require("MHR_Overlay.Monsters.ailments");
ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity");
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity");
end
return small_monster;

View File

@@ -57,7 +57,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
local monster = large_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
customization_menu.status = "No large monster hp entry";
goto continue
end
@@ -137,7 +137,7 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
opacity_scale = 1 - (monster.distance / cached_config.settings.max_distance);
end
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
large_monster.draw(monster, "dynamic", cached_config, position_on_screen, opacity_scale);
i = i + 1;
::continue::
@@ -218,7 +218,7 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
end
large_monster.draw_static(monster, monster_position_on_screen, 1);
large_monster.draw(monster, "static", cached_config, monster_position_on_screen, 1);
i = i + 1;
::continue::
@@ -238,7 +238,7 @@ function large_monster_UI.draw_highlighted(monster)
return;
end
large_monster.draw_highlighted(monster, position_on_screen, 1);
large_monster.draw(monster, "highlighted", cached_config, position_on_screen, 1);
end
function large_monster_UI.init_module()

View File

@@ -38,7 +38,7 @@ function small_monster_UI.draw()
local monster = small_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
customization_menu.status = "No small monster hp entry";
goto continue
end
@@ -147,7 +147,7 @@ function small_monster_UI.draw()
small_monster.draw(monster, position_on_screen, opacity_scale);
small_monster.draw(monster, cached_config, position_on_screen, opacity_scale);
i = i + 1;
::continue::

View File

@@ -42,112 +42,11 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
return entity;
end
function ailment_UI_entity.draw_dynamic(ailment, ailment_UI, position_on_screen, opacity_scale)
function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale)
if not ailment_UI.visibility then
return;
end
local cached_config = config.current_config.large_monster_UI.dynamic.ailments;
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";
end
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
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
function ailment_UI_entity.draw_static(ailment, ailment_UI, position_on_screen, opacity_scale)
if not ailment_UI.visibility then
return;
end
local cached_config = config.current_config.large_monster_UI.static.ailments;
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";
end
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
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
function ailment_UI_entity.draw_highlighted(ailment, ailment_UI, position_on_screen, opacity_scale)
if not ailment_UI.visibility then
return;
end
local cached_config = config.current_config.large_monster_UI.highlighted.ailments;
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";
end
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
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
function ailment_UI_entity.draw_small(ailment, ailment_UI, position_on_screen, opacity_scale)
if not ailment_UI.visibility then
return;
end
local cached_config = config.current_config.small_monster_UI.ailments;
local ailment_name = "";
if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " ";

View File

@@ -55,11 +55,9 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
return entity;
end
function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
top_buildup)
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
function ailment_buildup_UI_entity.draw(_player, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
local player_buildup_bar_percentage = 0;
xy = 11.1;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share;
else
@@ -67,111 +65,19 @@ function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, pos
player_buildup_bar_percentage = _player.buildup / top_buildup;
end
end
xy = 11.2;
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
xy = 11.3;
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
end
function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
top_buildup)
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
local player_buildup_bar_percentage = 0;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share;
else
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
end
end
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
end
function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
top_buildup)
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
local player_buildup_bar_percentage = 0;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share;
else
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
end
end
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
end
function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
local player_buildup_bar_percentage = 0;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share;
else
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
end
end
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
player_buildup_bar_percentage);
else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
xy = 11.4;
end
function ailment_buildup_UI_entity.init_module()

View File

@@ -87,10 +87,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi
return entity;
end
function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
if not part.body_part_dynamic_UI.part_visibility then
function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_screen, opacity_scale)
if not part_UI.part_visibility then
return;
end
@@ -122,251 +120,61 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
local flinch_position_on_screen = {
x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + cached_config.part_health.offset.y,
visibility = part.body_part_dynamic_UI.flinch_visibility
visibility = part_UI.flinch_visibility
};
local break_position_on_screen = {
x = position_on_screen.x + cached_config.part_break.offset.x,
y = position_on_screen.y + cached_config.part_break.offset.y,
visibility = part.body_part_dynamic_UI.flinch_visibility
visibility = part_UI.flinch_visibility
};
local loss_position_on_screen = {
x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + cached_config.part_loss.offset.y
y = position_on_screen.y + cached_config.part_loss.offset.y,
part_UI = part_UI.loss_visibility
};
if part.body_part_dynamic_UI.flinch_visibility then
drawing.draw_bar(part.body_part_dynamic_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
if part_UI.flinch_visibility then
drawing.draw_bar(part_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
part.health_percentage);
end
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
if part_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
part.break_max_count then
drawing.draw_bar(part.body_part_dynamic_UI.break_bar, break_position_on_screen, opacity_scale,
drawing.draw_bar(part_UI.break_bar, break_position_on_screen, opacity_scale,
part.break_health_percentage);
end
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_bar(part.body_part_dynamic_UI.loss_bar, loss_position_on_screen, opacity_scale,
if part_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_bar(part_UI.loss_bar, loss_position_on_screen, opacity_scale,
part.loss_health_percentage);
end
drawing.draw_label(part.body_part_dynamic_UI.part_name_label, position_on_screen, opacity_scale, part_name);
drawing.draw_label(part_UI.part_name_label, position_on_screen, opacity_scale, part_name);
if part.body_part_dynamic_UI.flinch_visibility then
drawing.draw_label(part.body_part_dynamic_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_dynamic_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
if part_UI.flinch_visibility then
drawing.draw_label(part_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
health_string);
drawing.draw_label(part.body_part_dynamic_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
drawing.draw_label(part_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
100 * part.health_percentage);
end
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
if part_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
part.break_max_count then
drawing.draw_label(part.body_part_dynamic_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_dynamic_UI.break_value_label, break_position_on_screen, opacity_scale,
drawing.draw_label(part_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part_UI.break_value_label, break_position_on_screen, opacity_scale,
break_health_string);
drawing.draw_label(part.body_part_dynamic_UI.break_percentage_label, break_position_on_screen, opacity_scale,
drawing.draw_label(part_UI.break_percentage_label, break_position_on_screen, opacity_scale,
100 * part.break_health_percentage);
end
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_label(part.body_part_dynamic_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_dynamic_UI.loss_value_label, loss_position_on_screen, opacity_scale,
if part_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_label(part_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part_UI.loss_value_label, loss_position_on_screen, opacity_scale,
loss_health_string);
drawing.draw_label(part.body_part_dynamic_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
100 * part.loss_health_percentage);
end
end
function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.static.body_parts;
if not part.body_part_static_UI.part_visibility then
return;
end
local part_name = "";
if cached_config.part_name_label.include.part_name then
part_name = part.name .. " ";
end
if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
end
if part.break_max_count ~= 0 then
if cached_config.part_name_label.include.break_count then
if cached_config.part_name_label.include.break_max_count then
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count);
end
elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count);
end
end
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = {
x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + cached_config.part_health.offset.y,
visibility = part.body_part_static_UI.flinch_visibility
};
local break_position_on_screen = {
x = position_on_screen.x + cached_config.part_break.offset.x,
y = position_on_screen.y + cached_config.part_break.offset.y,
visibility = part.body_part_static_UI.flinch_visibility
};
local loss_position_on_screen = {
x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + cached_config.part_loss.offset.y
};
if part.body_part_static_UI.flinch_visibility then
drawing.draw_bar(part.body_part_static_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
end
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
part.break_max_count then
drawing.draw_bar(part.body_part_static_UI.break_bar, break_position_on_screen, opacity_scale,
part.break_health_percentage);
end
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_bar(part.body_part_static_UI.loss_bar, loss_position_on_screen, opacity_scale,
part.loss_health_percentage);
end
drawing.draw_label(part.body_part_static_UI.part_name_label, position_on_screen, opacity_scale, part_name);
if part.body_part_static_UI.flinch_visibility then
drawing.draw_label(part.body_part_static_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_static_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
health_string);
drawing.draw_label(part.body_part_static_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
100 * part.health_percentage);
end
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
part.break_max_count then
drawing.draw_label(part.body_part_static_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_static_UI.break_value_label, break_position_on_screen, opacity_scale,
break_health_string);
drawing.draw_label(part.body_part_static_UI.break_percentage_label, break_position_on_screen, opacity_scale,
100 * part.break_health_percentage);
end
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_label(part.body_part_static_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_static_UI.loss_value_label, loss_position_on_screen, opacity_scale,
loss_health_string);
drawing.draw_label(part.body_part_static_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
100 * part.loss_health_percentage);
end
end
function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
if not part.body_part_highlighted_UI.part_visibility then
return;
end
local part_name = "";
if cached_config.part_name_label.include.part_name then
part_name = part.name .. " ";
end
if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
end
if part.break_max_count ~= 0 then
if cached_config.part_name_label.include.break_count then
if cached_config.part_name_label.include.break_max_count then
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count);
end
elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count);
end
end
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = {
x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + cached_config.part_health.offset.y,
visibility = part.body_part_highlighted_UI.flinch_visibility
};
local break_position_on_screen = {
x = position_on_screen.x + cached_config.part_break.offset.x,
y = position_on_screen.y + cached_config.part_break.offset.y,
visibility = part.body_part_highlighted_UI.flinch_visibility
};
local loss_position_on_screen = {
x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + cached_config.part_loss.offset.y
};
local draw_health = part.body_part_highlighted_UI.flinch_visibility and part.max_health > 0;
local draw_break = part.body_part_highlighted_UI.break_visibility and part.break_max_health > 0 and part.break_count <
part.break_max_count;
local draw_loss = part.body_part_highlighted_UI.loss_visibility and part.loss_max_health > 0 and not part.is_severed;
if draw_health then
drawing.draw_bar(part.body_part_highlighted_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
part.health_percentage);
end
if draw_break then
drawing.draw_bar(part.body_part_highlighted_UI.break_bar, break_position_on_screen, opacity_scale,
part.break_health_percentage);
end
if draw_loss then
drawing.draw_bar(part.body_part_highlighted_UI.loss_bar, loss_position_on_screen, opacity_scale,
part.loss_health_percentage);
end
drawing.draw_label(part.body_part_highlighted_UI.part_name_label, position_on_screen, opacity_scale, part_name);
if draw_health then
drawing.draw_label(part.body_part_highlighted_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_highlighted_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
health_string);
drawing.draw_label(part.body_part_highlighted_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
100 * part.health_percentage);
end
if draw_break then
drawing.draw_label(part.body_part_highlighted_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_highlighted_UI.break_value_label, break_position_on_screen, opacity_scale,
break_health_string);
drawing.draw_label(part.body_part_highlighted_UI.break_percentage_label, break_position_on_screen, opacity_scale,
100 * part.break_health_percentage);
end
if draw_loss then
drawing.draw_label(part.body_part_highlighted_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_highlighted_UI.loss_value_label, loss_position_on_screen, opacity_scale,
loss_health_string);
drawing.draw_label(part.body_part_highlighted_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
drawing.draw_label(part_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
100 * part.loss_health_percentage);
end
end

File diff suppressed because it is too large Load Diff