mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 12:28:03 -08:00
Refactoring
This commit is contained in:
@@ -34,7 +34,7 @@ function damage_meter_UI.get_players(player_info_list)
|
||||
local quest_players = {};
|
||||
|
||||
local count = get_count_method:call(player_info_list);
|
||||
|
||||
|
||||
if count == nil then
|
||||
customization_menu.status = "No player info list count";
|
||||
return {};
|
||||
@@ -44,18 +44,18 @@ function damage_meter_UI.get_players(player_info_list)
|
||||
local player_info = get_item_method:call(player_info_list, i);
|
||||
|
||||
if player_info == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local player_id = member_index_field:get_data(player_info);
|
||||
if player_id == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
local _player = player.get_player(player_id);
|
||||
if _player ~= nil then
|
||||
if _player == player.myself and cached_config.settings.my_damage_bar_location ~= "Normal" then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
table.insert(quest_players, _player);
|
||||
end
|
||||
@@ -128,7 +128,7 @@ function damage_meter_UI.draw()
|
||||
end
|
||||
damage_meter_UI.last_displayed_players = quest_players;
|
||||
end
|
||||
|
||||
|
||||
local top_damage = 0;
|
||||
local top_dps = 0;
|
||||
for _, _player in ipairs(quest_players) do
|
||||
@@ -140,20 +140,20 @@ function damage_meter_UI.draw()
|
||||
top_dps = _player.dps;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- draw
|
||||
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
for _, _player in ipairs(quest_players) do
|
||||
if _player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if _player == player.myself then
|
||||
if cached_config.settings.hide_myself then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
elseif cached_config.settings.hide_other_players then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
player.draw(_player, position_on_screen, 1, top_damage, top_dps);
|
||||
@@ -195,4 +195,4 @@ function damage_meter_UI.init_module()
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
end
|
||||
|
||||
return damage_meter_UI;
|
||||
return damage_meter_UI;
|
||||
|
||||
@@ -23,35 +23,36 @@ function env_creature_UI.draw()
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
for REcreature, creature in pairs(env_creature.list) do
|
||||
|
||||
|
||||
if cached_config.settings.max_distance == 0 then
|
||||
break;
|
||||
break
|
||||
end
|
||||
|
||||
if cached_config.settings.hide_inactive_creatures and creature.is_inactive then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local position_on_screen = {};
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y,
|
||||
cached_config.world_offset.z);
|
||||
|
||||
position_on_screen = draw.world_to_screen(creature.position + world_offset);
|
||||
|
||||
|
||||
if position_on_screen == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
|
||||
position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
|
||||
|
||||
|
||||
creature.distance = (player.myself_position - creature.position):length();
|
||||
|
||||
local opacity_scale = 1;
|
||||
if creature.distance > cached_config.settings.max_distance then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
if cached_config.settings.opacity_falloff then
|
||||
opacity_scale = 1 - (creature.distance / cached_config.settings.max_distance);
|
||||
end
|
||||
@@ -61,7 +62,6 @@ function env_creature_UI.draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function env_creature_UI.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
@@ -77,4 +77,4 @@ function env_creature_UI.init_module()
|
||||
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
|
||||
end
|
||||
|
||||
return env_creature_UI;
|
||||
return env_creature_UI;
|
||||
|
||||
@@ -25,7 +25,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
if singletons.enemy_manager == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local displayed_monsters = {};
|
||||
|
||||
local highlighted_id = -1;
|
||||
@@ -43,7 +43,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager);
|
||||
if enemy_count == nil then
|
||||
return;
|
||||
@@ -53,13 +53,13 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i);
|
||||
if enemy == nil then
|
||||
customization_menu.status = "No enemy";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local monster = large_monster.list[enemy];
|
||||
if monster == nil then
|
||||
customization_menu.status = "No monster hp entry";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster.dead_or_captured or not monster.is_disp_icon_mini_map then
|
||||
@@ -79,7 +79,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
|
||||
if dynamic_enabled then
|
||||
large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
|
||||
--large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
|
||||
end
|
||||
|
||||
if highlighted_enabled then
|
||||
@@ -87,7 +87,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
|
||||
if static_enabled then
|
||||
large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
|
||||
--large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,45 +98,46 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
|
||||
local i = 0;
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
if cached_config.settings.max_distance == 0 then
|
||||
break;
|
||||
break
|
||||
end
|
||||
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster == highlighted_monster then
|
||||
if not cached_config.settings.render_highlighted_monster then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
else
|
||||
if not cached_config.settings.render_not_highlighted_monsters then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
local position_on_screen = {};
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
|
||||
|
||||
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y,
|
||||
cached_config.world_offset.z);
|
||||
|
||||
position_on_screen = draw.world_to_screen(monster.position + world_offset);
|
||||
|
||||
|
||||
if position_on_screen == nil then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
|
||||
position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
|
||||
|
||||
local opacity_scale = 1;
|
||||
if monster.distance > cached_config.settings.max_distance then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
if cached_config.settings.opacity_falloff then
|
||||
opacity_scale = 1 - (monster.distance / cached_config.settings.max_distance);
|
||||
end
|
||||
|
||||
|
||||
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
|
||||
|
||||
i = i + 1;
|
||||
@@ -147,14 +148,14 @@ end
|
||||
function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
local cached_config = config.current_config.large_monster_UI.static;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
|
||||
-- sort here
|
||||
if cached_config.sorting.type == "Normal" and cached_config.sorting.reversed_order then
|
||||
local reversed_monsters = {};
|
||||
for i = #displayed_monsters, 1, -1 do
|
||||
table.insert(reversed_monsters, displayed_monsters[i]);
|
||||
end
|
||||
|
||||
|
||||
displayed_monsters = reversed_monsters;
|
||||
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
@@ -194,16 +195,16 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
local i = 0;
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster == highlighted_monster then
|
||||
if not cached_config.settings.render_highlighted_monster then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
else
|
||||
if not cached_config.settings.render_not_highlighted_monsters then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
@@ -211,11 +212,11 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
x = position_on_screen.x,
|
||||
y = position_on_screen.y
|
||||
}
|
||||
|
||||
|
||||
if cached_config.settings.orientation == "Horizontal" then
|
||||
monster_position_on_screen.x = monster_position_on_screen.x + cached_config.spacing.x * i * global_scale_modifier;
|
||||
else
|
||||
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
|
||||
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
|
||||
end
|
||||
|
||||
large_monster.draw_static(monster, monster_position_on_screen, 1);
|
||||
@@ -231,13 +232,13 @@ function large_monster_UI.draw_highlighted(monster)
|
||||
if monster == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
large_monster.draw_highlighted(monster, position_on_screen, 1);
|
||||
end
|
||||
|
||||
@@ -255,4 +256,4 @@ function large_monster_UI.init_module()
|
||||
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
||||
end
|
||||
|
||||
return large_monster_UI;
|
||||
return large_monster_UI;
|
||||
|
||||
@@ -33,17 +33,17 @@ function small_monster_UI.draw()
|
||||
local enemy = get_zako_enemy_method:call(singletons.enemy_manager, i);
|
||||
if enemy == nil then
|
||||
customization_menu.status = "No enemy";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
local monster = small_monster.list[enemy];
|
||||
if monster == nil then
|
||||
customization_menu.status = "No monster hp entry";
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
table.insert(displayed_monsters, monster);
|
||||
@@ -51,7 +51,7 @@ function small_monster_UI.draw()
|
||||
end
|
||||
|
||||
if cached_config.dynamic_positioning.enabled
|
||||
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
|
||||
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
monster.distance = (player.myself_position - monster.position):length();
|
||||
end
|
||||
@@ -99,13 +99,15 @@ function small_monster_UI.draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local i = 0;
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
local position_on_screen;
|
||||
|
||||
if cached_config.dynamic_positioning.enabled then
|
||||
local world_offset = Vector3f.new(cached_config.dynamic_positioning.world_offset.x, cached_config.dynamic_positioning.world_offset.y, cached_config.dynamic_positioning.world_offset.z);
|
||||
local world_offset = Vector3f.new(cached_config.dynamic_positioning.world_offset.x,
|
||||
cached_config.dynamic_positioning.world_offset.y,
|
||||
cached_config.dynamic_positioning.world_offset.z);
|
||||
|
||||
position_on_screen = draw.world_to_screen(monster.position + world_offset);
|
||||
|
||||
@@ -125,9 +127,9 @@ function small_monster_UI.draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local opacity_scale = 1;
|
||||
if cached_config.dynamic_positioning.enabled then
|
||||
if cached_config.dynamic_positioning.max_distance == 0 then
|
||||
@@ -135,9 +137,9 @@ function small_monster_UI.draw()
|
||||
end
|
||||
|
||||
if monster.distance > cached_config.dynamic_positioning.max_distance then
|
||||
goto continue;
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
if cached_config.dynamic_positioning.opacity_falloff then
|
||||
opacity_scale = 1 - (monster.distance / cached_config.dynamic_positioning.max_distance);
|
||||
end
|
||||
@@ -146,7 +148,7 @@ function small_monster_UI.draw()
|
||||
|
||||
|
||||
small_monster.draw(monster, position_on_screen, opacity_scale);
|
||||
|
||||
|
||||
i = i + 1;
|
||||
::continue::
|
||||
end
|
||||
@@ -165,4 +167,4 @@ function small_monster_UI.init_module()
|
||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||
end
|
||||
|
||||
return small_monster_UI;
|
||||
return small_monster_UI;
|
||||
|
||||
@@ -16,8 +16,8 @@ function time_UI.draw()
|
||||
end
|
||||
|
||||
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.time_UI.position);
|
||||
|
||||
drawing.draw_label(time_UI.label , position_on_screen, 1, elapsed_minutes, elapsed_seconds);
|
||||
|
||||
drawing.draw_label(time_UI.label, position_on_screen, 1, elapsed_minutes, elapsed_seconds);
|
||||
end
|
||||
|
||||
function time_UI.init_UI()
|
||||
@@ -39,4 +39,4 @@ function time_UI.init_module()
|
||||
time_UI.init_UI()
|
||||
end
|
||||
|
||||
return time_UI;
|
||||
return time_UI;
|
||||
|
||||
Reference in New Issue
Block a user