mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-30 07:18:03 -08:00
Compare commits
7 Commits
758a02bce8
...
1f0cd6e883
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f0cd6e883 | ||
|
|
2d669a6c4a | ||
|
|
2d77b78a1c | ||
|
|
aac30e7a08 | ||
|
|
f2675e6d23 | ||
|
|
5ff6af9108 | ||
|
|
728b7f990f |
@@ -279,6 +279,13 @@ local function update_modules(module_visibility_config, flow_state_name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if config.current_config.damage_meter_UI.enabled and module_visibility_config.damage_meter_UI then
|
||||||
|
local success = pcall(damage_meter_UI.update);
|
||||||
|
if not success then
|
||||||
|
error_handler.report("MHR_Overlay.update_modules", string.format("[%s] Damage Meter UI Update Function threw an Exception", flow_state_name));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if config.current_config.endemic_life_UI.enabled and module_visibility_config.endemic_life_UI then
|
if config.current_config.endemic_life_UI.enabled and module_visibility_config.endemic_life_UI then
|
||||||
local success = pcall(env_creature_UI.update);
|
local success = pcall(env_creature_UI.update);
|
||||||
if not success then
|
if not success then
|
||||||
@@ -368,6 +375,13 @@ local function update_UI()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if config.current_config.damage_meter_UI.enabled and module_visibility_config.damage_meter_UI then
|
||||||
|
local success = pcall(damage_meter_UI.update);
|
||||||
|
if not success then
|
||||||
|
error_handler.report("MHR_Overlay.update_modules", "[In Training Area] Damage Meter UI Update Function threw an Exception");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if config.current_config.endemic_life_UI.enabled and module_visibility_config.endemic_life_UI then
|
if config.current_config.endemic_life_UI.enabled and module_visibility_config.endemic_life_UI then
|
||||||
local success = pcall(env_creature_UI.update);
|
local success = pcall(env_creature_UI.update);
|
||||||
if not success then
|
if not success then
|
||||||
@@ -532,4 +546,5 @@ if imgui.begin_table == nil then
|
|||||||
re.msg(language.current_language.customization_menu.reframework_outdated);
|
re.msg(language.current_language.customization_menu.reframework_outdated);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
time.init_global_timers();
|
||||||
time.new_timer(update_UI, 0.5);
|
time.new_timer(update_UI, 0.5);
|
||||||
@@ -8,6 +8,7 @@ local players;
|
|||||||
local utils;
|
local utils;
|
||||||
local language;
|
local language;
|
||||||
local error_handler;
|
local error_handler;
|
||||||
|
local time;
|
||||||
|
|
||||||
local sdk = sdk;
|
local sdk = sdk;
|
||||||
local tostring = tostring;
|
local tostring = tostring;
|
||||||
@@ -42,19 +43,34 @@ local ValueType = ValueType;
|
|||||||
local package = package;
|
local package = package;
|
||||||
|
|
||||||
this.list = {
|
this.list = {
|
||||||
--poison = nil,
|
fireblight = nil,
|
||||||
--stun = nil,
|
waterblight = nil,
|
||||||
--sleep = nil,
|
iceblight = nil,
|
||||||
--paralyze = nil,
|
thunderblight = nil,
|
||||||
--quake = nil,
|
dragonblight = nil,
|
||||||
--ear = nil,
|
blastblight = nil,
|
||||||
--defense_down = nil,
|
bubbleblight = nil,
|
||||||
--resistance_down = nil,
|
hellfireblight = nil,
|
||||||
--stink = nil,
|
bloodblight = nil,
|
||||||
--onibomb = nil,
|
poison = nil,
|
||||||
--bomb = nil,
|
stun = nil,
|
||||||
--beto = nil,
|
paralysis = nil,
|
||||||
--fire = nil,
|
sleep = nil,
|
||||||
|
defense_down = nil,
|
||||||
|
resistance_down = nil,
|
||||||
|
tremor = nil,
|
||||||
|
roar = nil,
|
||||||
|
webbed = nil,
|
||||||
|
stench = nil,
|
||||||
|
leeched = nil,
|
||||||
|
whirlwind = nil,
|
||||||
|
bleeding = nil,
|
||||||
|
frenzy = nil,
|
||||||
|
frenzy_overcome = nil,
|
||||||
|
frenzy_infection = nil,
|
||||||
|
engulfed = nil,
|
||||||
|
frostblight = nil,
|
||||||
|
muck = nil
|
||||||
};
|
};
|
||||||
|
|
||||||
local frenzy_infected_duration = 121;
|
local frenzy_infected_duration = 121;
|
||||||
@@ -188,7 +204,7 @@ function this.update_generic_timer(debuff_key, timer_owner, timer_field, is_infi
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if timer == 0 then
|
if utils.number.is_equal(timer, 0) then
|
||||||
this.list[debuff_key] = nil;
|
this.list[debuff_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -251,7 +267,7 @@ function this.update_frenzy_infection(player)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if virus_accumulator_value == 0 and virus_timer == 0 then
|
if virus_accumulator_value == 0 and utils.number.is_equal(virus_timer, 0)then
|
||||||
this.list.frenzy_infection = nil;
|
this.list.frenzy_infection = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -300,6 +316,7 @@ function this.init_dependencies()
|
|||||||
players = require("MHR_Overlay.Damage_Meter.players");
|
players = require("MHR_Overlay.Damage_Meter.players");
|
||||||
language = require("MHR_Overlay.Misc.language");
|
language = require("MHR_Overlay.Misc.language");
|
||||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||||
|
time = require("MHR_Overlay.Game_Handler.time");
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
|
|||||||
@@ -62,11 +62,8 @@ local find_master_player_method = player_manager_type_def:get_method("findMaster
|
|||||||
|
|
||||||
local player_base_type_def = find_master_player_method:get_return_type();
|
local player_base_type_def = find_master_player_method:get_return_type();
|
||||||
local get_player_data_method = player_base_type_def:get_method("get_PlayerData");
|
local get_player_data_method = player_base_type_def:get_method("get_PlayerData");
|
||||||
local music_data_field = player_base_type_def:get_field("_MusicData");
|
|
||||||
|
|
||||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
local player_lobby_base_type_def = sdk.find_type_definition("snow.player.PlayerLobbyBase");
|
||||||
local length_method = system_array_type_def:get_method("get_Length");
|
|
||||||
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
|
|
||||||
|
|
||||||
function this.new(type, key, name, level, duration)
|
function this.new(type, key, name, level, duration)
|
||||||
local is_infinite = false;
|
local is_infinite = false;
|
||||||
@@ -79,7 +76,7 @@ function this.new(type, key, name, level, duration)
|
|||||||
duration = 0;
|
duration = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
if duration == 0 then
|
if utils.number.is_equal(duration, 0) then
|
||||||
is_infinite = true;
|
is_infinite = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -152,6 +149,7 @@ function this.update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local is_player_lobby_base = master_player:get_type_definition() == player_lobby_base_type_def;
|
||||||
|
|
||||||
local master_player_data = get_player_data_method:call(master_player);
|
local master_player_data = get_player_data_method:call(master_player);
|
||||||
if master_player_data ~= nil then
|
if master_player_data ~= nil then
|
||||||
@@ -159,32 +157,15 @@ function this.update()
|
|||||||
endemic_life_buffs.update(master_player_data);
|
endemic_life_buffs.update(master_player_data);
|
||||||
skills.update(master_player, master_player_data);
|
skills.update(master_player, master_player_data);
|
||||||
dangos.update(master_player_data);
|
dangos.update(master_player_data);
|
||||||
|
|
||||||
|
if not is_player_lobby_base then
|
||||||
abnormal_statuses.update(master_player, master_player_data);
|
abnormal_statuses.update(master_player, master_player_data);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error_handler.report("buffs.update", "Failed to access Data: master_player_data");
|
error_handler.report("buffs.update", "Failed to access Data: master_player_data");
|
||||||
end
|
end
|
||||||
|
|
||||||
--xy = master_player_data._Attack;
|
melody_effects.update(master_player);
|
||||||
|
|
||||||
local music_data_array = music_data_field:get_data(master_player);
|
|
||||||
if music_data_array ~= nil then
|
|
||||||
local music_data_table = {};
|
|
||||||
|
|
||||||
local length = length_method:call(music_data_array) - 1;
|
|
||||||
for i = 0, length do
|
|
||||||
local music_data = get_value_method:call(music_data_array, i);
|
|
||||||
if music_data == nil then
|
|
||||||
error_handler.report("buffs.update", "Failed to access Data: music_data No." .. tostring(i));
|
|
||||||
music_data = "";
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(music_data_table, music_data);
|
|
||||||
end
|
|
||||||
|
|
||||||
melody_effects.update(music_data_table);
|
|
||||||
else
|
|
||||||
error_handler.report("buffs.update", "Failed to access Data: music_data_array");
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.update_timer(buff, timer)
|
function this.update_timer(buff, timer)
|
||||||
@@ -231,7 +212,7 @@ function this.init_dependencies()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
time.new_timer(this.update, 1/60);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -153,7 +153,7 @@ function this.update_generic(consumable_key, player_data, item_parameter, value_
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if value_field == nil and timer == 0 then
|
if value_field == nil and utils.number.is_equal(timer, 0)then
|
||||||
this.list[consumable_key] = nil;
|
this.list[consumable_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -279,7 +279,7 @@ function this.update_gourmet_fish(player_data, item_parameter)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if gourmet_fish_timer == 0 then
|
if utils.number.is_equal(gourmet_fish_timer, 0) then
|
||||||
this.list.gourmet_fish = nil;
|
this.list.gourmet_fish = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ function this.update_cutterfly(player_data, item_parameter)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if cutterfly_timer == 0 then
|
if utils.number.is_equal(cutterfly_timer, 0) then
|
||||||
this.list.cutterfly = nil;
|
this.list.cutterfly = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -113,7 +113,7 @@ function this.update_clothfly(player_data, item_parameter)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if clothfly_timer == 0 then
|
if utils.number.is_equal(clothfly_timer, 0) then
|
||||||
this.list.clothfly = nil;
|
this.list.clothfly = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -105,15 +105,41 @@ local melody_effect_keys = {
|
|||||||
|
|
||||||
this.list = {};
|
this.list = {};
|
||||||
|
|
||||||
|
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
|
||||||
|
local find_master_player_method = player_manager_type_def:get_method("findMasterPlayer");
|
||||||
|
|
||||||
|
local player_base_type_def = find_master_player_method:get_return_type();
|
||||||
|
local music_data_field = player_base_type_def:get_field("_MusicData");
|
||||||
|
|
||||||
local music_data_type_def = sdk.find_type_definition("snow.player.Horn.MusicData");
|
local music_data_type_def = sdk.find_type_definition("snow.player.Horn.MusicData");
|
||||||
local time_field = music_data_type_def:get_field("_Time");
|
local time_field = music_data_type_def:get_field("_Time");
|
||||||
|
|
||||||
function this.update(melody_data_table)
|
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||||
for lua_index, melody_data in ipairs(melody_data_table) do
|
local length_method = system_array_type_def:get_method("get_Length");
|
||||||
if melody_data ~= "" then
|
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
|
||||||
this.update_melody_effect(lua_index, melody_data);
|
|
||||||
|
|
||||||
|
function this.update(master_player)
|
||||||
|
local music_data_array = music_data_field:get_data(master_player);
|
||||||
|
if music_data_array == nil then
|
||||||
|
error_handler.report("melody_effects.update", "Failed to access Data: music_data_array");
|
||||||
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local length = length_method:call(music_data_array) - 1;
|
||||||
|
if length == nil then
|
||||||
|
error_handler.report("melody_effects.update", "Failed to access Data: music_data_array -> length");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 0, length do
|
||||||
|
local music_data = get_value_method:call(music_data_array, i);
|
||||||
|
if music_data == nil then
|
||||||
|
error_handler.report("melody_effects.update", "Failed to access Data: music_data No." .. tostring(i));
|
||||||
|
goto continue;
|
||||||
|
end
|
||||||
|
|
||||||
|
this.update_melody_effect(i+1, music_data);
|
||||||
|
::continue::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -124,7 +150,7 @@ function this.update_melody_effect(lua_index, melody_data)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if melody_timer == 0 then
|
if utils.number.is_equal(melody_timer, 0) then
|
||||||
this.list[lua_index] = nil;
|
this.list[lua_index] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ function this.update_generic_timer(skill_key, timer_owner, timer_field, is_infin
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if timer == 0 then
|
if utils.number.is_equal(timer, 0) then
|
||||||
this.list[skill_key] = nil;
|
this.list[skill_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -286,7 +286,7 @@ function this.update_generic_number_value_field(skill_key, timer_owner, value_fi
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if value_field == nil and timer == 0 then
|
if value_field == nil and utils.number.is_equal(timer, 0) then
|
||||||
this.list[skill_key] = nil;
|
this.list[skill_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -332,7 +332,7 @@ function this.update_generic_boolean_value_field(skill_key, timer_owner, value_f
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if value_field == nil and timer == 0 then
|
if value_field == nil and utils.number.is_equal(timer, 0) then
|
||||||
this.list[skill_key] = nil;
|
this.list[skill_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -385,7 +385,7 @@ function this.update_generic_number_value_method(skill_key, timer_owner, value_m
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if value_method == nil and timer == 0 then
|
if value_method == nil and utils.number.is_equal(timer, 0) then
|
||||||
this.list[skill_key] = nil;
|
this.list[skill_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -431,7 +431,7 @@ function this.update_generic_boolean_value_method(skill_key, timer_owner, value_
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if value_method == nil and timer == 0 then
|
if value_method == nil and utils.number.is_equal(timer, 0) then
|
||||||
this.list[skill_key] = nil;
|
this.list[skill_key] = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -500,7 +500,7 @@ function this.update_wind_mantle(player)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if wind_mantle_timer == 0 then
|
if utils.number.is_equal(wind_mantle_timer, 0) then
|
||||||
this.list.wind_mantle = nil;
|
this.list.wind_mantle = nil;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -185,15 +185,16 @@ function this.update_servant_list()
|
|||||||
this.servant_list[id] = this.new(id, name, 0, players.types.servant);
|
this.servant_list[id] = this.new(id, name, 0, players.types.servant);
|
||||||
end
|
end
|
||||||
|
|
||||||
if not cached_config.settings.hide_servants then
|
|
||||||
table.insert(players.display_list, this.servant_list[id]);
|
|
||||||
end
|
|
||||||
|
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.update_otomo_list(is_on_quest, is_online)
|
function this.update_otomo_list(is_on_quest, is_online)
|
||||||
|
if singletons.otomo_manager == nil then
|
||||||
|
error_handler.report("non_players.update_otomo_list", "Failed to access Data: otomo_manager");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
if is_online then
|
if is_online then
|
||||||
if is_on_quest then
|
if is_on_quest then
|
||||||
--non_players.update_my_otomos();
|
--non_players.update_my_otomos();
|
||||||
@@ -230,12 +231,10 @@ function this.update_my_otomos()
|
|||||||
local level = otomo_create_data_level_field:get_data(first_otomo) or 0;
|
local level = otomo_create_data_level_field:get_data(first_otomo) or 0;
|
||||||
|
|
||||||
local myself_id = players.myself.id;
|
local myself_id = players.myself.id;
|
||||||
if this.otomo_list[myself_id] == nil then
|
local otomo = this.otomo_list[myself_id]
|
||||||
this.otomo_list[myself_id] = this.new(0, name, level, players.types.my_otomo);
|
if otomo == nil then
|
||||||
end
|
otomo = this.new(0, name, level, players.types.my_otomo);
|
||||||
|
this.otomo_list[myself_id] = otomo;
|
||||||
if cached_config.settings.show_my_otomos_separately then
|
|
||||||
table.insert(players.display_list, this.otomo_list[myself_id]);
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -247,18 +246,18 @@ function this.update_my_otomos()
|
|||||||
local name = otomo_create_data_name_field:get_data(second_otomo);
|
local name = otomo_create_data_name_field:get_data(second_otomo);
|
||||||
if name == nil then
|
if name == nil then
|
||||||
error_handler.report("non_players.update_my_otomos", "Failed to access Data: second_otomo -> name");
|
error_handler.report("non_players.update_my_otomos", "Failed to access Data: second_otomo -> name");
|
||||||
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if name ~= nil and name ~= "" then
|
if name ~= "" then
|
||||||
local level = otomo_create_data_level_field:get_data(second_otomo) or 0;
|
local level = otomo_create_data_level_field:get_data(second_otomo) or 0;
|
||||||
|
|
||||||
-- the secondary otomo is actually the 4th one!
|
-- the secondary otomo is actually the 4th one!
|
||||||
if this.otomo_list[this.my_second_otomo_id] == nil then
|
local otomo = this.otomo_list[this.my_second_otomo_id];
|
||||||
this.otomo_list[this.my_second_otomo_id] = this.new(this.my_second_otomo_id, name, level, players.types.my_otomo);
|
|
||||||
end
|
|
||||||
|
|
||||||
if cached_config.settings.show_my_otomos_separately then
|
if otomo == nil then
|
||||||
table.insert(players.display_list, this.otomo_list[this.my_second_otomo_id]);
|
otomo = this.new(this.my_second_otomo_id, name, level, players.types.my_otomo);
|
||||||
|
this.otomo_list[this.my_second_otomo_id] = otomo;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -297,12 +296,11 @@ function this.update_servant_otomos()
|
|||||||
goto continue;
|
goto continue;
|
||||||
end
|
end
|
||||||
|
|
||||||
if this.otomo_list[member_id] == nil then
|
local otomo = this.otomo_list[member_id];
|
||||||
this.otomo_list[member_id] = this.new(member_id, name, level, players.types.servant_otomo);
|
|
||||||
end
|
|
||||||
|
|
||||||
if cached_config.settings.show_servant_otomos_separately then
|
if otomo == nil then
|
||||||
table.insert(players.display_list, this.otomo_list[member_id]);
|
otomo = this.new(member_id, name, level, players.types.servant_otomo);
|
||||||
|
this.otomo_list[member_id] = otomo;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -367,20 +365,6 @@ function this.update_otomos(otomo_info_field_)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if id == players.myself.id then
|
|
||||||
if cached_config.settings.show_my_otomos_separately then
|
|
||||||
table.insert(players.display_list, otomo);
|
|
||||||
end
|
|
||||||
elseif id >= 4 then
|
|
||||||
if cached_config.settings.show_servant_otomos_separately then
|
|
||||||
table.insert(players.display_list, otomo);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if cached_config.settings.show_other_player_otomos_separately then
|
|
||||||
table.insert(players.display_list, otomo);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ this.myself = nil;
|
|||||||
this.myself_position = Vector3f.new(0, 0, 0);
|
this.myself_position = Vector3f.new(0, 0, 0);
|
||||||
this.total = nil;
|
this.total = nil;
|
||||||
|
|
||||||
this.display_list = {};
|
|
||||||
|
|
||||||
this.highlighted_damage_UI = nil;
|
this.highlighted_damage_UI = nil;
|
||||||
|
|
||||||
this.damage_types = {
|
this.damage_types = {
|
||||||
@@ -137,6 +135,7 @@ function this.get_player(player_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function this.update_damage(player, damage_source_type, is_large_monster, damage_object)
|
function this.update_damage(player, damage_source_type, is_large_monster, damage_object)
|
||||||
|
|
||||||
if player == nil then
|
if player == nil then
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -337,20 +336,6 @@ function this.merge_damage(first, second)
|
|||||||
return first;
|
return first;
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.update_display_list()
|
|
||||||
local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA;
|
|
||||||
|
|
||||||
this.display_list = {};
|
|
||||||
this.update_player_list(is_on_quest);
|
|
||||||
non_players.update_servant_list();
|
|
||||||
non_players.update_otomo_list(is_on_quest, quest_status.is_online);
|
|
||||||
|
|
||||||
this.update_dps(false);
|
|
||||||
this.sort_players();
|
|
||||||
|
|
||||||
quest_status.get_cart_count();
|
|
||||||
end
|
|
||||||
|
|
||||||
function this.update_dps(bypass_freeze)
|
function this.update_dps(bypass_freeze)
|
||||||
local cached_config = config.current_config.damage_meter_UI.settings;
|
local cached_config = config.current_config.damage_meter_UI.settings;
|
||||||
|
|
||||||
@@ -396,54 +381,6 @@ function this.update_player_dps(player)
|
|||||||
this.total.dps = this.total.dps + player.dps;
|
this.total.dps = this.total.dps + player.dps;
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.sort_players()
|
|
||||||
local cached_config = config.current_config.damage_meter_UI;
|
|
||||||
|
|
||||||
if cached_config.settings.my_damage_bar_location == "Normal" then
|
|
||||||
table.insert(this.display_list, this.myself);
|
|
||||||
end
|
|
||||||
|
|
||||||
-- sort here
|
|
||||||
if cached_config.sorting.type == "Normal" then
|
|
||||||
if cached_config.sorting.reversed_order then
|
|
||||||
table.sort(this.display_list, function(left, right)
|
|
||||||
return left.id > right.id;
|
|
||||||
end);
|
|
||||||
else
|
|
||||||
table.sort(this.display_list, function(left, right)
|
|
||||||
return left.id < right.id;
|
|
||||||
end);
|
|
||||||
end
|
|
||||||
elseif cached_config.sorting.type == "DPS" then
|
|
||||||
if cached_config.sorting.reversed_order then
|
|
||||||
table.sort(this.display_list, function(left, right)
|
|
||||||
return left.dps < right.dps;
|
|
||||||
end);
|
|
||||||
else
|
|
||||||
table.sort(this.display_list, function(left, right)
|
|
||||||
return left.dps > right.dps;
|
|
||||||
end);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if cached_config.sorting.reversed_order then
|
|
||||||
table.sort(this.display_list, function(left, right)
|
|
||||||
return left.display.total_damage < right.display.total_damage;
|
|
||||||
end);
|
|
||||||
else
|
|
||||||
table.sort(this.display_list, function(left, right)
|
|
||||||
return left.display.total_damage > right.display.total_damage;
|
|
||||||
end);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if cached_config.settings.my_damage_bar_location == "First" then
|
|
||||||
table.insert(this.display_list, 1, this.myself);
|
|
||||||
|
|
||||||
elseif cached_config.settings.my_damage_bar_location == "Last" then
|
|
||||||
table.insert(this.display_list, this.myself);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
|
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
|
||||||
local find_master_player_method = player_manager_type_def:get_method("findMasterPlayer");
|
local find_master_player_method = player_manager_type_def:get_method("findMasterPlayer");
|
||||||
|
|
||||||
@@ -477,9 +414,8 @@ end
|
|||||||
|
|
||||||
function this.init()
|
function this.init()
|
||||||
this.list = {};
|
this.list = {};
|
||||||
this.display_list = {};
|
|
||||||
this.total = this.new(0, "Total", 0, 0, this.types.total);
|
this.total = this.new(0, "Total", 0, 0, this.types.total);
|
||||||
this.myself = this.new(-1, "DummyMHROverlay", -1, -1, this.types.myself);
|
this.myself = nil;
|
||||||
end
|
end
|
||||||
|
|
||||||
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
|
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
|
||||||
@@ -509,6 +445,18 @@ local get_master_rank_method = progress_manager_type_def:get_method("get_MasterR
|
|||||||
|
|
||||||
local get_master_player_id_method = player_manager_type_def:get_method("getMasterPlayerID");
|
local get_master_player_id_method = player_manager_type_def:get_method("getMasterPlayerID");
|
||||||
|
|
||||||
|
function this.update_players()
|
||||||
|
local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA;
|
||||||
|
|
||||||
|
this.update_player_list(is_on_quest);
|
||||||
|
non_players.update_servant_list();
|
||||||
|
non_players.update_otomo_list(is_on_quest, quest_status.is_online);
|
||||||
|
|
||||||
|
this.update_dps(false);
|
||||||
|
|
||||||
|
quest_status.get_cart_count();
|
||||||
|
end
|
||||||
|
|
||||||
function this.update_player_list(is_on_quest)
|
function this.update_player_list(is_on_quest)
|
||||||
if is_on_quest then
|
if is_on_quest then
|
||||||
this.update_player_list_(quest_hunter_info_field);
|
this.update_player_list_(quest_hunter_info_field);
|
||||||
@@ -554,7 +502,10 @@ function this.update_player_list_(hunter_info_field_)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if this.myself == nil or myself_id ~= this.myself.id then
|
if this.myself == nil or myself_id ~= this.myself.id then
|
||||||
|
if this.myself ~= nil then
|
||||||
this.list[this.myself.id] = nil;
|
this.list[this.myself.id] = nil;
|
||||||
|
end
|
||||||
|
|
||||||
this.myself = this.new(myself_id, myself_player_name, myself_master_rank, myself_hunter_rank, this.types.myself);
|
this.myself = this.new(myself_id, myself_player_name, myself_master_rank, myself_hunter_rank, this.types.myself);
|
||||||
this.list[myself_id] = this.myself;
|
this.list[myself_id] = this.myself;
|
||||||
end
|
end
|
||||||
@@ -618,10 +569,6 @@ function this.update_player_list_(hunter_info_field_)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if player ~= this.myself then
|
|
||||||
table.insert(this.display_list, player);
|
|
||||||
end
|
|
||||||
|
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -664,8 +611,6 @@ end
|
|||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
this.init();
|
this.init();
|
||||||
time.new_timer(this.update_display_list, 0.5);
|
|
||||||
time.new_timer(this.update_myself_position, 1);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -153,6 +153,11 @@ function this.set_flow_state(new_flow_state)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function this.get_cart_count()
|
function this.get_cart_count()
|
||||||
|
if singletons.quest_manager == nil then
|
||||||
|
error_handler.report("quest_status.get_cart_count", "Failed to access Data: quest_manager");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
local death_num = get_death_num_method:call(singletons.quest_manager);
|
local death_num = get_death_num_method:call(singletons.quest_manager);
|
||||||
if death_num == nil then
|
if death_num == nil then
|
||||||
error_handler.report("quest_status.get_cart_count", "Failed to access Data: death_num");
|
error_handler.report("quest_status.get_cart_count", "Failed to access Data: death_num");
|
||||||
@@ -162,6 +167,11 @@ function this.get_cart_count()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function this.get_max_cart_count()
|
function this.get_max_cart_count()
|
||||||
|
if singletons.quest_manager == nil then
|
||||||
|
error_handler.report("quest_status.get_max_cart_count", "Failed to access Data: quest_manager");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
local quest_life = get_quest_life_method:call(singletons.quest_manager);
|
local quest_life = get_quest_life_method:call(singletons.quest_manager);
|
||||||
if quest_life == nil then
|
if quest_life == nil then
|
||||||
error_handler.report("quest_status.get_max_cart_count", "Failed to access Data: quest_life");
|
error_handler.report("quest_status.get_max_cart_count", "Failed to access Data: quest_life");
|
||||||
@@ -405,8 +415,6 @@ end
|
|||||||
function this.init_module()
|
function this.init_module()
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
time.new_timer(this.update_is_online, 1);
|
|
||||||
|
|
||||||
sdk.hook(on_changed_game_status_method, function(args)
|
sdk.hook(on_changed_game_status_method, function(args)
|
||||||
this.on_changed_game_status(sdk.to_int64(args[3]));
|
this.on_changed_game_status(sdk.to_int64(args[3]));
|
||||||
end, function(retval) return retval; end);
|
end, function(retval) return retval; end);
|
||||||
|
|||||||
@@ -45,11 +45,13 @@ function this.update_window_size()
|
|||||||
local width;
|
local width;
|
||||||
local height;
|
local height;
|
||||||
|
|
||||||
if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
-- if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||||
width, height = d2d.surface_size();
|
-- width, height = d2d.surface_size();
|
||||||
else
|
-- else
|
||||||
|
-- width, height = this.get_game_window_size();
|
||||||
|
-- end
|
||||||
|
|
||||||
width, height = this.get_game_window_size();
|
width, height = this.get_game_window_size();
|
||||||
end
|
|
||||||
|
|
||||||
if width ~= nil then
|
if width ~= nil then
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@@ -143,7 +145,6 @@ function this.init_dependencies()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
time.new_timer(this.update_window_size, 1);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -191,7 +191,6 @@ end
|
|||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
this.init();
|
this.init();
|
||||||
time.new_timer(this.init, 1);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ local config;
|
|||||||
local small_monster;
|
local small_monster;
|
||||||
local utils;
|
local utils;
|
||||||
local error_handler;
|
local error_handler;
|
||||||
|
local screen;
|
||||||
|
local buffs;
|
||||||
|
local player_info;
|
||||||
|
|
||||||
local sdk = sdk;
|
local sdk = sdk;
|
||||||
local tostring = tostring;
|
local tostring = tostring;
|
||||||
@@ -60,23 +63,36 @@ function this.new_timer(callback, cooldown_seconds, start_offset_seconds)
|
|||||||
if callback == nil or cooldown_seconds == nil then
|
if callback == nil or cooldown_seconds == nil then
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = {};
|
local timer = {};
|
||||||
timer.callback = callback;
|
timer.callback = callback;
|
||||||
timer.cooldown = cooldown_seconds;
|
timer.cooldown = cooldown_seconds;
|
||||||
|
|
||||||
timer.last_trigger_time = os.clock() + start_offset_seconds;
|
timer.last_trigger_time = os.clock() + start_offset_seconds;
|
||||||
|
|
||||||
table.insert(this.list, timer);
|
this.list[callback] = timer;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.init_global_timers()
|
||||||
|
this.new_timer(singletons.init, 1);
|
||||||
|
this.new_timer(screen.update_window_size, 1);
|
||||||
|
this.new_timer(quest_status.update_is_online, 1);
|
||||||
|
this.new_timer(this.update_quest_time, 1 / 60);
|
||||||
|
this.new_timer(players.update_players, 0.5);
|
||||||
|
this.new_timer(players.update_myself_position, 1);
|
||||||
|
this.new_timer(buffs.update, 1/60);
|
||||||
|
this.new_timer(player_info.update, 0.5);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.update_timers()
|
function this.update_timers()
|
||||||
this.update_script_time();
|
this.update_script_time();
|
||||||
|
|
||||||
for _, timer in ipairs(this.list) do
|
for callback, timer in pairs(this.list) do
|
||||||
if this.total_elapsed_script_seconds - timer.last_trigger_time > timer.cooldown then
|
if this.total_elapsed_script_seconds - timer.last_trigger_time > timer.cooldown then
|
||||||
timer.last_trigger_time = this.total_elapsed_script_seconds;
|
timer.last_trigger_time = this.total_elapsed_script_seconds;
|
||||||
timer.callback();
|
callback();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -122,10 +138,12 @@ function this.init_dependencies()
|
|||||||
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
||||||
utils = require("MHR_Overlay.Misc.utils");
|
utils = require("MHR_Overlay.Misc.utils");
|
||||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||||
|
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||||
|
buffs = require("MHR_Overlay.Buffs.buffs");
|
||||||
|
player_info = require("MHR_Overlay.Misc.player_info");
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
this.new_timer(this.update_quest_time, 1 / 60);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function this.report(error_key, error_message)
|
|||||||
|
|
||||||
local error_time = time.total_elapsed_script_seconds;
|
local error_time = time.total_elapsed_script_seconds;
|
||||||
|
|
||||||
if error_time == 0 then
|
if utils.number.is_equal(error_time, 0) then
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ function this.init_dependencies()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
time.new_timer(this.update, 0.5);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -44,9 +44,164 @@ local os = os;
|
|||||||
local ValueType = ValueType;
|
local ValueType = ValueType;
|
||||||
local package = package;
|
local package = package;
|
||||||
|
|
||||||
|
local top_damage = 0;
|
||||||
|
local top_dps = 0;
|
||||||
|
|
||||||
|
this.displayed_players = {};
|
||||||
this.last_displayed_players = {};
|
this.last_displayed_players = {};
|
||||||
this.freeze_displayed_players = false;
|
this.freeze_displayed_players = false;
|
||||||
|
|
||||||
|
function this.update()
|
||||||
|
local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA;
|
||||||
|
local cached_config = config.current_config.damage_meter_UI;
|
||||||
|
|
||||||
|
if this.freeze_displayed_players and not utils.table.is_empty(this.last_displayed_players) then
|
||||||
|
this.displayed_players = this.last_displayed_players;
|
||||||
|
return;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if players.total.display.total_damage == 0 and cached_config.settings.hide_module_if_total_damage_is_zero then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
this.displayed_players = {};
|
||||||
|
|
||||||
|
for id, player in pairs(players.list) do
|
||||||
|
if player ~= players.myself or cached_config.settings.my_damage_bar_location == "Normal" then
|
||||||
|
this.add_to_displayed_players_list(player, cached_config);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not cached_config.settings.hide_servants then
|
||||||
|
for id, servant in pairs(non_players.servant_list) do
|
||||||
|
this.add_to_displayed_players_list(servant, cached_config);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for id, otomo in pairs(non_players.otomo_list) do
|
||||||
|
if id == players.myself.id or id == non_players.my_second_otomo_id then
|
||||||
|
if cached_config.settings.show_my_otomos_separately then
|
||||||
|
this.add_to_displayed_players_list(otomo, cached_config);
|
||||||
|
end
|
||||||
|
elseif id >= 4 then
|
||||||
|
if cached_config.settings.show_servant_otomos_separately then
|
||||||
|
this.add_to_displayed_players_list(otomo, cached_config);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if cached_config.settings.show_other_player_otomos_separately then
|
||||||
|
this.add_to_displayed_players_list(otomo, cached_config);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
this.sort();
|
||||||
|
|
||||||
|
this.last_displayed_players = this.displayed_players;
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.calculate_top_damage_and_dps()
|
||||||
|
top_damage = 0;
|
||||||
|
top_dps = 0;
|
||||||
|
for _, player in ipairs(this.displayed_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
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.add_to_displayed_players_list(player, cached_config, position)
|
||||||
|
cached_config = cached_config.settings;
|
||||||
|
position = position or #(this.displayed_players) + 1;
|
||||||
|
|
||||||
|
if player.display.total_damage == 0 and cached_config.hide_player_if_player_damage_is_zero then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
if player.type == players.types.myself then
|
||||||
|
if cached_config.hide_myself then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
elseif player.type == players.types.servant then
|
||||||
|
if cached_config.hide_servants then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
elseif player.type == players.types.other_player then
|
||||||
|
if cached_config.hide_other_players then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
elseif player.type == players.types.my_otomo then
|
||||||
|
if not cached_config.show_my_otomos_separately then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
elseif player.type == players.types.other_player_otomo then
|
||||||
|
if not cached_config.show_other_player_otomos_separately then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
elseif player.type == players.types.servant_otomo then
|
||||||
|
if not cached_config.show_servant_otomos_separately then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--if position == nil then
|
||||||
|
-- table.insert(this.displayed_players, player);
|
||||||
|
--else
|
||||||
|
table.insert(this.displayed_players, position, player);
|
||||||
|
--end
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.sort()
|
||||||
|
local cached_config = config.current_config.damage_meter_UI;
|
||||||
|
|
||||||
|
if cached_config.settings.my_damage_bar_location == "Normal" then
|
||||||
|
table.insert(this.displayed_players, this.myself);
|
||||||
|
end
|
||||||
|
|
||||||
|
-- sort here
|
||||||
|
if cached_config.sorting.type == "Normal" then
|
||||||
|
if cached_config.sorting.reversed_order then
|
||||||
|
table.sort(this.displayed_players, function(left, right)
|
||||||
|
return left.id > right.id;
|
||||||
|
end);
|
||||||
|
else
|
||||||
|
table.sort(this.displayed_players, function(left, right)
|
||||||
|
return left.id < right.id;
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
elseif cached_config.sorting.type == "DPS" then
|
||||||
|
if cached_config.sorting.reversed_order then
|
||||||
|
table.sort(this.displayed_players, function(left, right)
|
||||||
|
return left.dps < right.dps;
|
||||||
|
end);
|
||||||
|
else
|
||||||
|
table.sort(this.displayed_players, function(left, right)
|
||||||
|
return left.dps > right.dps;
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if cached_config.sorting.reversed_order then
|
||||||
|
table.sort(this.displayed_players, function(left, right)
|
||||||
|
return left.display.total_damage < right.display.total_damage;
|
||||||
|
end);
|
||||||
|
else
|
||||||
|
table.sort(this.displayed_players, function(left, right)
|
||||||
|
return left.display.total_damage > right.display.total_damage;
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if cached_config.settings.my_damage_bar_location == "First" then
|
||||||
|
this.add_to_displayed_players_list(players.myself, cached_config, 1);
|
||||||
|
|
||||||
|
elseif cached_config.settings.my_damage_bar_location == "Last" then
|
||||||
|
this.add_to_displayed_players_list(players.myself, cached_config);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function this.draw()
|
function this.draw()
|
||||||
local cached_config = config.current_config.damage_meter_UI;
|
local cached_config = config.current_config.damage_meter_UI;
|
||||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||||
@@ -55,41 +210,15 @@ function this.draw()
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
local quest_players = {};
|
this.calculate_top_damage_and_dps();
|
||||||
|
|
||||||
if this.freeze_displayed_players and not utils.table.is_empty(this.last_displayed_players) then
|
|
||||||
quest_players = this.last_displayed_players;
|
|
||||||
else
|
|
||||||
quest_players = players.display_list;
|
|
||||||
end
|
|
||||||
|
|
||||||
this.last_displayed_players = quest_players;
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||||
|
|
||||||
-- draw total damage
|
-- draw total damage
|
||||||
if cached_config.settings.total_damage_location == "First" then
|
if cached_config.settings.total_damage_location == "First"
|
||||||
if cached_config.settings.hide_total_damage then
|
and not cached_config.settings.hide_total_damage then
|
||||||
return;
|
if not (cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0) then
|
||||||
end
|
players.draw(players.total, position_on_screen, 1);
|
||||||
|
|
||||||
if cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0 then
|
|
||||||
return;
|
|
||||||
end
|
|
||||||
|
|
||||||
players.draw(players.total, position_on_screen, 1, top_damage, top_dps);
|
|
||||||
|
|
||||||
if cached_config.settings.orientation == "Horizontal" then
|
if cached_config.settings.orientation == "Horizontal" then
|
||||||
position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
|
position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
|
||||||
@@ -97,43 +226,14 @@ function this.draw()
|
|||||||
position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier;
|
position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- draw
|
-- draw
|
||||||
if not cached_config.settings.total_damage_offset_is_relative then
|
if not cached_config.settings.total_damage_offset_is_relative then
|
||||||
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(quest_players) do
|
for _, player in ipairs(this.displayed_players) do
|
||||||
|
|
||||||
if player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
|
|
||||||
if player.type == players.types.myself then
|
|
||||||
if cached_config.settings.hide_myself then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
elseif player.type == players.types.servant then
|
|
||||||
if cached_config.settings.hide_servants then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
elseif player.type == players.types.other_player then
|
|
||||||
if cached_config.settings.hide_other_players then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
elseif player.type == players.types.my_otomo then
|
|
||||||
if not cached_config.settings.show_my_otomos_separately then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
elseif player.type == players.types.other_player_otomo then
|
|
||||||
if not cached_config.settings.show_other_player_otomos_separately then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
elseif player.type == players.types.servant_otomo then
|
|
||||||
if not cached_config.settings.show_servant_otomos_separately then
|
|
||||||
goto continue;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
players.draw(player, position_on_screen, 1, top_damage, top_dps);
|
players.draw(player, position_on_screen, 1, top_damage, top_dps);
|
||||||
|
|
||||||
@@ -147,14 +247,10 @@ function this.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- draw total damage
|
-- draw total damage
|
||||||
if cached_config.settings.total_damage_location == "Last" then
|
if cached_config.settings.total_damage_location == "Last"
|
||||||
if cached_config.settings.hide_total_damage then
|
and not cached_config.settings.hide_total_damage then
|
||||||
return;
|
|
||||||
end
|
|
||||||
|
|
||||||
if cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0 then
|
if not (cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0) then
|
||||||
return;
|
|
||||||
end
|
|
||||||
|
|
||||||
if not cached_config.settings.total_damage_offset_is_relative then
|
if not cached_config.settings.total_damage_offset_is_relative then
|
||||||
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||||
@@ -162,6 +258,7 @@ function this.draw()
|
|||||||
|
|
||||||
players.draw(players.total, position_on_screen, 1);
|
players.draw(players.total, position_on_screen, 1);
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_dependencies()
|
function this.init_dependencies()
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ local stamina_UI_entity;
|
|||||||
local rage_UI_entity;
|
local rage_UI_entity;
|
||||||
local env_creature;
|
local env_creature;
|
||||||
local error_handler;
|
local error_handler;
|
||||||
|
local utils;
|
||||||
|
|
||||||
local sdk = sdk;
|
local sdk = sdk;
|
||||||
local tostring = tostring;
|
local tostring = tostring;
|
||||||
@@ -52,7 +53,7 @@ function this.update()
|
|||||||
|
|
||||||
local _displayed_creatures = {};
|
local _displayed_creatures = {};
|
||||||
|
|
||||||
if cached_config.settings.max_distance == 0 then
|
if utils.number.is_equal(cached_config.settings.max_distance, 0) then
|
||||||
displayed_creatures = {};
|
displayed_creatures = {};
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -116,6 +117,7 @@ function this.init_dependencies()
|
|||||||
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
||||||
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
|
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
|
||||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||||
|
utils = require("MHR_Overlay.Misc.utils");
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ local health_UI_entity;
|
|||||||
local stamina_UI_entity;
|
local stamina_UI_entity;
|
||||||
local rage_UI_entity;
|
local rage_UI_entity;
|
||||||
local error_handler;
|
local error_handler;
|
||||||
|
local utils;
|
||||||
|
|
||||||
local sdk = sdk;
|
local sdk = sdk;
|
||||||
local tostring = tostring;
|
local tostring = tostring;
|
||||||
@@ -116,7 +117,7 @@ function this.update_dynamic_monsters(large_monster_list, cached_config)
|
|||||||
|
|
||||||
local _displayed_dynamic_monsters = {};
|
local _displayed_dynamic_monsters = {};
|
||||||
|
|
||||||
if dynamic_cached_config.max_distance == 0 then
|
if utils.number.is_equal(dynamic_cached_config.max_distance, 0) then
|
||||||
displayed_dynamic_monsters = {};
|
displayed_dynamic_monsters = {};
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -407,6 +408,7 @@ function this.init_dependencies()
|
|||||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||||
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
||||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||||
|
utils = require("MHR_Overlay.Misc.utils");
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ local drawing;
|
|||||||
local health_UI_entity;
|
local health_UI_entity;
|
||||||
local stamina_UI_entity;
|
local stamina_UI_entity;
|
||||||
local error_handler;
|
local error_handler;
|
||||||
|
local utils;
|
||||||
|
|
||||||
local sdk = sdk;
|
local sdk = sdk;
|
||||||
local tostring = tostring;
|
local tostring = tostring;
|
||||||
@@ -52,7 +53,7 @@ local displayed_monsters = {};
|
|||||||
function this.update()
|
function this.update()
|
||||||
local cached_config = config.current_config.small_monster_UI;
|
local cached_config = config.current_config.small_monster_UI;
|
||||||
|
|
||||||
if cached_config.dynamic_positioning.enabled and cached_config.dynamic_positioning.max_distance == 0 then
|
if cached_config.dynamic_positioning.enabled and utils.number.is_equal(cached_config.dynamic_positioning.max_distance, 0) then
|
||||||
displayed_monsters = {};
|
displayed_monsters = {};
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
@@ -179,6 +180,7 @@ function this.init_dependencies()
|
|||||||
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
|
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
|
||||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||||
|
utils = require("MHR_Overlay.Misc.utils");
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ end
|
|||||||
function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
|
function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
|
||||||
local cached_config = config.current_config.damage_meter_UI;
|
local cached_config = config.current_config.damage_meter_UI;
|
||||||
|
|
||||||
|
top_damage = top_damage or 0;
|
||||||
|
top_dps = top_dps or 0;
|
||||||
|
|
||||||
local name_include = nil;
|
local name_include = nil;
|
||||||
if player.damage_UI.name_label ~= nil then
|
if player.damage_UI.name_label ~= nil then
|
||||||
name_include = player.damage_UI.name_label.include;
|
name_include = player.damage_UI.name_label.include;
|
||||||
|
|||||||
@@ -2101,7 +2101,6 @@ function this.draw_damage_meter_UI()
|
|||||||
if config_changed then
|
if config_changed then
|
||||||
local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA;
|
local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA;
|
||||||
|
|
||||||
players.display_list = {};
|
|
||||||
players.update_player_list(is_on_quest);
|
players.update_player_list(is_on_quest);
|
||||||
non_players.update_servant_list();
|
non_players.update_servant_list();
|
||||||
non_players.update_otomo_list(is_on_quest, quest_status.is_online);
|
non_players.update_otomo_list(is_on_quest, quest_status.is_online);
|
||||||
@@ -2124,10 +2123,6 @@ function this.draw_damage_meter_UI()
|
|||||||
players.update_dps(true);
|
players.update_dps(true);
|
||||||
end
|
end
|
||||||
|
|
||||||
if config_changed then
|
|
||||||
players.sort_players();
|
|
||||||
end
|
|
||||||
|
|
||||||
imgui.tree_pop();
|
imgui.tree_pop();
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
|
|||||||
|
|
||||||
local outline_offset = bar.outline.offset;
|
local outline_offset = bar.outline.offset;
|
||||||
|
|
||||||
if outline_thickness == 0 then
|
if utils.number.is_equal(outline_thickness, 0) then
|
||||||
outline_offset = 0;
|
outline_offset = 0;
|
||||||
end
|
end
|
||||||
local half_outline_offset = outline_offset / 2;
|
local half_outline_offset = outline_offset / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user