mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-30 07:18:03 -08:00
Compare commits
4 Commits
1f0cd6e883
...
6528394876
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6528394876 | ||
|
|
fcfdb33dbf | ||
|
|
6f742d3234 | ||
|
|
64130aa68c |
@@ -145,10 +145,6 @@ local player_data_type_def = sdk.find_type_definition("snow.player.PlayerData");
|
||||
local virus_overcome_buff_timer_field = player_data_type_def:get_field("_VirusOvercomeBuffTimer");
|
||||
|
||||
|
||||
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(player, player_data)
|
||||
--local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager);
|
||||
--if item_parameter == nil then
|
||||
@@ -289,7 +285,6 @@ function this.update_generic(debuff_key, timer, duration)
|
||||
|
||||
debuff = buffs.new(buffs.types.debuff, debuff_key, name, 1, duration);
|
||||
this.list[debuff_key] = debuff;
|
||||
|
||||
elseif timer ~= nil then
|
||||
buffs.update_timer(debuff, timer);
|
||||
end
|
||||
|
||||
@@ -97,10 +97,6 @@ local stamina_up_buff_second_timer_field = player_data_type_def:get_field("_Stam
|
||||
-- Gourmet Fish
|
||||
local fish_regene_enable_field = player_data_type_def:get_field("_FishRegeneEnableTimer");
|
||||
|
||||
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(player_data)
|
||||
local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager);
|
||||
if item_parameter == nil then
|
||||
|
||||
@@ -67,10 +67,6 @@ local player_data_type_def = sdk.find_type_definition("snow.player.PlayerData");
|
||||
-- Dango Defender
|
||||
local kitchen_skill_048_field = player_data_type_def:get_field("_KitchenSkill048_Damage");
|
||||
|
||||
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(player_data)
|
||||
local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager);
|
||||
if item_parameter == nil then
|
||||
|
||||
@@ -60,10 +60,6 @@ local crit_up_ec_second_timer_field = player_data_type_def:get_field("_CritUpEcS
|
||||
-- Clothfly
|
||||
local def_up_buff_second_rate_timer_field = player_data_type_def:get_field("_DefUpBuffSecondRateTimer");
|
||||
|
||||
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 message_manager_type_def = sdk.find_type_definition("snow.gui.MessageManager");
|
||||
local get_env_creature_name_message_method = message_manager_type_def:get_method("getEnvCreatureNameMessage");
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ local music_data_type_def = sdk.find_type_definition("snow.player.Horn.MusicData
|
||||
local time_field = music_data_type_def:get_field("_Time");
|
||||
|
||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||
local length_method = system_array_type_def:get_method("get_Length");
|
||||
local get_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)
|
||||
@@ -125,7 +125,7 @@ function this.update(master_player)
|
||||
return;
|
||||
end
|
||||
|
||||
local length = length_method:call(music_data_array) - 1;
|
||||
local length = get_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;
|
||||
|
||||
@@ -156,10 +156,6 @@ local equip_skill_226_attack_off_timer_field = player_quest_base_type_def:get_fi
|
||||
-- Heaven-Sent
|
||||
local is_active_equip_skill_230_method = player_quest_base_type_def:get_method("isActiveEquipSkill230");
|
||||
|
||||
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(player, player_data)
|
||||
--local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager);
|
||||
--if item_parameter == nil then
|
||||
|
||||
@@ -264,13 +264,11 @@ function this.cart(dead_player_id, flag_cat_skill_insurance)
|
||||
-- flag_cat_skill_insurance = 0
|
||||
-- flag_cat_skill_insurance = 1
|
||||
|
||||
local player = players.list[dead_player_id];
|
||||
if player == nil then
|
||||
error_handler.report("damage_hook.cart", "No Dead Player Found");
|
||||
return;
|
||||
end
|
||||
|
||||
player.cart_count = player.cart_count + 1;
|
||||
--local player = players.list[dead_player_id];
|
||||
--if player == nil then
|
||||
-- error_handler.report("damage_hook.cart", "No Dead Player Found");
|
||||
-- return;
|
||||
--end
|
||||
|
||||
quest_status.get_cart_count();
|
||||
end
|
||||
|
||||
@@ -231,7 +231,7 @@ function this.update_my_otomos()
|
||||
local level = otomo_create_data_level_field:get_data(first_otomo) or 0;
|
||||
|
||||
local myself_id = players.myself.id;
|
||||
local otomo = 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;
|
||||
|
||||
@@ -415,7 +415,7 @@ end
|
||||
function this.init()
|
||||
this.list = {};
|
||||
this.total = this.new(0, "Total", 0, 0, this.types.total);
|
||||
this.myself = nil;
|
||||
this.myself = this.new(-1, "MHROverlayDummy", -1, -1, this.types.myself);
|
||||
end
|
||||
|
||||
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
|
||||
@@ -448,46 +448,43 @@ local get_master_player_id_method = player_manager_type_def:get_method("getMaste
|
||||
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);
|
||||
if is_on_quest then
|
||||
this.update_player_list(quest_hunter_info_field);
|
||||
else
|
||||
this.update_player_list(hunter_info_field);
|
||||
end
|
||||
|
||||
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);
|
||||
else
|
||||
this.update_player_list_(hunter_info_field);
|
||||
end
|
||||
end
|
||||
|
||||
function this.update_player_list_(hunter_info_field_)
|
||||
function this.update_player_list(hunter_info_field_)
|
||||
local cached_config = config.current_config.damage_meter_UI;
|
||||
|
||||
if singletons.lobby_manager == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: lobby_manager");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: lobby_manager");
|
||||
return;
|
||||
end
|
||||
|
||||
if singletons.progress_manager == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: progress_manager");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: progress_manager");
|
||||
return;
|
||||
end
|
||||
|
||||
local update_cart_count = false;
|
||||
|
||||
-- myself player
|
||||
local myself_player_info = my_hunter_info_field:get_data(singletons.lobby_manager);
|
||||
if myself_player_info == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: myself_player_info");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: myself_player_info");
|
||||
return;
|
||||
end
|
||||
|
||||
local myself_player_name = name_field:get_data(myself_player_info);
|
||||
if myself_player_name == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: myself_player_name");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: myself_player_name");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -497,42 +494,40 @@ function this.update_player_list_(hunter_info_field_)
|
||||
local myself_id = get_master_player_id_method:call(singletons.player_manager);
|
||||
|
||||
if myself_id == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: myself_id");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: myself_id");
|
||||
return;
|
||||
end
|
||||
|
||||
if this.myself == nil or myself_id ~= this.myself.id then
|
||||
if this.myself ~= nil then
|
||||
this.list[this.myself.id] = nil;
|
||||
end
|
||||
|
||||
this.list[this.myself.id] = nil;
|
||||
this.myself = this.new(myself_id, myself_player_name, myself_master_rank, myself_hunter_rank, this.types.myself);
|
||||
this.list[myself_id] = this.myself;
|
||||
update_cart_count = true;
|
||||
end
|
||||
|
||||
-- other players
|
||||
local player_info_array = hunter_info_field_:get_data(singletons.lobby_manager);
|
||||
if player_info_array == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: player_info_array");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: player_info_array");
|
||||
return;
|
||||
end
|
||||
|
||||
local count = get_count_method:call(player_info_array);
|
||||
if count == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: player_info_array -> count");
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: player_info_array -> count");
|
||||
return;
|
||||
end
|
||||
|
||||
for i = 0, count - 1 do
|
||||
local player_info = get_item_method:call(player_info_array, i);
|
||||
if player_info == nil then
|
||||
error_handler.report("players.update_player_list_", "Failed to access Data: player_info No. " .. tostring(i));
|
||||
error_handler.report("players.update_player_list", "Failed to access Data: player_info No. " .. tostring(i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local id = member_index_field:get_data(player_info);
|
||||
if id == nil then
|
||||
error_handler.report("players.update_player_list_", string.format("Failed to access Data: player_info No. %d -> id", i));
|
||||
error_handler.report("players.update_player_list", string.format("Failed to access Data: player_info No. %d -> id", i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -541,7 +536,7 @@ function this.update_player_list_(hunter_info_field_)
|
||||
|
||||
local name = name_field:get_data(player_info);
|
||||
if name == nil then
|
||||
error_handler.report("players.update_player_list_", string.format("Failed to access Data: player_info No. %d -> name", i));
|
||||
error_handler.report("players.update_player_list", string.format("Failed to access Data: player_info No. %d -> name", i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -563,14 +558,20 @@ function this.update_player_list_(hunter_info_field_)
|
||||
player = this.new(id, name, master_rank, hunter_rank, this.types.myself);
|
||||
this.myself = player;
|
||||
this.list[id] = player;
|
||||
update_cart_count = true;
|
||||
else
|
||||
player = this.new(id, name, master_rank, hunter_rank, this.types.other_player);
|
||||
this.list[id] = player;
|
||||
update_cart_count = true;
|
||||
end
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
|
||||
if update_cart_count then
|
||||
quest_status.get_cart_count();
|
||||
end
|
||||
end
|
||||
|
||||
function this.init_UI(player)
|
||||
|
||||
@@ -117,6 +117,16 @@ local unique_event_manager_type_def = sdk.find_type_definition("snow.eventcut.Un
|
||||
local play_event_common_method = unique_event_manager_type_def:get_method("playEventCommon");
|
||||
local event_manager_dispose_method = unique_event_manager_type_def:get_method("dispose");
|
||||
|
||||
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
|
||||
local get_player_data_method = player_manager_type_def:get_method("get_PlayerData");
|
||||
|
||||
local player_data_type_def = sdk.find_type_definition("snow.player.PlayerData");
|
||||
local die_count_field = player_data_type_def:get_field("_DieCount");
|
||||
|
||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||
local get_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.get_flow_state_name(flow_state, new_line)
|
||||
for key, value in pairs(this.flow_states) do
|
||||
if value == flow_state then
|
||||
@@ -145,11 +155,15 @@ function this.set_flow_state(new_flow_state)
|
||||
small_monster.init_list();
|
||||
large_monster.init_list();
|
||||
env_creature.init_list();
|
||||
|
||||
damage_meter_UI.last_displayed_players = {};
|
||||
|
||||
elseif this.flow_state >= this.flow_states.LOADING_QUEST then
|
||||
this.get_cart_count();
|
||||
this.get_max_cart_count();
|
||||
end
|
||||
|
||||
players.update_players();
|
||||
end
|
||||
|
||||
function this.get_cart_count()
|
||||
@@ -161,9 +175,47 @@ function this.get_cart_count()
|
||||
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");
|
||||
else
|
||||
this.cart_count = death_num;
|
||||
end
|
||||
|
||||
this.cart_count = death_num;
|
||||
|
||||
if singletons.player_manager == nil then
|
||||
error_handler.report("quest_status.get_cart_count", "Failed to access Data: player_manager");
|
||||
return;
|
||||
end
|
||||
|
||||
local player_data_array = get_player_data_method:call(singletons.player_manager);
|
||||
if player_data_array == nil then
|
||||
error_handler.report("quest_status.get_cart_count", "Failed to access Data: player_data_array");
|
||||
return;
|
||||
end
|
||||
|
||||
local player_data_array_length = get_length_method:call(player_data_array);
|
||||
if player_data_array_length == nil then
|
||||
error_handler.report("quest_status.get_cart_count", "Failed to access Data: player_data_array_length");
|
||||
return;
|
||||
end
|
||||
|
||||
for i = 0, player_data_array_length - 1 do
|
||||
local player_data = get_value_method:call(player_data_array, i);
|
||||
if player_data_array_length == nil then
|
||||
error_handler.report("quest_status.get_cart_count", string.format("Failed to access Data: player_data No. %d", i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local die_count = die_count_field:get_data(player_data);
|
||||
if die_count == nil then
|
||||
error_handler.report("quest_status.get_cart_count", string.format("Failed to access Data: die_count No. %d", i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local player = players.list[i];
|
||||
if player ~= nil then
|
||||
player.cart_count = die_count;
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
function this.get_max_cart_count()
|
||||
|
||||
@@ -88,7 +88,7 @@ local element_attack_2nd_field = player_data_type_def:get_field("_ElementAttack2
|
||||
local resistance_element_field = player_data_type_def:get_field("_ResistanceElement");
|
||||
|
||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||
local length_method = system_array_type_def:get_method("get_Length");
|
||||
local get_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()
|
||||
|
||||
@@ -272,7 +272,7 @@ local poison_damage_field = poison_param_type_def:get_field("<Damage>k__BackingF
|
||||
local poison_get_is_damage_method = poison_param_type_def:get_method("get_IsDamage");
|
||||
|
||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||
local length_method = system_array_type_def:get_method("get_Length");
|
||||
local get_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_ailments(enemy, monster)
|
||||
@@ -305,7 +305,7 @@ function this.update_ailments(enemy, monster)
|
||||
return;
|
||||
end
|
||||
|
||||
local condition_param_array_length = length_method:call(condition_param_array);
|
||||
local condition_param_array_length = get_length_method:call(condition_param_array);
|
||||
if condition_param_array_length == nil then
|
||||
error_handler.report("ailments.update_ailments", "Failed to access Data: condition_param_array_length");
|
||||
return;
|
||||
@@ -364,7 +364,7 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
local buildup_limit = nil;
|
||||
|
||||
if activate_count_array ~= nil then
|
||||
local activate_count_array_length = length_method:call(activate_count_array);
|
||||
local activate_count_array_length = get_length_method:call(activate_count_array);
|
||||
|
||||
if activate_count_array_length ~= nil then
|
||||
|
||||
@@ -385,7 +385,7 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
|
||||
if buildup_array ~= nil then
|
||||
local buildup_array_length = length_method:call(buildup_array);
|
||||
local buildup_array_length = get_length_method:call(buildup_array);
|
||||
|
||||
if buildup_array_length ~= nil then
|
||||
|
||||
@@ -406,7 +406,7 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
|
||||
if buildup_limit_array ~= nil then
|
||||
local buildup_limit_array_length = length_method:call(buildup_limit_array);
|
||||
local buildup_limit_array_length = get_length_method:call(buildup_limit_array);
|
||||
|
||||
if buildup_limit_array_length ~= nil then
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ local get_mario_player_index_method = mario_param_type:get_method("get_MarioPlay
|
||||
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
|
||||
|
||||
local system_array_type_def = sdk.find_type_definition("System.Array");
|
||||
local length_method = system_array_type_def:get_method("get_Length");
|
||||
local get_length_method = system_array_type_def:get_method("get_Length");
|
||||
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
|
||||
|
||||
-- Lucent Nargacuga
|
||||
@@ -920,7 +920,7 @@ function this.update_parts(enemy, monster, physical_param)
|
||||
return;
|
||||
end
|
||||
|
||||
local core_parts_array_length = length_method:call(core_parts_array);
|
||||
local core_parts_array_length = get_length_method:call(core_parts_array);
|
||||
if core_parts_array_length == nil then
|
||||
error_handler.report("large_monster.update_parts", "Failed to access Data: core_parts_array_length");
|
||||
return;
|
||||
@@ -1074,7 +1074,7 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
|
||||
return;
|
||||
end
|
||||
|
||||
local core_parts_array_length = length_method:call(core_parts_array);
|
||||
local core_parts_array_length = get_length_method:call(core_parts_array);
|
||||
if core_parts_array_length == nil then
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: core_parts_array_length");
|
||||
return;
|
||||
|
||||
@@ -201,6 +201,7 @@ function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dp
|
||||
local bar = player.damage_UI.bar;
|
||||
local name_label = player.damage_UI.name_label;
|
||||
local hunter_rank_label = player.damage_UI.hunter_rank_label;
|
||||
local cart_count_label = player.damage_UI.cart_count_label;
|
||||
local value_label = player.damage_UI.value_label;
|
||||
local percentage_label = player.damage_UI.percentage_label;
|
||||
local dps_label = player.damage_UI.dps_label;
|
||||
@@ -211,6 +212,7 @@ function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dp
|
||||
bar = players.highlighted_damage_UI.bar;
|
||||
name_label = players.highlighted_damage_UI.name_label;
|
||||
hunter_rank_label = players.highlighted_damage_UI.hunter_rank_label;
|
||||
cart_count_label = players.highlighted_damage_UI.cart_count_label;
|
||||
value_label = players.highlighted_damage_UI.value_label;
|
||||
percentage_label = players.highlighted_damage_UI.percentage_label;
|
||||
dps_label = players.highlighted_damage_UI.dps_label;
|
||||
@@ -231,7 +233,7 @@ function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dp
|
||||
if player.type == players.types.total then
|
||||
drawing.draw_label(player.damage_UI.cart_count_label, position_on_screen, opacity_scale, quest_status.cart_count, quest_status.max_cart_count);
|
||||
else
|
||||
drawing.draw_label(player.damage_UI.cart_count_label, position_on_screen, opacity_scale, player.cart_count);
|
||||
drawing.draw_label(cart_count_label, position_on_screen, opacity_scale, player.cart_count);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2083,6 +2083,9 @@ function this.draw_damage_meter_UI()
|
||||
changed = label_customization.draw(language.current_language.customization_menu.hunter_rank_label, cached_config.highlighted.hunter_rank_label);
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
changed = label_customization.draw(language.current_language.customization_menu.cart_count_label, cached_config.highlighted.cart_count_label);
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
changed = label_customization.draw(language.current_language.customization_menu.dps_label, cached_config.highlighted.dps_label);
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
@@ -2099,11 +2102,7 @@ function this.draw_damage_meter_UI()
|
||||
end
|
||||
|
||||
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.update_player_list(is_on_quest);
|
||||
non_players.update_servant_list();
|
||||
non_players.update_otomo_list(is_on_quest, quest_status.is_online);
|
||||
players.update_players();
|
||||
end
|
||||
|
||||
if damage_display_changed then
|
||||
|
||||
Reference in New Issue
Block a user