Added DPS, missing offsets and additional options.

This commit is contained in:
GreenComfyTea
2022-02-16 21:02:34 +02:00
parent fa494d7d56
commit 39e324e0a5
17 changed files with 1057 additions and 200 deletions

View File

@@ -149,7 +149,17 @@ function damage_meter_UI.draw()
table.insert(reversed_quest_players, quest_players[i]);
end
quest_players = reversed_quest_players;
elseif config.current_config.damage_meter_UI.sorting.type == "Damage" then
elseif config.current_config.damage_meter_UI.sorting.type == "DPS" then
if config.current_config.damage_meter_UI.sorting.reversed_order then
table.sort(quest_players, function(left, right)
return left.dps < right.dps;
end);
else
table.sort(quest_players, function(left, right)
return left.dps > right.dps;
end);
end
else
if config.current_config.damage_meter_UI.sorting.reversed_order then
table.sort(quest_players, function(left, right)
return left.display.total_damage < right.display.total_damage;
@@ -173,10 +183,15 @@ function damage_meter_UI.draw()
end
local top_damage = 0;
local top_dps = 0;
for _, _player in ipairs(quest_players) do
if _player.display.total_damage > top_damage then
top_damage = _player.display.total_damage;
end
if _player.dps > top_dps then
top_dps = _player.dps;
end
end
-- draw
@@ -187,7 +202,7 @@ function damage_meter_UI.draw()
goto continue1
end
player.draw(_player, position_on_screen, 1, top_damage);
player.draw(_player, position_on_screen, 1, top_damage, top_dps);
if config.current_config.damage_meter_UI.settings.orientation == "Horizontal" then
position_on_screen.x = position_on_screen.x + config.current_config.damage_meter_UI.spacing.x;
@@ -210,7 +225,7 @@ function damage_meter_UI.draw()
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_label, position_on_screen, 1, language.current_language.UI.total_damage);
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_value_label, position_on_screen, 1, player.total.display.total_damage);
drawing.draw_label(config.current_config.damage_meter_UI.total_dps_label, position_on_screen, 1, player.total.dps);
end
function damage_meter_UI.init_module()

View File

@@ -70,7 +70,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
if dynamic_enabled then
large_monster_UI.draw_dynamic(displayed_monsters);
large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
end
if highlighted_enabled then
@@ -78,12 +78,12 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
if static_enabled then
large_monster_UI.draw_static(displayed_monsters);
large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
end
end
function large_monster_UI.draw_dynamic(displayed_monsters)
function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if config.current_config.large_monster_UI.dynamic.settings.max_distance == 0 then
@@ -94,6 +94,16 @@ function large_monster_UI.draw_dynamic(displayed_monsters)
goto continue;
end
if monster == highlighted_monster then
if not config.current_config.large_monster_UI.dynamic.settings.render_highlighted_monster then
goto continue;
end
else
if not config.current_config.large_monster_UI.dynamic.settings.render_not_highlighted_monsters then
goto continue;
end
end
local position_on_screen = {};
local world_offset = Vector3f.new(config.current_config.large_monster_UI.dynamic.world_offset.x, config.current_config.large_monster_UI.dynamic.world_offset.y, config.current_config.large_monster_UI.dynamic.world_offset.z);
@@ -123,7 +133,7 @@ function large_monster_UI.draw_dynamic(displayed_monsters)
end
end
function large_monster_UI.draw_static(displayed_monsters)
function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
-- sort here
if config.current_config.large_monster_UI.static.sorting.type == "Normal" and config.current_config.large_monster_UI.static.sorting.reversed_order then
local reversed_monsters = {};
@@ -173,6 +183,16 @@ function large_monster_UI.draw_static(displayed_monsters)
goto continue;
end
if monster == highlighted_monster then
if not config.current_config.large_monster_UI.static.settings.render_highlighted_monster then
goto continue;
end
else
if not config.current_config.large_monster_UI.static.settings.render_not_highlighted_monsters then
goto continue;
end
end
local monster_position_on_screen = {
x = position_on_screen.x,
y = position_on_screen.y

View File

@@ -1,45 +1,24 @@
local time_UI = {};
local singletons;
local customization_menu;
local time;
local screen;
local config;
local drawing;
local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager");
local get_quest_elapsed_time_min_method = quest_manager_type_def:get_method("getQuestElapsedTimeMin");
local get_quest_elapseD_time_sec_method = quest_manager_type_def:get_method("getQuestElapsedTimeSec");
function time_UI.draw()
if singletons.quest_manager == nil then
return;
end
local elapsed_minutes = time.elapsed_minutes;
local elapsed_seconds = time.elapsed_seconds;
local quest_time_elapsed_minutes = get_quest_elapsed_time_min_method:call( singletons.quest_manager);
if quest_time_elapsed_minutes == nil then
customization_menu.status = "No quest time elapsed minutes";
if elapsed_seconds == 0 and elapsed_minutes == 0 then
return;
end
local quest_time_total_elapsed_seconds = get_quest_elapseD_time_sec_method:call(singletons.quest_manager);
if quest_time_total_elapsed_seconds == nil then
customization_menu.status = "No quest time total elapsed seconds";
return;
end
if quest_time_total_elapsed_seconds == 0 then
return;
end
local quest_time_elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.time_UI.position);
drawing.draw_label(config.current_config.time_UI.time_label, position_on_screen, 1, quest_time_elapsed_minutes, quest_time_elapsed_seconds);
drawing.draw_label(config.current_config.time_UI.time_label, position_on_screen, 1, elapsed_minutes, elapsed_seconds);
end
function time_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
time = require("MHR_Overlay.Game_Handler.time");
screen = require("MHR_Overlay.Game_Handler.screen");
config = require("MHR_Overlay.Misc.config");
drawing = require("MHR_Overlay.UI.drawing");