mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
HR in singleplayer fixed, bug when monster is sleeping fixed
This commit is contained in:
@@ -262,11 +262,11 @@ local damage_meter_UI = {
|
|||||||
---------------------------GLOBAL----------------------------
|
---------------------------GLOBAL----------------------------
|
||||||
log.info("[MHR_Overlay.lua] loaded");
|
log.info("[MHR_Overlay.lua] loaded");
|
||||||
|
|
||||||
status = "OK";
|
local status = "OK";
|
||||||
x = "";
|
local x = "";
|
||||||
|
|
||||||
screen_width = 0;
|
local screen_width = 0;
|
||||||
screen_height = 0;
|
local screen_height = 0;
|
||||||
|
|
||||||
local scene_manager = sdk.get_native_singleton("via.SceneManager");
|
local scene_manager = sdk.get_native_singleton("via.SceneManager");
|
||||||
if scene_manager == nil then
|
if scene_manager == nil then
|
||||||
@@ -282,8 +282,9 @@ end
|
|||||||
|
|
||||||
|
|
||||||
re.on_draw_ui(function()
|
re.on_draw_ui(function()
|
||||||
if string.len(status) > 0 then
|
local status_string = tostring(status);
|
||||||
imgui.text("[MHR_Overlay.lua] Status: " .. tostring(status));
|
if string.len(status_string) > 0 then
|
||||||
|
imgui.text("[MHR_Overlay.lua] Status: " .. status_string);
|
||||||
end
|
end
|
||||||
|
|
||||||
_, monster_UI.enabled = imgui.checkbox("Enable monster health UI", monster_UI.enabled)
|
_, monster_UI.enabled = imgui.checkbox("Enable monster health UI", monster_UI.enabled)
|
||||||
@@ -490,7 +491,6 @@ function monster_health()
|
|||||||
return result;
|
return result;
|
||||||
end);
|
end);
|
||||||
end
|
end
|
||||||
|
|
||||||
local i = 0;
|
local i = 0;
|
||||||
for _, monster in ipairs(monsters) do
|
for _, monster in ipairs(monsters) do
|
||||||
local screen_position = calculate_screen_coordinates(monster_UI.position);
|
local screen_position = calculate_screen_coordinates(monster_UI.position);
|
||||||
@@ -529,8 +529,9 @@ function monster_health()
|
|||||||
|
|
||||||
if monster_UI.visibility.current_health or monster_UI.visibility.max_health then
|
if monster_UI.visibility.current_health or monster_UI.visibility.max_health then
|
||||||
local health_values = "";
|
local health_values = "";
|
||||||
|
|
||||||
if monster_UI.visibility.current_health then
|
if monster_UI.visibility.current_health then
|
||||||
health_values = string.format("%d", monster.health);
|
health_values = string.format("%.0f", monster.health);
|
||||||
end
|
end
|
||||||
|
|
||||||
if monster_UI.visibility.max_health then
|
if monster_UI.visibility.max_health then
|
||||||
@@ -538,7 +539,7 @@ function monster_health()
|
|||||||
health_values = health_values .. "/";
|
health_values = health_values .. "/";
|
||||||
end
|
end
|
||||||
|
|
||||||
health_values = health_values .. string.format("%d", monster.max_health);
|
health_values = health_values .. string.format("%.0f", monster.max_health);
|
||||||
end
|
end
|
||||||
|
|
||||||
if monster_UI.shadows.health_values then
|
if monster_UI.shadows.health_values then
|
||||||
@@ -613,10 +614,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-----------------------DAMAGE METER UI-----------------------
|
-----------------------DAMAGE METER UI-----------------------
|
||||||
players = {};
|
local players = {};
|
||||||
is_quest_online = false;
|
local is_quest_online = false;
|
||||||
last_displayed_players = {};
|
local last_displayed_players = {};
|
||||||
myself_player_id = 0;
|
local myself_player_id = 0;
|
||||||
|
|
||||||
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
|
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
|
||||||
local enemy_character_base_after_calc_damage_damage_side = enemy_character_base_type_def:get_method("afterCalcDamage_DamageSide");
|
local enemy_character_base_after_calc_damage_damage_side = enemy_character_base_type_def:get_method("afterCalcDamage_DamageSide");
|
||||||
@@ -744,7 +745,7 @@ function merge_damage(first, second)
|
|||||||
first.ailment_damage = first.ailment_damage + second.ailment_damage;
|
first.ailment_damage = first.ailment_damage + second.ailment_damage;
|
||||||
end
|
end
|
||||||
|
|
||||||
total = init_player(0, "Total", 0);
|
local total = init_player(0, "Total", 0);
|
||||||
|
|
||||||
function get_player(player_id)
|
function get_player(player_id)
|
||||||
if players[player_id] == nil then
|
if players[player_id] == nil then
|
||||||
@@ -831,7 +832,6 @@ function damage_meter()
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- players in lobby
|
-- players in lobby
|
||||||
local lobby_manager = sdk.get_managed_singleton("snow.LobbyManager");
|
local lobby_manager = sdk.get_managed_singleton("snow.LobbyManager");
|
||||||
if lobby_manager == nil then
|
if lobby_manager == nil then
|
||||||
@@ -872,8 +872,20 @@ function damage_meter()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local progress_manager = sdk.get_managed_singleton("snow.progress.ProgressManager");
|
||||||
|
if progress_manager == nil then
|
||||||
|
status = "No progress manager";
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
local myself_hunter_rank = progress_manager:call("get_HunterRank");
|
||||||
|
if myself_hunter_rank == nil then
|
||||||
|
status = "No myself hunter rank";
|
||||||
|
myself_hunter_rank = 0;
|
||||||
|
end
|
||||||
|
|
||||||
if players[myself_player_id] == nil then
|
if players[myself_player_id] == nil then
|
||||||
players[myself_player_id] = init_player(myself_player_id, myself_player_name, 0);
|
players[myself_player_id] = init_player(myself_player_id, myself_player_name, myself_hunter_rank);
|
||||||
end
|
end
|
||||||
|
|
||||||
local quest_players = {};
|
local quest_players = {};
|
||||||
@@ -1033,7 +1045,7 @@ function damage_meter()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if damage_meter_UI.visibility.player_damage then
|
if damage_meter_UI.visibility.player_damage then
|
||||||
local player_damage = string.format("%d", player.display.total_damage);
|
local player_damage = string.format("%.0f", player.display.total_damage);
|
||||||
|
|
||||||
if damage_meter_UI.shadows.player_damage then
|
if damage_meter_UI.shadows.player_damage then
|
||||||
--player_damage shadow
|
--player_damage shadow
|
||||||
@@ -1062,7 +1074,7 @@ function damage_meter()
|
|||||||
|
|
||||||
--draw total damage
|
--draw total damage
|
||||||
if damage_meter_UI.visibility.total_damage then
|
if damage_meter_UI.visibility.total_damage then
|
||||||
local total_damage_text = string.format("%d", total.display.total_damage);
|
local total_damage_text = string.format("%.0f", total.display.total_damage);
|
||||||
|
|
||||||
local screen_position = calculate_screen_coordinates(damage_meter_UI.position);
|
local screen_position = calculate_screen_coordinates(damage_meter_UI.position);
|
||||||
if damage_meter_UI.total_damage_offset_is_relative then
|
if damage_meter_UI.total_damage_offset_is_relative then
|
||||||
|
|||||||
Reference in New Issue
Block a user