mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-29 23:08:12 -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
|
||||
|
||||
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
|
||||
local success = pcall(env_creature_UI.update);
|
||||
if not success then
|
||||
@@ -368,6 +375,13 @@ local function update_UI()
|
||||
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
|
||||
local success = pcall(env_creature_UI.update);
|
||||
if not success then
|
||||
@@ -532,4 +546,5 @@ if imgui.begin_table == nil then
|
||||
re.msg(language.current_language.customization_menu.reframework_outdated);
|
||||
end
|
||||
|
||||
time.init_global_timers();
|
||||
time.new_timer(update_UI, 0.5);
|
||||
@@ -8,6 +8,7 @@ local players;
|
||||
local utils;
|
||||
local language;
|
||||
local error_handler;
|
||||
local time;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -42,19 +43,34 @@ local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
this.list = {
|
||||
--poison = nil,
|
||||
--stun = nil,
|
||||
--sleep = nil,
|
||||
--paralyze = nil,
|
||||
--quake = nil,
|
||||
--ear = nil,
|
||||
--defense_down = nil,
|
||||
--resistance_down = nil,
|
||||
--stink = nil,
|
||||
--onibomb = nil,
|
||||
--bomb = nil,
|
||||
--beto = nil,
|
||||
--fire = nil,
|
||||
fireblight = nil,
|
||||
waterblight = nil,
|
||||
iceblight = nil,
|
||||
thunderblight = nil,
|
||||
dragonblight = nil,
|
||||
blastblight = nil,
|
||||
bubbleblight = nil,
|
||||
hellfireblight = nil,
|
||||
bloodblight = nil,
|
||||
poison = nil,
|
||||
stun = nil,
|
||||
paralysis = 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;
|
||||
@@ -188,7 +204,7 @@ function this.update_generic_timer(debuff_key, timer_owner, timer_field, is_infi
|
||||
return;
|
||||
end
|
||||
|
||||
if timer == 0 then
|
||||
if utils.number.is_equal(timer, 0) then
|
||||
this.list[debuff_key] = nil;
|
||||
return;
|
||||
end
|
||||
@@ -251,7 +267,7 @@ function this.update_frenzy_infection(player)
|
||||
return;
|
||||
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;
|
||||
return;
|
||||
end
|
||||
@@ -300,6 +316,7 @@ function this.init_dependencies()
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
end
|
||||
|
||||
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 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 length_method = system_array_type_def:get_method("get_Length");
|
||||
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
|
||||
local player_lobby_base_type_def = sdk.find_type_definition("snow.player.PlayerLobbyBase");
|
||||
|
||||
function this.new(type, key, name, level, duration)
|
||||
local is_infinite = false;
|
||||
@@ -79,7 +76,7 @@ function this.new(type, key, name, level, duration)
|
||||
duration = 0;
|
||||
end
|
||||
|
||||
if duration == 0 then
|
||||
if utils.number.is_equal(duration, 0) then
|
||||
is_infinite = true;
|
||||
end
|
||||
|
||||
@@ -152,6 +149,7 @@ function this.update()
|
||||
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);
|
||||
if master_player_data ~= nil then
|
||||
@@ -159,32 +157,15 @@ function this.update()
|
||||
endemic_life_buffs.update(master_player_data);
|
||||
skills.update(master_player, master_player_data);
|
||||
dangos.update(master_player_data);
|
||||
abnormal_statuses.update(master_player, master_player_data);
|
||||
|
||||
if not is_player_lobby_base then
|
||||
abnormal_statuses.update(master_player, master_player_data);
|
||||
end
|
||||
else
|
||||
error_handler.report("buffs.update", "Failed to access Data: master_player_data");
|
||||
end
|
||||
|
||||
--xy = master_player_data._Attack;
|
||||
|
||||
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
|
||||
melody_effects.update(master_player);
|
||||
end
|
||||
|
||||
function this.update_timer(buff, timer)
|
||||
@@ -231,7 +212,7 @@ function this.init_dependencies()
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
time.new_timer(this.update, 1/60);
|
||||
|
||||
end
|
||||
|
||||
return this;
|
||||
@@ -153,7 +153,7 @@ function this.update_generic(consumable_key, player_data, item_parameter, value_
|
||||
return;
|
||||
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;
|
||||
return;
|
||||
end
|
||||
@@ -279,7 +279,7 @@ function this.update_gourmet_fish(player_data, item_parameter)
|
||||
return;
|
||||
end
|
||||
|
||||
if gourmet_fish_timer == 0 then
|
||||
if utils.number.is_equal(gourmet_fish_timer, 0) then
|
||||
this.list.gourmet_fish = nil;
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ function this.update_cutterfly(player_data, item_parameter)
|
||||
return;
|
||||
end
|
||||
|
||||
if cutterfly_timer == 0 then
|
||||
if utils.number.is_equal(cutterfly_timer, 0) then
|
||||
this.list.cutterfly = nil;
|
||||
return;
|
||||
end
|
||||
@@ -113,7 +113,7 @@ function this.update_clothfly(player_data, item_parameter)
|
||||
return;
|
||||
end
|
||||
|
||||
if clothfly_timer == 0 then
|
||||
if utils.number.is_equal(clothfly_timer, 0) then
|
||||
this.list.clothfly = nil;
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -105,15 +105,41 @@ local melody_effect_keys = {
|
||||
|
||||
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 time_field = music_data_type_def:get_field("_Time");
|
||||
|
||||
function this.update(melody_data_table)
|
||||
for lua_index, melody_data in ipairs(melody_data_table) do
|
||||
if melody_data ~= "" then
|
||||
this.update_melody_effect(lua_index, melody_data);
|
||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||
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.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
|
||||
|
||||
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
|
||||
|
||||
@@ -124,7 +150,7 @@ function this.update_melody_effect(lua_index, melody_data)
|
||||
return;
|
||||
end
|
||||
|
||||
if melody_timer == 0 then
|
||||
if utils.number.is_equal(melody_timer, 0) then
|
||||
this.list[lua_index] = nil;
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -233,7 +233,7 @@ function this.update_generic_timer(skill_key, timer_owner, timer_field, is_infin
|
||||
return;
|
||||
end
|
||||
|
||||
if timer == 0 then
|
||||
if utils.number.is_equal(timer, 0) then
|
||||
this.list[skill_key] = nil;
|
||||
return;
|
||||
end
|
||||
@@ -286,7 +286,7 @@ function this.update_generic_number_value_field(skill_key, timer_owner, value_fi
|
||||
return;
|
||||
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;
|
||||
return;
|
||||
end
|
||||
@@ -332,7 +332,7 @@ function this.update_generic_boolean_value_field(skill_key, timer_owner, value_f
|
||||
return;
|
||||
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;
|
||||
return;
|
||||
end
|
||||
@@ -385,7 +385,7 @@ function this.update_generic_number_value_method(skill_key, timer_owner, value_m
|
||||
return;
|
||||
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;
|
||||
return;
|
||||
end
|
||||
@@ -431,7 +431,7 @@ function this.update_generic_boolean_value_method(skill_key, timer_owner, value_
|
||||
return;
|
||||
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;
|
||||
return;
|
||||
end
|
||||
@@ -500,7 +500,7 @@ function this.update_wind_mantle(player)
|
||||
return;
|
||||
end
|
||||
|
||||
if wind_mantle_timer == 0 then
|
||||
if utils.number.is_equal(wind_mantle_timer, 0) then
|
||||
this.list.wind_mantle = nil;
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -185,15 +185,16 @@ function this.update_servant_list()
|
||||
this.servant_list[id] = this.new(id, name, 0, players.types.servant);
|
||||
end
|
||||
|
||||
if not cached_config.settings.hide_servants then
|
||||
table.insert(players.display_list, this.servant_list[id]);
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
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_on_quest then
|
||||
--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 myself_id = players.myself.id;
|
||||
if this.otomo_list[myself_id] == nil then
|
||||
this.otomo_list[myself_id] = this.new(0, name, level, players.types.my_otomo);
|
||||
end
|
||||
|
||||
if cached_config.settings.show_my_otomos_separately then
|
||||
table.insert(players.display_list, this.otomo_list[myself_id]);
|
||||
local otomo = this.otomo_list[myself_id]
|
||||
if otomo == nil then
|
||||
otomo = this.new(0, name, level, players.types.my_otomo);
|
||||
this.otomo_list[myself_id] = otomo;
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -247,18 +246,18 @@ function this.update_my_otomos()
|
||||
local name = otomo_create_data_name_field:get_data(second_otomo);
|
||||
if name == nil then
|
||||
error_handler.report("non_players.update_my_otomos", "Failed to access Data: second_otomo -> name");
|
||||
return;
|
||||
end
|
||||
|
||||
if name ~= nil and name ~= "" then
|
||||
if name ~= "" then
|
||||
local level = otomo_create_data_level_field:get_data(second_otomo) or 0;
|
||||
|
||||
-- the secondary otomo is actually the 4th one!
|
||||
if this.otomo_list[this.my_second_otomo_id] == nil then
|
||||
this.otomo_list[this.my_second_otomo_id] = this.new(this.my_second_otomo_id, name, level, players.types.my_otomo);
|
||||
end
|
||||
local otomo = this.otomo_list[this.my_second_otomo_id];
|
||||
|
||||
if cached_config.settings.show_my_otomos_separately then
|
||||
table.insert(players.display_list, this.otomo_list[this.my_second_otomo_id]);
|
||||
if otomo == nil then
|
||||
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
|
||||
@@ -297,12 +296,11 @@ function this.update_servant_otomos()
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if this.otomo_list[member_id] == nil then
|
||||
this.otomo_list[member_id] = this.new(member_id, name, level, players.types.servant_otomo);
|
||||
end
|
||||
local otomo = this.otomo_list[member_id];
|
||||
|
||||
if cached_config.settings.show_servant_otomos_separately then
|
||||
table.insert(players.display_list, this.otomo_list[member_id]);
|
||||
if otomo == nil then
|
||||
otomo = this.new(member_id, name, level, players.types.servant_otomo);
|
||||
this.otomo_list[member_id] = otomo;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -367,20 +365,6 @@ function this.update_otomos(otomo_info_field_)
|
||||
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::
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,8 +49,6 @@ this.myself = nil;
|
||||
this.myself_position = Vector3f.new(0, 0, 0);
|
||||
this.total = nil;
|
||||
|
||||
this.display_list = {};
|
||||
|
||||
this.highlighted_damage_UI = nil;
|
||||
|
||||
this.damage_types = {
|
||||
@@ -137,6 +135,7 @@ function this.get_player(player_id)
|
||||
end
|
||||
|
||||
function this.update_damage(player, damage_source_type, is_large_monster, damage_object)
|
||||
|
||||
if player == nil then
|
||||
return;
|
||||
end
|
||||
@@ -337,20 +336,6 @@ function this.merge_damage(first, second)
|
||||
return first;
|
||||
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)
|
||||
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;
|
||||
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 find_master_player_method = player_manager_type_def:get_method("findMasterPlayer");
|
||||
|
||||
@@ -477,9 +414,8 @@ end
|
||||
|
||||
function this.init()
|
||||
this.list = {};
|
||||
this.display_list = {};
|
||||
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
|
||||
|
||||
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");
|
||||
|
||||
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)
|
||||
if is_on_quest then
|
||||
this.update_player_list_(quest_hunter_info_field);
|
||||
@@ -554,7 +502,10 @@ function this.update_player_list_(hunter_info_field_)
|
||||
end
|
||||
|
||||
if this.myself == nil or myself_id ~= this.myself.id then
|
||||
this.list[this.myself.id] = nil;
|
||||
if this.myself ~= nil then
|
||||
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.list[myself_id] = this.myself;
|
||||
end
|
||||
@@ -618,10 +569,6 @@ function this.update_player_list_(hunter_info_field_)
|
||||
end
|
||||
end
|
||||
|
||||
if player ~= this.myself then
|
||||
table.insert(this.display_list, player);
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
@@ -664,8 +611,6 @@ end
|
||||
|
||||
function this.init_module()
|
||||
this.init();
|
||||
time.new_timer(this.update_display_list, 0.5);
|
||||
time.new_timer(this.update_myself_position, 1);
|
||||
end
|
||||
|
||||
return this;
|
||||
|
||||
@@ -153,6 +153,11 @@ function this.set_flow_state(new_flow_state)
|
||||
end
|
||||
|
||||
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);
|
||||
if death_num == nil then
|
||||
error_handler.report("quest_status.get_cart_count", "Failed to access Data: death_num");
|
||||
@@ -162,6 +167,11 @@ function this.get_cart_count()
|
||||
end
|
||||
|
||||
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);
|
||||
if quest_life == nil then
|
||||
error_handler.report("quest_status.get_max_cart_count", "Failed to access Data: quest_life");
|
||||
@@ -405,8 +415,6 @@ end
|
||||
function this.init_module()
|
||||
this.init();
|
||||
|
||||
time.new_timer(this.update_is_online, 1);
|
||||
|
||||
sdk.hook(on_changed_game_status_method, function(args)
|
||||
this.on_changed_game_status(sdk.to_int64(args[3]));
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
@@ -45,11 +45,13 @@ function this.update_window_size()
|
||||
local width;
|
||||
local height;
|
||||
|
||||
if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||
width, height = d2d.surface_size();
|
||||
else
|
||||
width, height = this.get_game_window_size();
|
||||
end
|
||||
-- if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||
-- width, height = d2d.surface_size();
|
||||
-- else
|
||||
-- width, height = this.get_game_window_size();
|
||||
-- end
|
||||
|
||||
width, height = this.get_game_window_size();
|
||||
|
||||
if width ~= nil then
|
||||
this.width = width;
|
||||
@@ -143,7 +145,6 @@ function this.init_dependencies()
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
time.new_timer(this.update_window_size, 1);
|
||||
end
|
||||
|
||||
return this;
|
||||
|
||||
@@ -191,7 +191,6 @@ end
|
||||
|
||||
function this.init_module()
|
||||
this.init();
|
||||
time.new_timer(this.init, 1);
|
||||
end
|
||||
|
||||
return this;
|
||||
|
||||
@@ -9,6 +9,9 @@ local config;
|
||||
local small_monster;
|
||||
local utils;
|
||||
local error_handler;
|
||||
local screen;
|
||||
local buffs;
|
||||
local player_info;
|
||||
|
||||
local sdk = sdk;
|
||||
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
|
||||
return;
|
||||
end
|
||||
|
||||
local timer = {};
|
||||
timer.callback = callback;
|
||||
timer.cooldown = cooldown_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
|
||||
|
||||
function this.update_timers()
|
||||
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
|
||||
timer.last_trigger_time = this.total_elapsed_script_seconds;
|
||||
timer.callback();
|
||||
callback();
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -122,10 +138,12 @@ function this.init_dependencies()
|
||||
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
||||
utils = require("MHR_Overlay.Misc.utils");
|
||||
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
|
||||
|
||||
function this.init_module()
|
||||
this.new_timer(this.update_quest_time, 1 / 60);
|
||||
end
|
||||
|
||||
return this;
|
||||
|
||||
@@ -49,7 +49,7 @@ function this.report(error_key, error_message)
|
||||
|
||||
local error_time = time.total_elapsed_script_seconds;
|
||||
|
||||
if error_time == 0 then
|
||||
if utils.number.is_equal(error_time, 0) then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
@@ -245,7 +245,6 @@ function this.init_dependencies()
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
time.new_timer(this.update, 0.5);
|
||||
end
|
||||
|
||||
return this;
|
||||
|
||||
@@ -44,9 +44,164 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
local top_damage = 0;
|
||||
local top_dps = 0;
|
||||
|
||||
this.displayed_players = {};
|
||||
this.last_displayed_players = {};
|
||||
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()
|
||||
local cached_config = config.current_config.damage_meter_UI;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
@@ -55,46 +210,21 @@ function this.draw()
|
||||
return;
|
||||
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);
|
||||
|
||||
-- draw total damage
|
||||
if cached_config.settings.total_damage_location == "First" then
|
||||
if cached_config.settings.hide_total_damage then
|
||||
return;
|
||||
end
|
||||
if cached_config.settings.total_damage_location == "First"
|
||||
and not cached_config.settings.hide_total_damage then
|
||||
if not (cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0) then
|
||||
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
|
||||
position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
|
||||
else
|
||||
position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier;
|
||||
if cached_config.settings.orientation == "Horizontal" then
|
||||
position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
|
||||
else
|
||||
position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,37 +233,7 @@ function this.draw()
|
||||
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
end
|
||||
|
||||
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;
|
||||
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
|
||||
for _, player in ipairs(this.displayed_players) do
|
||||
|
||||
players.draw(player, position_on_screen, 1, top_damage, top_dps);
|
||||
|
||||
@@ -147,20 +247,17 @@ function this.draw()
|
||||
end
|
||||
|
||||
-- draw total damage
|
||||
if cached_config.settings.total_damage_location == "Last" then
|
||||
if cached_config.settings.hide_total_damage then
|
||||
return;
|
||||
end
|
||||
if cached_config.settings.total_damage_location == "Last"
|
||||
and not cached_config.settings.hide_total_damage then
|
||||
|
||||
if 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.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0) then
|
||||
|
||||
if not cached_config.settings.total_damage_offset_is_relative then
|
||||
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
end
|
||||
if not cached_config.settings.total_damage_offset_is_relative then
|
||||
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
end
|
||||
|
||||
players.draw(players.total, position_on_screen, 1);
|
||||
players.draw(players.total, position_on_screen, 1);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ local stamina_UI_entity;
|
||||
local rage_UI_entity;
|
||||
local env_creature;
|
||||
local error_handler;
|
||||
local utils;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -52,7 +53,7 @@ function this.update()
|
||||
|
||||
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 = {};
|
||||
return;
|
||||
end
|
||||
@@ -116,6 +117,7 @@ function this.init_dependencies()
|
||||
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
||||
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
utils = require("MHR_Overlay.Misc.utils");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -11,6 +11,7 @@ local health_UI_entity;
|
||||
local stamina_UI_entity;
|
||||
local rage_UI_entity;
|
||||
local error_handler;
|
||||
local utils;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -116,7 +117,7 @@ function this.update_dynamic_monsters(large_monster_list, cached_config)
|
||||
|
||||
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 = {};
|
||||
return;
|
||||
end
|
||||
@@ -407,6 +408,7 @@ function this.init_dependencies()
|
||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
utils = require("MHR_Overlay.Misc.utils");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -10,6 +10,7 @@ local drawing;
|
||||
local health_UI_entity;
|
||||
local stamina_UI_entity;
|
||||
local error_handler;
|
||||
local utils;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -52,7 +53,7 @@ local displayed_monsters = {};
|
||||
function this.update()
|
||||
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 = {};
|
||||
return;
|
||||
end
|
||||
@@ -179,6 +180,7 @@ function this.init_dependencies()
|
||||
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
|
||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
utils = require("MHR_Overlay.Misc.utils");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -115,6 +115,9 @@ end
|
||||
function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
|
||||
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;
|
||||
if player.damage_UI.name_label ~= nil then
|
||||
name_include = player.damage_UI.name_label.include;
|
||||
|
||||
@@ -2101,7 +2101,6 @@ function this.draw_damage_meter_UI()
|
||||
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;
|
||||
|
||||
players.display_list = {};
|
||||
players.update_player_list(is_on_quest);
|
||||
non_players.update_servant_list();
|
||||
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);
|
||||
end
|
||||
|
||||
if config_changed then
|
||||
players.sort_players();
|
||||
end
|
||||
|
||||
imgui.tree_pop();
|
||||
end
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
|
||||
|
||||
local outline_offset = bar.outline.offset;
|
||||
|
||||
if outline_thickness == 0 then
|
||||
if utils.number.is_equal(outline_thickness, 0) then
|
||||
outline_offset = 0;
|
||||
end
|
||||
local half_outline_offset = outline_offset / 2;
|
||||
|
||||
Reference in New Issue
Block a user